texts: Stray trailing 4m before prompt with Zsh in M-x ansi-term

texts:
I recently read Running Shells in Emacs, and spend some time to adapt my elaborate Zsh prompt to work with the limited capabilities of M-x shell and M-x ansi-term.

Following this effort I'm now finally able to use Zsh from within Emacs, however there is an—albeit minor—nuisance with M-x ansi-term.  I always see the stray text 4m before the prompt.

As you can see, this phenomenon seems to be independent of the actual prompt theme.  It also appears with any of the built-in prompts, even the simple ones that don't use any fancy control characters.  As a matter of fact, it even happens with the default prompt, i.e. if I start Zsh without my .zshrc.

Well, it's really just a minor nuisance, and I wouldn't not really mind if I weren't able to get rid of it—I mostly prefer M-x shell anyway, where this issue does not occur.

But it really annoys me that I haven't been able to find the cause of this issue, even though I really tried to debug it.  I must say, though, that my understanding of terminals is rather limited, so I might have missed the very obvious.

I'm on OS X 10.10.  My Emacs is 25.0.50, build straight from trunk with Homebrew, and no special flags.  Zsh is 5.0.5, as included with Yosemite, but the issue also occurs with 5.0.7 installed via Homebrew.

Can anyone shed a light on this issue?


texts: Map each element of a list over every element of another list

texts:
Let's assume I've got two lists: ("A" "B" "C" "D") and ("+" "-"). I want to concatenate each element of the first list with every element of the second to get ("A+" "A-" "B+" "B-" ... ). Is there a proper function to do that, e.g. (map-each 'concat list1 list2) => list3?

I came to a solution using nested mapcar calls and reduce but I think I may be missing something since it doesn't seem to be very uncommon task.

(reduce 'append
        (mapcar
         (lambda (x)
           (mapcar
             (lambda (y)
               (concat x y))
             '("+" "-")))
         '("A" "B" "C" "D")))


texts: Can I use Right Alt/Ctrl Keys as Alt/Super/Hyper modifier keys of Emacs in Windows 10?

texts:
I noticed that I've rarely used Right Control Key and Right Alt Key in my keyboard, so I'm wondering if I can use them as Alt/Super/Hyper modifier key in Emacs.
Is such a thing possible in Windows 10?
Taking a look at `w32fns.c' seems right control key is equivalently treated as left control key, so it may be difficult by Emacs alone.  I just want to know if it can be realized by the combination with AutoHotkey or other key event modifier tools.
BTW, assigning Windows (either Left/Right) Key as Super/Hyper key works perfectly in my environment by following codes, and I use Left Windows as functions provided by the Windows OS, so I only use Right Windows key as Superkey.
  (setq w32-pass-rwindow-to-system nil)
  (setq w32-rwindow-modifier 'super)
  (w32-register-hot-key [s-])


texts: How can I split LaTeX inline math from preceeding or following sticked words?

texts:
I have this LaTeX code:

Lorem $math$ ipsum $math$dolor sit consecteruer adipscing elit,
sed do eiusmod tempor incidunt ut labore et dolore magna aliqua.
$math$Ut $math$ enim ad minim veniam$math$, quis nostrum exercitationem
ullamco laboriosam, $math$nisi ut aliquid ex ea commodi consequatur$math$.

I want to split math from following and preceeding text, that's to say, I want to replace

$math$word

word$math$

with

$math$ word

word $math$

So, I have tried with the following:

M-x query-replace-regexp RET \$\([^$]+?\)\$\\([^\S]\) RET $\1$ \2

and

M-x query-replace-regexp RET \([^S]\)\$\([^$]+?\) RET \1 $\2$

The problem is that these regularx expressions match too much than it is necessary.

Indeed, first replacement matches

"$math$i"

"$math$d"

"$math$U"

"$math$ "

"$math$,"

"$math$n"

"$math$."

and only the first, second, third and sixth matches are necessary.

The second replacement matches:

" $math$"

" $math$"

"^J $match$"

" $math$"

"m$math$"

" $math$"

"r$math$"

and only the fifth and seventh matches are necessary.

How can I match only $math$word and word$math$?


texts: Does Elisp replay on hash lookups every time code require access to symbol value?

texts:
I go across blog post: http://blog.cdleary.com/2010/09/picing-on-javascript-for-fun-and-profit/

It is about JS performance on accessing object properties and tricks that help reduce that time. Usual access require hash table lookup. Optimized solution makes type checks, if type is not changed we can use direct address from cache.

I wonder is GNU ELisp require hash lookup for symbol? For:

(defun adjust-fill-column (val) (setq fill-column val))

I get:

(byte-compile 'adjust-fill-column)

#[(val) "^H\211^Q\207" [val fill-column] 2]

(disassemble (byte-compile 'adjust-fill-column))

byte code:
  args: (val)
0       varref    val
1       dup
2       varset    fill-column
3       return

Does that mean that on every call of adjust-fill-column varref and varset do hash lookup? Is that done inside body or when [val fill-column] array processed?


texts: Open "emacs -nw" and running a command from bash

texts: I would like to know if it is possible, with a single command from bash, to open a file with emacs -nwand execute a command in the same time, for example goto-line 20.


texts: graphical emacs on windows - scrolling slow

texts:
I am using emacs 25.1, the "official" minGW build, on Windows 7.  Opening a very simple text file, even with emacs -Q, leads to slow scrolling.  Hit PgUp/Down and it takes time.  This happens when I run emacs as a windows program.  If I go into a command window, and run emacs -nw (either minGW or cygwin), scrolling is fine and fast.

So, what is wrong?  This is super duper annoying.  Modern computers are powerful enough to scroll a few pages of text instantly...


texts:
Running Doom Emacs 2.0.9.

If I make a selection, I can see the word-count. This is as expected because doom-modeline-enable-word-count is set to t.

However, I was expecting to see a word-count as I edit on org file because doom-modeline-continuous-word-count-modes is set to markdown-mode, gfm-mode, org-mode.

But I do not see the word-count. How do I get this working?


texts: Make "#+BEGIN_EXPORT latex" also exported to html (orgmode)

texts:
I know that placing latex code in the main text body solve my issue: the latex code is taken into account both when exporting to latex and to html. However, I like to use Latex blocks because of the syntax highlighting (usefull for long equations etc.).
Does anyone knows a way to make this block also treated by MathJax when exported throught org-export:
#+begin_export latex
\begin{equation}
\left\{
    \begin{array}{ll}
        \dfrac{\partial C(x, t)}{\partial t} = \vec{\nabla} \cdot \left( D(x)\vec{\nabla} C(x,t) \right)
        \quad \forall x\in\Omega \\
        \dfrac{\partial C(x)}{\partial \vec{n}} = 0
        \quad \forall x\in\partial\Omega \\
        C(x, t=0) = C_{init}(x)
    \end{array}
\right.
\end{equation}
#+end_export


texts: How to pass bash commands from a script to terminal?

texts: Let's say I have a bash script. Is there a way I can pass specific lines or blocks in the script to terminal process in EMACS? Just like how we do for R script using command C-c R


texts: Flycheck gutter reporting of LaTeX compiler errors

texts:
I'm wondering if it's possible to have Flycheck report LaTeX compile errors the way it reports linting errors.
For example, if I have:
\documentclass[12pt]{article}
\begin{documen} %ERROR
Hello world!
\end{document}

I get a message saying there's a compile error, and to hit "C-c `" to see it. If I do this, it jumps my cursor to the error. So somehow Emacs knows that there's an error, and knows what line it is on.
But, flycheck does not highlight any errors in the gutter. chktex linting messages are shown in the gutter just fine, so flycheck is working, it's just not getting the compile errors.
Is there any way to have this set up, so flycheck can highlight compile errors in the gutter, and I can navigate compile-errors using flycheck?


texts: How to tell Helm to ignore certain files?

texts:
There are certain files I never access from Helm, such as those in my global .gitignore file:

# Emacs backup files #
##############################
*~
*#

etc.

Is there any way of telling Helm to ignore these files?


texts: Exporting a single column of an org-table

texts:
I want to export (not sure if that's the right word) a single column of an org-table as text, with the elements separated by commas. Eg if the table is

| x  | y  |
|----+----|
|  0 |  1 |
|  2 |  3 |
|  4 |  5 |
|  6 |  7 |
|  8 |  9 |

I want to get the result 0,2,4,6,8.

In this case I want the first column, but I'd like a solution that allows me to export any single column.


texts: Emacs is blurry on scaled Windows displays (eg. Surface)

texts:
To smooth my embedded workflow I have succombed to buying a Microsoft Surface. Like the early days of MacOS retina screens Emacs is all blurry. Does anyone know if there is any support for scaled displays in Windows? Google turns up few results, but it could be I'm not searching for the right feature names, Windows noob and all...

PS: Sorry for the tag - SE thinks I should use the existing tag window instead of windows :)


texts: How do I add a sticker to a line in emacs?

texts: I'd like to add a sticker(marker) to a line in the buffer. I wanna do this because I want to mark places which I should not forgive to change during some refactoring process. I want these markers to be seen by me, for example, like gitgutter shows git diff, by adding +, - to the line start. Is there a way to do that?


texts:
I'm trying to follow the instructions in the README of this repo: https://github.com/jorgenschaefer/elpy . Everything goes smoothly until I get to the point where I am to install the package. After typing elpy and pressing enter I get a [No match] result. Any thoughts?

Here is what happens in detail. I copy and paste:

(require 'package)
(add-to-list 'package-archives
             '("elpy" . "https://jorgenschaefer.github.io/packages/"))

into my scratch buffer. I then type M-x ev-b RET and see no response in the minibuffer. I then type M-x package-refresh-contents RET and see a few quick messages fly by including what seems to be a connection to the github repo and culminates in a 'Package refresh done' message. Finally, when running M-x package-install RET elpy RET I receive a 'No Match' message and a prompt for 'Install package:'.

After all this, upon running C-h v package-archives I get:

package-archives is a variable defined in ‘package.el’.
Its value is (("gnu" . "http://elpa.gnu.org/packages/"))

This variable may be risky if used as a file-local variable.

Documentation:
An alist of archives from which to fetch.
The default value points to the GNU Emacs package repository.

Each element has the form (ID . LOCATION).
 ID is an archive name, as a string.
 LOCATION specifies the base location for the archive.
  If it starts with "http:", it is treated as a HTTP URL;
  otherwise it should be an absolute directory name.
  (Other types of URL are currently not supported.)

Only add locations that you trust, since fetching and installing
a package can run arbitrary code.

You can customize this variable.

This variable was introduced, or its default value was changed, in
version 24.1 of Emacs.

[back]


texts: Unable to use ediff with emacs and evil due to window configuration

texts:
Running emacs 25.2.2 with evil installed and updated from Melpa.

When I run ediff, it asks for usual buffer A and buffer B and then ONLY the ediff buffer in its own frame is visible with 'Type ? for help'. I can switch to the other emacs frame where the two files are  shown as expected. But none of the ediff commands work.

Earlier (without evil) ediff showed a nice three window setup with two buffers on top and ediff control buffer at the bottom.

How do I get that behavior back?


texts: Quitting Emacs and re-enabeling touchpad

texts:
I have the below elisp code in my emacs config which disables my touchpad, so it won't annoy me when writing.

;; disable touchpad when on emacs

(defun turn-off-mouse (&optional frame)
  (interactive)
  (call-process-shell-command "xinput --disable bcm5974"
                              nil "*Shell command output*" t))

(defun turn-on-mouse (&optional frame)
  (interactive)
  (call-process-shell-command "xinput --enable bcm5974"
                              nil "*Shell command output*" t))

(add-hook 'focus-in-hook #'turn-off-mouse)
(add-hook 'focus-out-hook #'turn-on-mouse)
(add-hook 'delete-frame-functions #'turn-on-mouse)

(provide 'setup-xinput)

This works fine; the problem is only when quitting Emacs.

If I quit Emacs while on Emacs, it keeps my touchpad disabled. So I need to open a new Terminal with the keyboard, and run xinput --enable bcm5974.

Is there any workaround for this? How could I quit Emacs and when quitting re-enabling my touchpad?


texts: Why can't I use my custom keybinding in ansi-term's char mode?

texts:
I'm an emacs noob

—why can't I use this key

(global-set-key (kbd "M-o") 'other-window)

defined in my emacs config, in ansi-term char mode?

Are all meta keybindings simply passed raw to the terminal process?


texts: Use formula in agenda clockreport to convert time? (pomodoro count in Agenda)

texts:
I'm trying to make the Agenda Clockreport show how many pomodoros I've invested in a task.
A Pomodoro is 25 minutes. For example, 1:15 hours of work is 3 pomodoros.

I'm trying to customize org-agenda-clockreport-paramater-plist, and I would like to extract "Time" and convert it to a pomodoro.
I.e., (time in minutes / 25) = pomodoro.

I was considering using :formula from The Clock Table but I'm not sure where to begin or where to look for examples.

Is this technically possible somehow?

[edit Solution]
Thanks to Sacha's post, I use the config as following:

(setq org-agenda-clockreport-parameter-plist
 '(:fileskip0 t :link t :maxlevel 2 :formula "$5=($3+$4)*(60/25);t"))

This creates a report that skips empty org-agenda files, has 2 levels depth and adds a column that shows pomodoros with 2 decimals. ('t' = time in hours).

E.g screenshot:

If you like, please remember to up-vote Sacha's answer.


texts: escape or omit binary data in backtrace buffer?

texts:
Many times when I check the backtrace buffer, I can't copy the text out because of the embedded binary data (perhaps it's the internal null characters making the copy function think the string is shorter than it is?) so that when I try to copy the buffer with C-x h M-w (don't remember if those are standard bindings), only a portion of the buffer gets copied (presumably up until the internal null character).

Is there a way to escape the binary data so that I may copy the buffer in its entirety? Or is there a way to omit the binary data?


texts: How can I make the initial frame invisible?

texts:
Using the following command line causes Emacs to briefly display the initial frame, then hide it:

emacs -Q --eval "(setq initial-frame-alist '((visibility . nil)))"

This is consistent with the manual:

  If these settings affect the frame geometry and appearance, you’ll see the frame appear with the wrong ones and then change to the specified ones. If that bothers you, you can specify the same geometry and appearance with X resources; those do take effect before the frame is created. See X Resources in The GNU Emacs Manual.

Which X resource should I use to make the initial frame invisible? Is there a cross-platform way to do so? On GNU/Linux, how can I set these resources for the duration of a single command?


texts: How can I debug a function that performs most work in a temporary buffer?

texts:
I've been able to do this before, but I can't remember the 'recipe' of sorts.

Say I've got the following function:

(defun fancy-stuff ()
  (with-current-buffer (get-crazy-process-output)
    (do-crazy-post-process)))

I want to debug the crazy post-processing and be able to see where/when it moves point in that buffer.

I've of course instrumented do-crazy-post-process with edebug-defun, but when I step through the code, I have no visual indication of how point is moving in the temporary buffer.


texts:
I would like to get the bibtex key of references in my .bib database as a string via helm-bibtex.
(defun get-bibtex-key ()
  (interactive)
  (with-temp-buffer
    (helm-bibtex)
    (if (string-prefix-p "cite" (buffer-string))
        (substring (buffer-string) 5) ;; Remove "cite: " from string.
      (buffer-string))
    (buffer-string)))

The code above correctly returns the desired value, but inserts text into the current buffer instead of storing its value within the get-bibtex-key function-variable as a string, which makes further deployment such as this impossible:
(bibtex-completion-get-entry (get-bibtex-key))

The above code when run just dumps the value returned by (get-bibtex-key) into the current buffer.
How can I get output from (helm-bibtex) behave like the code below?
(with-temp-buffer
  (insert "Hi!")
  (buffer-string))


texts: Can not activate a virtual environment in emacs, but can through the usual shell

texts:
I created a virtual environment that I can activate used a command line from Terminal (Ubuntu):

source/bin activate

I did what follows to achieve the same on emacs:

M-! then source/bin activate then RET

But then I guess the virtual environment is not activated and I am getting this error message:

  /bin/bash: source/bin: No such file or directory

What am I missing?

EDIT 1:

It seems I have to use a package like auto-virtualenv; and for that I have to tell Emacs to use the MELPA repository. So following the documentation.
I restarted Emacs but still can not install that package with it (M-! package-install RET auto-virtualenvRET )

EDIT 2:

Installing the virtual environment auto-virtualenv is done thanks to wvxvw's comment below. So I am supposed to get rid of the error I mentioned above, but no, it is still there.

EDIT 3:

When I run M-! then pwd I get this:

/home/h4ck3r/development/app

Then I type M-!  and source/bin activate, I get this error message:

  /bash: source/bin: No such file or directory


texts:
I want to select by regexp only spaces.

Here text:

test-hello how-are again ok
maybe good but-some not good

I use regexp

[:space:]

but it's not work:


texts: How can I enable my modifications to a library/package without modifying its source?

texts:
I have been using a forked version of python.el for some time in which I have changed the indentation rules so that instead of

something.method1()\
         .method2()

and

stuff = (1, 2, 3,
         4, 5, 6)

I get

something.method1()\
    .method2()

and

stuff = (1, 2, 3,
    4, 5, 6)

My changes are on GitHub at this commit and this commit, respectively.

The problem is that my forked version of python.el is out of date, and there's been a lot of development since then.  So my question is: how can I make the same changes by modifying my init file, without modifying the source of python.el?


texts:
make-network-process fails on Emacs25 (25.1.50.2 2016-07-03) when loaded with -q and -Q and trying to eval the following example:

(make-network-process
 :name "*server2*"
 :type nil ; stream
 :server t
 :host 'local
 :service t
 :family nil
 :nowait t
 :stop nil
 :noquery t)

;; Debugger entered--Lisp error: (file-error "make server process failed" "Success" :name "*server2*" :type nil :server t :host local :service t :family nil :nowait t :stop nil :noquery t)
;; make-network-process(:name "*server2*" :type nil :server t :host local :service t :family nil :nowait t :stop nil :noquery t)

The same example works on Emacs 24.  This same issue is referenced here:

https://stackoverflow.com/questions/38188397/emacs-make-network-process-fails-how-to-debug
https://github.com/ahungry/geben/issues/4

Is this an Emacs bug?  Is there a workaround?


texts: How to cycle between specified states in org mode?

texts: By default, S-tab cycles between OVERVIEW, CONTENTS and SHOW ALL these three states.  But I want it to just cycle between CONTENTS and SHOW ALL.  How can I realize it?


texts: How to use the auto-completion of jedi while keeping other functions of elpy?

texts:
Currently, I have both elpy and jedi installed. init.el is like:

(elpy-enable)
(elpy-use-ipython)
(setq elpy-rpc-backend "jedi")

(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)

I know that I shouldn't turn on elpy and jedi at the same time, it really causes competition and conflict in auto-completion. However, in my try I think jedi yielded a better completion. But I need elpy to manage the ipython interperator, check the grammer and many other issues. Also, (setq elpy-rpc-backend "jedi") could not produce the same result as jedi did. So my question is: is it possible to disable the auto-completion of elpy, while keeping its remaining functions, so that I can use jedi for auto-completion?


texts: Save current file with a slightly different name in Helm

texts:
This is the same question as Save current file with a slightly different name, but for Helm. (The top answer given for the original question doesn't work in Helm, sadly: M-n (next-history-element) doesn't do quite the same thing as in vanilla Emacs.)
The question is: how can I insert the filename of the current buffer into the minibuffer during write-file. So for example:
C-x C-w (this gets me to a minibuffer prompt with the current directory); in plain Emacs I could type M-n and this would insert the current filename for me to edit to a slightly different name. What can I do instead in Helm?


texts: `string-match' and `match-string' in Emacs Lisp

texts:
I try to understand the functions match-string and string-match in Emacs Lisp.
The manual provides what seems to be (?) a reproducible example:
     (string-match "\\(qu\\)\\(ick\\)"
                   "The quick fox jumped quickly.")
                   ;0123456789
          ⇒ 4

     (match-string 0 "The quick fox jumped quickly.")
          ⇒ "quick"

But this is not what I get if I try to execute those instructions. If I simply copy-paste them into a buffer and execute them with C-x C-e, the first one is OK and actually returns 4, but the second one triggers an error:
Debugger entered--Lisp error: (args-out-of-range "The quick fox jumped quickly." 341 341)
  match-string(0 "The quick fox jumped quickly.")
  eval((match-string 0 "The quick fox jumped quickly.") nil)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

All the following examples presented in the manual also trigger similar errors.
I'm using Emacs 26.3. Is there a subtlety I don't understand (e.g., should match-string be called in a specific context)?


texts: Getting call stack during call of a specific function

texts: An automatic save is triggered (from some hook in some of my extensions) directly after a buffer is modified and I can't find the reason for it. The mode auto-save-mode is not enabled in the buffer where the auto save happens. Is there a way to detect which top-function (hook) that is calling a specific function? In my case save-buffer.


texts: Change the color of ivy-current-match depending on the caller

texts:
When using ivy, say I want the current match to be red when calling counsel-M-x, but blue when calling counsel-find-file.

Is there a simple way of changing ivy-current-match depending on the function calling it?


texts: What am I giving up by activating CUA mode?

texts:
CUA mode is very close to the workflow I am used to outside Emacs, so I am tempted to activate it.

But I have learned that Emacs may have useful gems hidden in its ways, and CUA mode seems something that was attached later on.

I know the benefits of CUA Mode.

But I do not know what I give up by activating it.

Reading the Emacs Info is not very revealing about the pros and cons of Emacs core approach vs CUA mode.

The EmacsWiki section on CUA mode is also not too helpful in that regard.

What are the features that a skilled Emacs user would miss by activating CUA mode?


texts:
I added two new lines to my .bashrc so that Bash can find my Go programs:

GOROOT=/Users/jay/work
PATH=$PATH:$GOROOT/bin

But as a result, when I launch Emacs, Emacs hangs for several minutes and I get this error:

Tramp: Opening connection for bin using ssh...
Tramp: Sending command `exec ssh   -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none bin'
Tramp: Waiting for prompts from remote shell...
Tramp failed to connect.  If this happens repeatedly, try
    `M-x tramp-cleanup-this-connection'
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for bin using ssh...failed

In a previous question, I found that a path declaration in my .bashrc file caused Tramp to hang. The line was this:

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

That time, I resolved the issue by simply removing the line, since it didn't seem necessary. But this time I kind of need these path declarations.

How do I resolve this error without deleting this path declarations from my .bashrc?


texts: How do I make file paths clickable/navigable in Shell as described in the documentation?

texts:
For the life of me, I cannot get this functionality to work:

https://wikemacs.org/wiki/Shell#Make_file_paths_clickable

I've run (add-hook 'shell-mode-hook 'compilation-shell-minor-mode) in my .emacs file as the only line, hoping that it would allow me to click (or otherwise navigate) on a file path while in the shell and have that file opened, as is suggested in the link.

I hoped that this would work both for output of programs like stack traces or even things like symlinks when doing ls -l.


texts: Call function interactively and set initial content

texts: I would like to call a function (find-file) interactively and then set the initial content of the mini buffer to my server's home folder. I got as far as using call-interactively, but after that I'm lost. Any suggestions?


texts: AUCTeX: Is it possible to allow any value in k=v options?

texts:
Suppose a LaTeX command such as: \Person[<opt>]{<arg>} where <arg> may be any last name and [<opt>] may take several 'named arguments' like so:

\Person[function={President of the United States},
        otherinfo={some items of information}]{Roosevelt}

Is it possible to define a symbol in AUCTeX that would allow the user to enter those necessarily undefined values in the minibuffer when one is prompted for the accepted keys?

I have tried this so far:

(defvar LaTeX-mypackage-person-options
  '(("function")
    ("otherinfo"))
  "Local options.")

;; and then in the hooks

(TeX-add-symbols
    '("Person" [ TeX-arg-key-val LaTeX-mypackage-person-options ]t)
)

But infortunately I run into a no match warning---as expected---from the minibuffer as soon as I hit the space key.  Defining values in LaTeX-mypackage-person-options is irrelevant because these values are unpredictable by definition.

Is there a way to define such symbols properly in AUCTeX?


texts: How to avoid slow response by set-process-sentinel to process that produces many lines of output

texts:
I am running a command that produces a few thousand lines of output,
which I would like to store in a buffer. I want to run it in the
background and be alerted when it is finished. The problem is that it
typically takes of order 10 seconds to report back, when the command
itself takes a second or less to run.

Here is a trivial example. I set up my command to produce 2000 lines
of output

(setq bjm-cmd "find /Users/bjm/ -ls | head -2000")

then use following to save the output to a string and write to a
buffer

(progn
  (message "shell-command-to-string")
  (message (format-time-string "%c" (current-time)))
  (with-temp-buffer (insert-string
                     (shell-command-to-string bjm-cmd)))
  (message (format-time-string "%c" (current-time))))

This works effectively instantly.

Now if I instead run the command asynchronously:

(defun bjm-test-sentinel (process event)
  (if (string= event "finished\n")
      (message "finished")
    (message "failed"))
  (message (format-time-string "%c" (current-time))))

(progn
  (message "start-process-shell-command")
  (message (format-time-string "%c" (current-time)))
  (setq bjm-proc (start-process-shell-command "dummy" "dummy" bjm-cmd))
  (set-process-sentinel bjm-proc #'bjm-test-sentinel))

it takes about 15 seconds to complete.

I presume this is because the sentinel is parsing the output in some
way - right?

My work around is to redirect the output of my command to a file and
then read the file into the buffer. i.e.

(setq bjm-cmd "find /Users/bjm/ -ls | head -2000 > /tmp/junk")

This runs quickly, but feels like a bit of a hack - is there a better
way?

The context for this is that I am working on a package to call OS X
spotlight using the ivy and counsel libraries, but I think the
question is a generic one.


texts: Follow mode for describe-function/describe-variable

texts:
When learning elisp by reading source code (on a large screen) it would be nice to have something like a "follow mode", which automaticaly displays the output of describe-variable or describe-function on a seperate dedicated window. So as you move around the cursor you will see in another window always the description of the function or variable at point without pressing any additional key.

Is there any package which does this already?


texts: How to get the function help without typing?

texts: I'm already used to press C-h f and type a function name to ask for help on that function. But if the function name is already under the cursor (e.g. while visiting the .emacs configuration file), is there a way to avoid typing the whole thing again?


texts: What's this line between the modeline and the echo area?

texts:
I'm using a dark theme, so it's a bit hard to see, but there is a black line between the modeline and the echo area in the shot above. You can also see it between the modeline and a hydra, and the hydra and the echo area below.

Any idea what this is, so I can get rid of it if possible?


texts: Convert region/subtree from Markdown to org

texts: I often have Markdown text in my clipboard that I would like to insert into an org file. After pasting the text into my org-mode file, is there a quick way to convert it to org format? For example, invoke Pandoc on a selected region/subtree?


texts:
I copy content to *.org file, but it does not break lines (fill) automatically.

It's a very long sentence.

How could I enable it to fill automatically?


texts:
I am an emacs newbie running emacs doom on Linux. I am learning how to use traditional emacs in my free time and have an emacs config file that I want to test out.
I launch my traditional emacs by running:
emacs -u <path to my handmade emacs file> &

It starts up, doesn't load my configuration settings and gives me the error message:

Error (initialization): User emacs has no home directory

How can I load my custom files without destroying the existing doom configuration?


texts: Regexp only matching one character when using abbreviations

texts: I'm trying to expand abbreviations with some additional characters, so I'm using the regexp option on an abbrev-table to try and add these characters. The expression I used was found on this tutorial http://ergoemacs.org/emacs/elisp_abbrev.html and is "\\([_-*0-9A-Za-z]+\\)" when using this expression I can only use expands that match a single character. I've tried several different variations on the regexp and can't get anything to work. Any suggestions of what is going on would be great?


texts: After (set-buffer-modified-p nil), the first undo command doesn't set the buffer modified flag to true

texts:
If I modify a buffer and then save it, the buffer modified flag resets and the subsequent undo commands set the buffer modified flag to true.

However if I use (set-buffer-modified-p nil), the flag resets but then the first undo command doesn't set it to true.

How can I get the first undo to set the buffer modified flag to true after (set-buffer-modified-p nil)?


texts: org-attach doesn't create :Attachments: property

texts:
I've been using org-attach for a while but I recently changed org-attach-method from cp to mv andorg-attach no longer creates :Attachments: property. Rather, it gives an :ID: property (and moves the attachment to a folder named after the :ID: string as documented here. This is fine for me but I don't quite understand why :Attachments: is no longer created.

Also, I use :PROPERTIES: extensively (as suggested here) and headers with attachments are not distinct from headers with an :ID: but no attachment (except by the :ATTACH: tag). Moving the :ID: line in the :PROPERTIES: makes C-c C-a o not retrieving the attachment.

Is this behavior related to org-attach-method? If not, why is :Attachments: property missing?


texts:
I found out that querying a symbol's name using symbol-name adds the symbol to obarray.
(intern-soft "random-name") ; gives nil
(symbol-name 'random-name) ; adds random-name to obarray, gives "random-name" (string).
(intern-soft "random-name") ; gives random-name

My concern is that this bloats obarray with empty symbols (i.e no value or function definition). Is there

something like symbol-name which doesn't add the to the obarray?
a way to clear the obarray of "useless" (all cells other than the name cell are empty) symbols?

Edit -
I just found out that even evaluating a symbol adds it to the obarray. So I am assuming this language (or any lisp) is designed in a way that you don't have to worry about the size of obarray. Is this correct?


texts: How can I debug a hang when debug-on-quit doesn't work?

texts:
I have a problem with haskell-mode where Emacs will hang every time I open up a Haskell file. Mashing Ctrl-g a few times will get the file opened.

So I would imagine setting debug-on-quit would allow me to debug the issue. But it doesn't. No debugger shows up. Likewise if I run this elisp code (while 1). Emacs locks up, Ctrl-g will will break out of the hang, but no debugger.

I can sometimes bring up the debugger. Say if I run grep and then Ctrl-g whilst it is running, I will get a backtrace popping up.

So I'm not totally sure what is going on. Is there another way I should be debugging this hang with haskell-mode?

GNU Emacs 26.2 (build 1, x86_64-apple-darwin17.7.0, Carbon Version 158 AppKit 1561.6)


texts:
I was having fun adding some advice to a function:

(advice-add 'executable-find :around
            (lambda (f &rest args)
              (apply g args)))
               ;;;   ^

Ouch, a typo. Fixed it and evaluated above code again. But now I have both, the "corrected" and the "broken" advice around that function.

How do I get rid of these? Given that advice-remove needs either the function object or the around advice (which is empty here)?

(Obviously I can just quit and restart, but there's another way, is it?)


texts: How can I export images to HTML so that they open in a different tab?

texts:
I'd like to export my org-mode file to HTML and in the middle of it I have added an image.  The image I would like to be wrapped in an anchor tag so that when clicked in the HTML opens a "new" tab rather than loading into the current page.  Right now I just put the HTML in a separate file and then use #+INCLUDE: directive.
Instead, I'd like to do something all wrapped up nice like:
#+TMPL: (anchor-img "title" "href" "src" "alt")

And that would, when exported, generate the proper HTML.
Is there something like this for org-mode?  Is there another way to do this?


texts: Install package: magit (via package.el) only shows *Completions*

texts:
First time package user and magit user.

Following the installation instructions, when I enter "package-install magit", a Completions buffer is displayed, (see below).  I've tried adding both stable.melpa and melpa.  Neither give me the 'magit', by itself.

I'll be glad if someone can point out what this newbie is missing.  Should I see the 'magit' package by itself, or should I be selecting one from the Completions list?

Possible completions are:
magit-annex     magit-filenotify    magit-find-file     magit-gerrit
magit-gh-pulls  magit-gitflow   magit-imerge    magit-lfs
magit-p4    magit-rockstar  magit-stgit     magit-svn
magit-tbdiff    magit-topgit    magithub


texts: C++ indentation after member initialization list

texts:
When I add a member initialization list to my class constructor, Emacs indents the body like this:

Vector::Vector(int s) : elem{new double[s]}, sz{s}
   {

   }

I expect it to be indented the same as when there is no member initialization list:

Vector::Vector(int s)
{

}

How can I accomplish this? Should I file a bug?


texts: "Creating pipe: too many open files" error when running org-publish on large project

texts:
I have an org project that has many .org files (more than 300). When I invoke org-publish in Emacs, after a while it aborts and shows:

...
...
Publishing file e:/git/blog.site.src/src/org/life/day-time-plan.org using `org-html-publish-to-html'
Parsing config file...
apply: Creating pipe: too many open files

Emacs version: 24.5.1
Org Mode version: 8.2.10
OS: Windows 8

I found a similar issue here: https://github.com/OmniSharp/omnisharp-emacs/issues/132

... but there doesn't seem to be a known fix. Can anybody help me with this? Any info is appreciated.


texts: What's the difference between magit-branch-checkout and magit-branch-and-checkout?

texts:
If I'm on the commandline, and I'm in the master branch, and I want to create a new branch and immediately start working on it, I'd just do git checkout -b foo.
So I'm looking for the magit equivalent to this, i.e., I'd like to be able to call some magit function from within a branch, and then find myself working on the same buffer, but in a new branch that I've named.  Once I find that function, I intend to bind it to a key so that I can avoid having to muck around with transient states and such.
In the magit docs, I see two different commands that might qualify:

magit-branch-and-checkout which, according to the manual, "creates a new branch like magit-branch, but then also checks it out."  (Incidentally, this is kind of a bizarre bit of documentation, since according to the very same page of the manual, magit-branch does not, in fact, create a new branch, but rather is a prefix command that puts one in a branching transient stage.  so... huh??)

magit-branch-checkout which, according to the docs, takes the name of a branch from the user (I assume magit-branch-and-checkout must do that too, right?  unless, like, magit just picks a name for you for the new branch?), and then, per the docs, "If the user enters a new branch name, then it creates and checks that out, after also reading the starting-point from the user."

So, those sound like the exact same functionality.  Except maybe that magit-branch-checkout asks for a "starting point" (is that a commit hash?  a preexisting branch?  we are not told.).  But if that's the difference between the two, then this raises a sub-puzzle, viz.: how does magit determine the starting point for whatever magit-branch-and-checkout does?
So if I wanted to just do the magit equivalent of git checkout -b foo and immediately be working on the buffer in the new branch, would I use one of those?  Something else entirely?  Impossible within magit?
(I really wish there were a translation table somewhere from ordinary commandline git calls to magit function calls.)


texts: Incorrect value of region-end in function that calls replace-string

texts:
I am writing a function to do replacements on a highlighted region.  It appears that while region-end changes after each replace, the value is not correct.  That is, it does not point to the last character of the initial highlighted region.  I am using CUA.  Here is a shortened version of my
function.

(defun sql-cln ()
  (interactive)
  (progn
    (replace-string "\"" ""  nil (region-beginning) (region-end))
    (replace-string "\t" ""  nil (region-beginning) (region-end))
    (replace-string "\n" ""  nil (region-beginning) (region-end))
    (replace-regexp " +" " " nil (region-beginning) (region-end))
))

Here's the text I test it on.

   select x.group_id, g.loc_prefix"
            "  from station_group_xref x, station_group g"
            " where x.station_id = $1"
                "   and g.loc_grp = 1"
                "   and x.group_id = g.group_id


texts: Possible to make vc-dir aware of (hg) subrepo changes?

texts:
vc-dir works really well for most of my needs, as I use both hg and svn repositories. But most of the hg repos I work with have subrepositories. I typically use vc-dir buffers for each of the subrepos and the top level repo.

The problem is that a change in one of the subrepos does not get registered by the top level repo, so I am unable to (detect or) commit the change from emacs.

How can I make the top-level hg repo aware of subrepos?


texts: How do I find out which input modes include a specified uft-8 character?

texts:
Using the input mode latin-1-prefix I can enter "~a" which gives me "ã". I am looking for a similar way to enter the characters "āēīōū" (vocals with bars).

So my question is:

What input mode does allow me to input the characters "āēīōū"?
Is there a general method to retreive a list of input modes that include a specified character?


texts: isearch-forward, call-interactively, and isearch-filter-predicate

texts:
Here are two use cases where I call isearch-forward with some filter predicate.

(let ((isearch-filter-predicate (lambda (a b) nil)))
  (funcall 'isearch-forward))

(let ((isearch-filter-predicate (lambda (a b) nil)))
  (call-interactively 'isearch-forward))

Why is it that only the first one works?  Is there a way to have the call-interactively call take isearch-filter-predicate into account?

It seems I need call-interactively if I want commands that leave isearch (e.g., C-n) to be executed properly (that is, C-s C-n should go to the next line).


texts: How to display a marked-up string without the markup?

texts:
Q: how can I display a marked-up string without the markup?

I have a string with LaTeX markup, such as the following name with
an umlaut:

Tezc\"ur

I want to display the string in a buffer without the markup, but
with the umlaut, as in:

Tezcür

How can I display the string as intended without actually
modifying the string?  Basically, how can I convince Emacs to display \"u as ü?


texts: Overlay into empty line truncates line, workarounds?

texts:
I am using the ov library to display overlays.

If I try to insert an overlay into an empty line, it truncates the line. See the pictures below to understand the problem, and use the code to reproduce it.

(ov.el is just a wrapper using emacs' overlays, so this should not be a library specific problem.)

(require 'ov)
(defun untitled--display-char-at-point (char point)
  (progn (ov-set (ov point (+ 1 point))
                 'display char)))

(point)
(untitled--display-char-at-point "t" 192)

;; This line moves!

The below is another example of the same happening. If you evaluate this:

(defun untitled--display-char-at-point (char point)
  (progn (ov-set (ov point (+ 1 point))
                 'display char)))

(point)
(untitled--display-char-at-point "t" 184)
;; hi

;; This line moves!

you end up with this:

(defun untitled--display-char-at-point (char point)
  (progn (ov-set (ov point (+ 1 point))
                 'display char)))

(point)
(untitled--display-char-at-point "t" 184)
;; hi
t;; This line moves!

GNU Emacs 24.5.1 (x86_64-apple-darwin14.3.0, Carbon Version 157 AppKit 1347.57)

Ps. could we get an ov tag? That library is the rural jurors bees' knees.


texts: Create a new tag using ~org-roam-insert~ whose name is part of an existing tag

texts:
I'm using org-roam's org-roam-insert to insert a new tag. Currently I have two tags, Emacs and EmacsLisp, now I want to add a new tag called Lisp. However, I found it impossible. Here is the screenshot:

As you can see, there are no options for me to create a new tag Lisp. I can only select the existing tag EmacsLisp. Is it a bug or I'm missing something here?


texts: How to exit Man mode - Why does this function break eshell/man-mode?

texts:
I can't seem to find the keybinding for closing a buffer after running man in eshell. C-h b doesn't help. Neither does killing a man buffer, because eshell is unresponsive afterwards. What am I missing here?

Edit:

I've isolated code from my init file that caused the problem. It's a function to choose a popup window automatically.

(setq split-window-preferred-function 'my/split-window-func)
(defun my/split-window-func (&optional window)
  (let ((new-window (split-window-sensibly window)))
    (if (not (active-minibuffer-window))
        (select-window new-window))))

This function causes a popup window to open in Fundamental mode instead of Man mode and makes eshell buffer read-only. Why does this happen?


texts: How to use menu bar at the top via mouse?

texts:
I am opening emacs in --no-window-system mode and I switched xterm-mouse-mode on. Mouse clicks within a buffer work. However, I want the menu at the top of the window to open when I click on it.

I.e., when I click on File, I want the dropdown menu to show up the list with the options to open a file or to save the current buffer and so on.

What happens actually instead is that on the right half of the shell window a new buffer opens, showing a message like the one visible here: .

How can I get the menu bar at the top of emacs to work as I expect it? I want the ordinary behaviour from all other "normal" GUI editors, which do not operate on the command line. Thanks in advance!


texts: Signal a buffer was evaluated in an inferior process?

texts:
I am aware that this is a bit of training wheels, and that I should just trust Emacs and my keystrokes. But I think part of it is just that there's a context switch involved and I have too long of habits.

I have two visible windows: test.py in one, the inferior process *Python[/.../test.py] in the other. The active is buffer for test.py. I evaluate buffer with C-c C-c.

I would like visual feedback (in either buffer) that the code was evaluated. A blink in test.py would probably be better than something in *Python...] since I'd like a cross language solution, not just something specific for Python.


texts: How to get the string representation of a keymap event?

texts:
I'd like to get the string representation of a keymap event. For instance 19 should be printed as C-s, 1 as C-a etc...

I could make my own function to do that but since describe-keyis capable of printing the string representation of an event there must be a built-in function to do that somewhere. I looked into the manual and browsed some code and was not able to found it.


texts: org-mode: How to export underscore as underscore instead of highlight in HTML?

texts: I am using org-mode, and the document I am writing has a table name whose name looks like this: tab_weekly_report. When I export the document to HTML, I expect the name to exported as tab_weekly_report, but org-mode treats _ specially (as a markup character). How can I avoid this?


texts:
I'm playing around with apply-partially and I'm confused about what gets returned when calling this function. The documentation states that apply-partially returns a function, but then I'd expect to be able to do the following:

(defun add-numbers (a b)
  (+ a b))
(defun add2 (apply-partially 'add-numbers 2))

and then call the function:

(add2 3)

OR:

(funcall add2 3)

Unfortunately this throws an error. When I do everything inside of a let, however, it does work and I get "5" back:

(let ((add2 (apply-partially 'add-numbers 2)))
  (funcall add2 3))

I thought maybe the difference was that let doesn't use defun, as I do above, but then I would expect the following to work:

(defvar add2 (apply-partially 'add-numbers 2))
(funcall
 add2 3)

but that doesn't work either. So what am I missing? Is it not possible to assign the return value of apply-partially outside of a let?


texts: Get rid of "> > > > > > bash-5.1$" prefix in the results of a org babel code block

texts:
Anytime I execute a code block with C-c it contains the following prefixed results:
#+RESULTS:
#+begin_example
> > > > > > bash-5.1$ <result-output>
#+end_example

This is the configuration I'm using to cause the result from the above code block
#+begin_src bash :session kubectl :results output :var depends=kubectl-block
code-example
#+end_src

What's causing this and how do I get rid of this ugly output?
I'm using Doom Emacs on Mac OSX


texts: How can I stage all changes and commit them without displaying commit-message-buffer in Magit?

texts:
I am trying to write a function which stages all modified files and commits them.

Staging is easy - just run magit-stage-modified.

Committing is not - I couldn't find a way of creating a commit without invoking commit-message-buffer.

Ideally I'd like to have an interactive function looking like this:

(defun just-stage-and-commit (commit-msg)
  ;; ...
  )

Any hints? Thanks in advance!


texts:
My computer crashed whilst using emacs to ssh open a file. This was not related to emacs but an overheating problem.
Since then emacs hangs every time I try and open a remote file using ssh

I press ctrl-X ctrl-f

then type :

 /ssh:

But the colon never appears and emacs hangs.

I have tried copying in the path I want to open and it still hangs.

I  have tried using emacs in the terminal with the  -nw option it still hangs.

I can still open normal files.

I am using ubuntu 16.04

I am an emacs beginner so please bear that in mind in your answers.


texts: Can't insert "<" when writing message with Gnus after enable BBDB

texts:
I enable BBDB as below

  (el-get-bundle! bbdb
    (defun ec--bbdb-initialize ()
      (flyspell-mode t)
      (bbdb-initialize 'message)
      (bbdb-initialize 'gnus)
      (local-set-key "<TAB>" 'bbdb-complete-name))

    (add-hook 'message-mode-hook #'ec--bbdb-initialize)
    )

When I try to write message in Gnus after press a in a group. I can't insert < char. Because it is define as Prefix Command. But I can't find where it is defined in BBDB package.

The reason I think it is the issue related to BBDB is when I comments the code above in my config file, I can insert < char and it is not show as Prefix Command in describe-bindings.

Doesn't anyone know how to fix it?


texts:
When I use the org-schedule function the time stamp is inserted below the line it was called from. However, when I call org-time-stamp it is inserted where the cursor is, often being inserted between the last letter and the rest of the word. Is there a way I can make org-time-stamp insert itself on the next line, like org-schedule does?
Thanks.


texts:
I am developing a feature to adapt a mode-line to the width of the window. I have developped it so far using buffer-local variables to store the state of the mode-line, however, when I open the same buffer in several windows they all share the same mode-line state even if they have different window widths.

To solve that I would need window-local variables instead of buffer-local, but it seems that Emacs only provides make-variable-buffer-local and make-variable-frame-local.

Is there a way of emulating window-local variables for my use-case ?
Is there any thread in Emacs developpers mailing lists discussing this issue ?
More specifically, would Emacs maintainers be opened to this being implemented ?


texts: Org referencing title on #+HTML_HEAD_EXTRA

texts:
I have the following Org files:
main.org
#+TITLE: Main Document - Draft
#+SETUPFILE: ../themes/main-theme/main-theme.setup

* Test 1

main-theme.setup (CSS already loads correctly for HTML exports).
# -*- mode: org; -*-

#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../themes/report-theme/css/gutenberg.min.css"/>
#+HTML_HEAD_EXTRA: <img src="../themes/main-theme/imgs/logo.png" /> {{{title}}} [[title]] [[:title]] [:title] {{{:title}}} ‘{{{title}}}’  ‘{{{title}}}’

How do I reference the TITLE parameter in HTML_HEAD_EXTRA?


texts: org-macros in header arguments of org-babel?

texts:
Is there a way to specify org-macros that can be used in header arguments of org-babel? One application is to specify the figure path. For instance I want to define:

#+macro: folder figures_here

in the preamble, and then later,

#+begin_src R :results graphics :file {{{folder}}}/figure1.svg

and so on. This does not seem to work - is there another way such a macro can be specified, or specifically for designating the output directory there is a better way?


texts: Search/replace and replace within a block of selected text of buffer in spacemacs

texts: As stated in the title, I want to search and edit (including replace) certain strings in a selected part of a buffer, not the entire buffer!!!, how can I do it? Are there any built-in keystrokes?


texts:
I like transient-mark-mode and I like that it is activated by default. But there are a few specific buffers where I'd like to deactivate it. Unfortunately, that minor mode is either on or off globally, so you can't have it in some buffers and not in some others.

It seems that a possible workaround would be to void the highlighting face on a buffer local basis. What are the involved variables? Anybody has done this?

Or is there a better workaround?


texts: How to set python indent offset to 2 spaces in elpy emacs?

texts:
I use elpy package for Python 3 in Emacs. It uses yapf to format a Python buffer. I have tried about everything, setting tab-width to 2 and setting python-indent-offset to 2 but nothing makes it so that when I run elpy-format-code the code is format using two spaces.
I have this in init file,
(set-default tab-width 4)

But I also set it locally within my use-package declaration for elpy. Here are my elpy configs.
;; elpy
(use-package elpy
  :ensure t
  :init
  (elpy-enable)
  (setq python-shell-interpreter "python3"
        elpy-rpc-python-command "python3"
        python-shell-completion-native-enable nil
        elpy-shell-starting-directory 'current-directory
        python-remove-cwd-from-path nil
        ;; don't prompt before running compile
        compilation-read-command nil)
  ;; to keep the unhelpful warning from *Flymake log* buffer
  (remove-hook
   'flymake-diagnostic-functions
   'flymake-proc-legacy-flymake)
  :hook
  (elpy-mode . (lambda ()
                 (setq tab-width 2
                       python-indent-offset 2)
                 (highlight-indentation-mode -1))))


texts: Allow C-w to kill a region only if it is selected

texts:
Sometimes (rarely I would say) I press C-w by mistake and if the mark defines a non empty region, it gets deleted.

The few times this happened I just pressed undo, but I am afraid that sooner or later I will delete something without noticing.

Is it possible to tell emacs not to delete a region if it is not selected? It never happened to me to wanting to kill a region which was not selected, so this workaround would fix my problem.


texts: Org mode python code block with session does not return a result

texts:
I had been successfully using python code blocks with the :session header argument when I noticed that upon export no result was given.
I then simplified my example to the following two:
    #+begin_src python :python ~/anaconda3/bin/python3 :session :results output
    import random
    if random.randint(0,10) % 2 == 0:
        ret = "even"
    else:
        ret = "odd"
    print(ret)
    #+end_src

    #+RESULTS:

    #+name: session_init
    #+BEGIN_SRC python :results value :session example
    str='Hello, World'
    str
    #+END_SRC

    #+RESULTS: session_init

but found that neither yielded any results.
I'm quiet confused about this since it had been working until suddenly it wasn't.
I tried removing cache, tmp files and rebuilding my emacs packages (I'm using doom emacs) but all to no avail
I'm using org-version 9.5 and my emacs version is as such
GNU Emacs 28.0.50
Copyright (C) 2021 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

If anyone can help that'd be much appreciated.


texts:
Suppose I want to code something like this

case mode in
   lisp-mode)
       do-something
       ;;
   shell-mode)
       do-other
       ;;
   latex-mode)
       do-different
       ;;
esac

What would be the best way to do this in lisp? Especially, how to find out, which mode is in use?


texts: EXWM - How to close another emacs opened inside exwm?

texts:
Inside EXWM (from "term") I opened another Emacs session (git commit opened it).
How do I close this Emacs session?


texts: Trouble setting up Emacs SLIME on PowerPC Mac

texts:
I've downloaded and installed Emacs 24.1 on my PowerPC Mac and it works perfectly. And I've just added the Clozure CL to it and that works perfectly too using this tutorial. Now, I want to use SLIME. So I installed the SLIME package by:

M-x package-install RET
slime RET

SLIME seems to have installed itself into the directory ~/.emacs.d/elpa/slime-20141126.1323. So, I added the following code to my ~/.emacs:

(setq inferior-lisp-program "/Users/haansgruber/lisp/ccl-1.6/dppccl")
;; slime
(add-to-list 'load-path "Users/haansgruber/.emacs.d/elpa/slime-20141126.1323")
(require 'slime)
(slime-setup)

Then, restarted Emacs to see SWANK loaded SLIME but nothing happened. I entered:

M-x slime

But, this time it gave an error and fell back to inferior-lisp which is Clozure CL as shown below:

There must be some wrong lines on the .emacs config file. There are different .emacs conf lines available on the Internet and I tried several of them and they all ended up more or less with the same error, so I gave up. Could you help me find the solution?


texts: Regex Quantifier not working in string-match

texts:
All the documentation I can find says this should be returning the index of the first of the three x's but instead it returns nil:

(string-match "x\{3\}" "string with 3 x's repeating: xxx")

update: I had to escape the backslashes:

(string-match "x\\{3\\}" "string with 3 x's repeating: xxx")


texts: emacsclient not opening correctly in GUI mode

texts:
I installed emacs with homebrew and cask:

brew cask install emacs

It installed emacs 25.1.1.

I then linked the plist file to start emacs as a daemon on start up with:

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.emacs.plist

I added the following exports:

export ALTERNATE_EDITOR=""
export EDITOR="emacsclient -t"terminal
export VISUAL="emacsclient -c -a emacs"

I have the following aliases:

alias em="emacsclient -t"
alias emax="emacsclient -c -a emacs"

The first one will open emacs in the terminal window and works fine but the second alias which I thought would open the GUI.

It does open the Gui but the terminal window is holding onto the process until I close the Guid down at which point it kills the emacs process and the daemon.

It displays the following text:

  Waiting for Emacs...

How can I open the GUI in a new process and shut it down without killing the daemon?


texts: How to resolve keybinding conflict, or set precedence of the bindings to the same keys for different functions?

texts:
How do I resolve keybinding conflict? Or if it's possible to have precedence of keybindings for the same key for different functions?
I have the following snippet definition, in org-mode:
#+name:${2:name}
#+begin_src ${1:lang}
$0 $2
#+end_src

It expands to the following:
#+name:name
#+begin_src lang
 name
#+end_src

text-wise, it looks correct. But after the expansion, the fields of variable substitution are not highlighted for substitution. I cannot use TAB to update the name and lang, instead TAB would fold the expanded snippet as shown below:
#+name:name
#+begin_src lang...

It triggers function org-cycle as the cursor is just on the line of #+name:
Would it be possible to let the keybindings of TAB for snippet field substitution have higher precedence over org-cycle, so that when it's possible for snippet field substitution, then TAB will do the snippet field substitution, otherwise the ordinary org-cycle in this case?
I also welcome any other solution to make this snippet work in org-mode.


texts:
I have followed the instructions here, in a nutshell:

download/unpack AUCTeX in a directory for installation
download install cygwin
download/install Emacs (that was already done)
download/install MikTeX (or any other TeX system)

From a cygwin shell I then ran:

./configure --prefix="C:\Program Files (x86)\Emacs" --with-texmf-dir="C:\Program Files (x86)\MiKTeX 2.9\miktex\bin"

I am not 100% sure about the location of the TeX installation, however the error I get is the following:

checking for make... no
configure: error: make not found, aborting!

so i looks like configure does not find the make program. Indeed, I can't find it on the computer.

Any hints on what I am doing wrong?


texts: How can I set my Flycheck Perl include path?

texts:
I am using Flycheck using use-package like so:

(use-package flycheck
  :ensure t
  :init
  (global-flycheck-mode))

I followed https://randstructure.wordpress.com/2015/06/21/using-emacs-flycheck-with-perl-and-perlbrew/ and tried adding the

'(flycheck-perl-include-path
(quote
("/myhomedir/myprojectdir")))

and it does not work.


texts: Multiple initial buffers in different windows

texts:
I have Emacs set up to open an initial org mode buffer on startup by

(setq initial-buffer-choice "~/Directory/Subdirectory/inital_buffer1.org")

Ideally on start up, I would like to open 2 buffers in different windows separated vertically, however. Is there a way to do this? And is there some way of customizing the width of each of these initial buffers?


texts: Showing bytes as hexadecimal escapes rather than octal escapes

texts:
Short version: Can I make Emacs show \ff or \xff instead of \377?

Long version: Suppose you open a file that is not entirely text and has some binary data (say a PostScript or PDF file). For example, suppose you open GNU Emacs Reference Card (PDF).

Then, for bytes outside the ASCII printable range (32–126),

Emacs shows the "high" bytes (bytes with value 128 to 255) as octal escape sequences: 128 is shown as \200, 129 is shown as \201, …, 255 is shown as \377.
Emacs shows the bytes 0 to 31 (other than byte 9 which is shown as a tab not ^I, and byte 10 which is shown as a newline not ^J) as a caret followed by the character that is 64 ahead: byte 0 is shown as ^@, byte 1 is shown as ^A, …, byte 26 is shown as ^Z, byte 27 is shown as ^[, …, byte 31 is shown as ^_. Also, Emacs shows byte 127 as ^?.

I know that the reason Emacs shows octal is historical: at some point a few decades ago, octal was more commonly in use. (For example, man ascii starts with octal first, and TeX supports octal escape sequences.) But as octal is less useful than hexadecimal these days (e.g. to compare with the output of hexdump or Python byte-string representations), I'd like to see hexadecimal escape sequences. How can I change this?

(Note: the octal escape sequences are shown highlighted instead of looking like regular text, and of course it's not possible to step "into" the escape character (i.e. hitting C-f at the point before \343 takes you to the point after \343); I'd like to retain this.)


texts: visit new file; enter shell script text; without saving/reloading, fontify the buffer to sh-mode

texts:
The title of this question basically says all.

Visit a new buffer, let's say 'foo'.
Enter shell script text in the new buffer, let's say "#!/bin/sh".

How can I now set the mode to sh-mode and fontify the buffer accordingly, without the save buffer as foo, reload buffer sequence?


texts: How do I make javascript-mode not turn all 8 spaces into tabs?

texts: This is what javascript-mode generates with standard tabbing (I never hit the space key when making it). I'd like to have the files contain no tab characters. I can't seem to find any option in the Easy Customization mode.


texts: Emacs not covering entire terminal in fullscreen mode

texts:
I'm running emacs in my full screen gnome terminal (version 3.28.2) on Ubuntu 18.04.1 using emacs -nw but am struggling to get the frame to fit the entire screen. Here is a picture of my terminal, which as you can see fills the entire screen:

However when emacs is open you can see the terminal around the bottom and right-hand edges (see picture of my init.el file open in emacs below)

As you can see in my init.el file, I have tried to put (setq frame-resize-pixelwise t) as suggested in this thread: Emacs theme not covering up the entire terminal window. The Ubuntu purple terminal background is showing on the edges to no avail. I have also read this post: Emacs not taking full space inside terminal which I realise is essentially a duplicate (sorry) but hasn't, in my opinion, been adequately answered (the suggestion about theme fringes being a different colour seems wrong because it's clearly my terminal theme around the edges). Any help would be great.


texts: How to use use-package with built-in packages?

texts:
For the sake of tidiness, I'd like to group setq(s) under single, related banner.
Let's say I want to set the value of compilation-scroll-output in "compilation" unit like this:

(use-package compilation
  :init
  (progn
    (setq compilation-scroll-output t)))

All I get is:

Could not load compilation

How is it?


texts: How can I actually evaluate a #+CALL statement?

texts:
I have several named source blocks in an .org file. I can execute each of them by pressing C-c C-c when point is on (or in) them. Now I want to call them in a row. So I added some call statements:
#+CALL: named_function_1
#+CALL: named_function_2

How can I evaluate these call statements? C-c C-cdoes nothing.


texts: Regenerate ctags TAGS file without freezing Emacs for a while?

texts:
When I'm currently in a large project and I call the command
projectile-regenate-tags, the project will be scanned by ctags and the tags will be stored in the TAGS file.

While all this action is progressing, Emacs will be unreachable until the tags generation is completed.

I know there are some attempts to make Emacs process asynchronously, or even
doing it in the background. My knowledge of concurrency is somewhat limited, so

I'm wondering if there is any way that I could call projectile-regenerate-tags
and while the tags file being processed, I can do further other things with
Emacs and the text? If so, what would be a good way to make it so?


texts:
The pp package is great for pretty-printing Emacs Lisp forms, but can be excruciatingly slow for "large" forms.

Is there a general rule-of-thumb for determining whether we should pp a form or not? E.g. if a sequence contains more than X elements, pp would probably be unbearably slow?

I'm not sure what causes the poor performance of pp for "large" forms; that is, I'm not sure what a good definition of "large" is. Is it length? Depth? Some combination of both? What dominates pp time?


texts: Is it possible to prepend and append content to the body of html exports in org mode?

texts:
I have an org document foo.org:

#+TITLE: Page Title
#+AUTHOR: Me

Hello world!

When foo.org is exported to foo.html, the body is:

Page Title

Hello world!

Author: Me

Created: 2017-08-02 Wed 18:39

I want to prepend and append literal html code to the body of foo.html. Is this a feature in org-mode? It seems that something like

#+TITLE: Page Title
#+AUTHOR: Me
#+HTML_BODY_PREPEND: <prepended html code>
#+HTML_BODY_APPEND: <appended html code>

Hello world!

should be exported as

<prepended html code>

Page Title

Hello world!

Author: Me

Created: 2017-08-02 Wed 18:45

<appended html code>


texts: Some ligatures of the 'Devanagari Script' are not displayed correctly

texts:
I want to enter the following line in Devanagari script.

In Emacs, I set the input mode to "Devanagari Inscript" and typed it in.
And this is what is displayed:

The font in the above example is Noto Sans Devanagari.

Many Devanagari characters are ligatures, i.e., they are themselves made from two or more characters. Though some ligatures are displayed correctly many are not, as can be seen by comparing the attached images.

How do I fix this?


texts: How to replace multiple newlines for single one in whole file?

texts:
I have file which has multiple newlines. I want to receive single newline in their place.

I know how to do it in vim(found in google query):

:%s/\n\n\n*/\r\r/

How can I do the same in Emacs?

Example input:

this is file
with lines

and

empty lines

badly

Example output:

this is file
with lines

and

empty lines

badly


texts: Compile with Tramp hangs or fails when using Tramp with another command

texts:
I'm using Tramp with the scpx method to run the compile command on a remote machine.  The build takes several minutes to run.  If I try to work on something else while that runs that ends up trying to use Tramp, Emacs hangs and then the compilation buffer appears to abort the build.

For example, one time I started the compilation and then went to a dired buffer of the remote machine and tried to navigate, and that caused this to happen.

Another time, after starting the compilation, I tried to use ido-find-file on a remote path, and the compilation buffer failed.

I'm very new to Tramp and Emacs.  Should Tramp be able to handle multiple processes at the same time?  I wonder if I don't have something misconfigured.

Thank you!


texts: I am using emacs with auctex and chktex lint. How do I display a list of warning that chktex detects in my document? Or how do I go to the next warning?


texts: Make link using the target at point and ignore the ID or CUSTOM_ID

texts:
Following situation:
* Headline
:PROPERTIES:
:CUSTOM_ID: ignore_it
:END:
...
...
long text
...
...
<<this is the target>> ...
.....
some other long text

With org-store-link (C-c l) I get a link to the headline and not to the target in <<..>>. This is annoying if I have a long text between the CUSTOM_ID and the real target.
Any idea to solve this?

EDIT: According the documentation I shouldn't have the problem:
"For Org files, if there is a '<< target>>' at point, the link points to the target. Otherwise it points to the current headline, which is also the description."
I have the latest version. 9.4.


texts: Async Rsync Dired error on tramp file not found

texts:
I am trying to copy files from one directory on a remote computer to another directory on the same remote computer.

Using Dired I can open up the two directories, mark the files I want to copy and press C. This works but is very slow and holds up the computer.

So I found https://truongtx.me/tmtxt-dired-async.html however this only seems to work for copying files on my local computer. If I try and mark and copy a file on a remote computer I get :

rsync change dir "/sourcepath/file1" failed: No such file or directory (2)
rsync: change_dir#3 "/destpath/" failed:  No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(695) [Receiver=3.1.2]

The window only displays for a few seconds before disappearing.

How can I fix this?


texts: How to make Auctex TeX-command-Show do nothing?

texts:
When I use C-a to compile a source tex file, its final step is to call Evince to display the pdf (through xdg-open, I believe). However, in my computer this makes Emacs freeze for many seconds and finish with the following message:
LaTeX: successfully formatted {16} pages
error in process sentinel: dbus-call-method: D-Bus error: "Message recipient disconnected from message bus without replying"
error in process sentinel: D-Bus error: "Message recipient disconnected from message bus without replying"
Unable to load color "unspecified-fg"

I'd rather disable the call to Evince completely than bothering trying to fix this. And I don't want to abandon C-a in favor or C-c because then I'd have to type Return to compile.
How can I rebind TeX-command-Show to something that won't freeze Emacs?


texts: Is the term "site", as in "site-lisp", unique to Emacs?

texts:
I've inferred from the context in which it's used that "site" refers to a multi-user environment, as opposed to a particular user's section of that environment. But it's hard to find a formal explanation or origin for such a generic term.

Is it a holdover from an earlier time, unique to Emacs, or a widespread term that I was simply unaware of before diving into Emacs?


texts: call custom url schemes on mac from emacs

texts:
One of the nice things that MacOS allows one to do is to have applications with their own custom URL schemes. So, for example, the system automation tool hammerspoon defines its own url scheme to run lua code talking to system APIs.
Hence, one can define a url that will work from the command line, with, e.g., open -g hammerspoon://foo.
It would be nice to get that to work from Emacs as well.  And I guess one way would just be to shell out with shell-command---which I'm willing to do if need be.  But shouldn't one just be able to use emacs's built-in URL capacity to do it?
Unfortunately when I try to run the following elisp code inside emacs (with the lambda being just my effort at a vocal no-op, since url-retrieve won't let me pass a url without a callback), it fails:
(url-retrieve "hammerspoon://foo" (lambda (&rest args) (print "done")))
Instead of working like it does on the commandline, I get "Unknown URL scheme: hammerspoon."
So, I guess, emacs has a registry of recognized URL schemes different from the ones the OS knows?  Is there a way to get emacs to look up the OS schemes?


texts:
I am currently struggling to use skewer-mode in Emacs.

I downloaded and installed skewer-mode via MELPA, so all the dependencies should be inplace.

For testing purposes I even downloaded the boidsjs demo.

I'll open up boids.js, then type M-xrun-skewer (opens up the browser with URL http://127.0.0.1:8080/skewer/demo) and then finally run M-xskewer-mode (-> skewer-mode enabled).

But in the browser nothing happens.

What am I doing wrong?


texts:
Not infrequently, I want to change the delimiters of a string from single quotes to double quotes, or vice versa.  This is so annoying a process I wonder if there's an easier way.

What I do now is:

delete the opening or closing quote
type the replacement quote
electric-pair-mode helpfully inserts a matching copy of the new delimiter, which must also be deleted
navigate to the other delimiter somehow (I can't just jump over the string with C-M-f or C-M-b because the delimiters no longer match)
delete the other quote
type the replacement quote
delete the copy of the replacement quote inserted by electric-pair-mode

It's kind of a pain.  I could fashion some workaround in Elisp, but is there some easier and/or officially-blessed way to conveniently change quotes?


texts: Tramp to office pc timesout, but cli ssh ok

texts:
From the commandline, this works:

ssh office

However, C-x C-f /ssh:office: simply freezes and eventually times out. That C-x C-f syntax works fine for all the servers our sysadmin has configured, which makes me think that one of two things is the issue:

1) Something is conflicting with the fact that I use similar emacs configs in both places (remote office machine and the laptop I'm trying to access it with)

2) Tramp requires some different treatment (ports?) than does plain CLI ssh

I tried (setq tramp-verbose 10) but when I have the timeout, my tramp error buffer is empty. Any ideas?


texts: running on the same Linux desktop two different emacs (and their emacsclient)

texts:
I would like to run two different emacs on the same Linux desktop (Debian/Sid/x86-64) running some XFCE4 desktop.

The first is a latest emacs snapshot compiled from source code every morning (currently git commit 3973f68f590dabc6b7bed):

 % /usr/local/bin/emacs-trunk --version
 GNU Emacs 28.0.50

The second is the regular Debian emacs (package emacs-gtk, version 1:26.3+1-2) so :

% /usr/bin/emacs --version
GNU Emacs 26.3
Copyright (C) 2019 Free Software Foundation, Inc.

Actually, I want to have one background color on one emacs  for the Bismon project, and another background color on another emacs for the RefPerSys project (both being GPLv3+ for Linux). So I was thinking of starting both:

cd $HOME/bismon ; /usr/bin/emacs -bg ivory &
cd $HOME/refpersys ; /usr/local/bin/emacs-trunk -bg azure &

and using also /usr/bin/emacsclient for the first, and /usr/local/bin/emacsclient-trunk
and I want to share the same $HOME/.emacs configuration file between both. Of course both emacs and emacs-trunk are started from the same terminal and zsh shell process.

Is that easily possible?


texts: Restore privileged folder access for previously working Emacs.app on Catalina (NOT system upgrade)

texts:
This is similar to How to Restore File System Access in macOS Catalina but the problem is different. I did not upgrade my operating system, only the app, and none of the solutions there are valid fixes for this question.
I am having a problem with my Emacs.app on Mac OS X 10.15 Catalina. The distribution i am using is from the emacs-app-devel port from MacPorts.
I initially installed Emacs.app on Catalina. Everything worked as expected. When i tried to access privileged locations like ~/Documents, i received an OS popup asking for permission, granted, and was able to use the app normally.
I then upgraded my Emacs.app through macports. After the new install and relaunching, i could no longer access the files using the emacs find-file functionality (default C-x C-f). I can still access everything using File->Open. Opening a file in one of the protected directories like ~/Documents using File -> Open or ns-open-file-using-panel does NOT restore access and allow find-file to proceed. Permissions like "Files and Folders" "Network Volumes" are already granted and i can see them. Full Disk Access is not necessary to allow emacs to access these files in Catalina.


texts: Fix compilation mode paths when compiling in container or remotely

texts:
Recently the scenario of editing project source code locally but building the project remotely on another machine (for example inside a Docker container or an Amazon Web Services host) is becoming more common. The setup typically involves starting a build from Emacs that first uses rsync to copy over the project directory to a remote host and then execute the build command there.

A problem arises however when there is a build error and the reported remote source code file paths do not match the paths on the local host.  In this case Emacs' compilation mode is not able to automatically jump from the error to the local file (because it doesn't understand how to map the remote path to the local path). How can the Emacs compilation mode be configured to convert the remote paths to local paths?

Possibly the user would have to provide some basic remote path to local path mapping function. Or maybe some heuristic could be implemented which tries mapping only the part of the path relative to the project directory, which should be the same on the local and remote host.


texts: Move specified lines down with C-(N) C-n

texts:
I could move next 4 lines with C-u C-n,
Additionally, try to move next 6 lines with C-6 C-n, but it did only one line down in effect.

What's wrong with my usage?


texts: Having a hard time understanding some of Paul Graham's example code in his book “On Lisp”

texts:
https://sep.yimg.com/ty/cdn/paulgraham/onlisp.pdf On page 36 Paul introduces the following function:
(defun flatten (x)
  (labels ((rec (x acc)
                (cond ((null x) acc)
                      ((atom x) (cons x acc))
                      (t (rec (car x) (rec (cdr x) acc))))))
    (rec x nil)))

I'm trying to gain an intuition as to how he came to this implementation. I know that recursion is a big theme in Emacs Lisp (and Lisp in general), but trying to work through some of this code gives me a headache. Is there a strategy for studying code like this? Or does there need to be a paradigm shift in the way I'm reasoning about code such as this? Or an external resource that could give me a better intuition? Or, over time, will these idioms become more apparent to me (if this is in fact idiomatic Lisp)?
For example, given this input to function flatten:
(flatten '(1 (2 3 (4 5))))
This is the trace of the given output:
{ flatten args: ((1 (2 3 (4 5))))
:{ rec@cl-flet@381 args: ((1 (2 3 (4 5))) nil)
::{ rec@cl-flet@381 args: (((2 3 (4 5))) nil)
:::{ rec@cl-flet@381 args: (nil nil)
:::} rec@cl-flet@381 result: nil
:::{ rec@cl-flet@381 args: ((2 3 (4 5)) nil)
::::{ rec@cl-flet@381 args: ((3 (4 5)) nil)
:::::{ rec@cl-flet@381 args: (((4 5)) nil)
::::::{ rec@cl-flet@381 args: (nil nil)
::::::} rec@cl-flet@381 result: nil
::::::{ rec@cl-flet@381 args: ((4 5) nil)
:::::::{ rec@cl-flet@381 args: ((5) nil)
::::::::{ rec@cl-flet@381 args: (nil nil)
::::::::} rec@cl-flet@381 result: nil
::::::::{ rec@cl-flet@381 args: (5 nil)
::::::::} rec@cl-flet@381 result: (5)
:::::::} rec@cl-flet@381 result: (5)
:::::::{ rec@cl-flet@381 args: (4 (5))
:::::::} rec@cl-flet@381 result: (4 5)
::::::} rec@cl-flet@381 result: (4 5)
:::::} rec@cl-flet@381 result: (4 5)
:::::{ rec@cl-flet@381 args: (3 (4 5))
:::::} rec@cl-flet@381 result: (3 4 5)
::::} rec@cl-flet@381 result: (3 4 5)
::::{ rec@cl-flet@381 args: (2 (3 4 5))
::::} rec@cl-flet@381 result: (2 3 4 5)
:::} rec@cl-flet@381 result: (2 3 4 5)
::} rec@cl-flet@381 result: (2 3 4 5)
::{ rec@cl-flet@381 args: (1 (2 3 4 5))
::} rec@cl-flet@381 result: (1 2 3 4 5)
:} rec@cl-flet@381 result: (1 2 3 4 5)
} flatten result: (1 2 3 4 5)

What seems to be trivial input ends up becoming a web of recursive calls. So when you think about functions such as these, do you, in your head, reason from certain base-cases and proceed? Like, for example, would you consider the (nil) case first, then the (1) case, then (1 2), then (1 (2 3)) and so on? Or is that not necessary?


texts: What part of emacs displays parent folders at the top and how can I fix their symbols

texts:
I updated spacemacs and all layers/ packages today.
Since then, when in c++-mode at the top of my buffers the current file and its parent folders are displayed, as shown in the image.
I'm fine with the functionality but clearly there are some icons missing (as evidenced by the small squares containing "EsCC"). Where must I supply them?
This line seems to be a feature of c++ layer as it also displays c++ - specific info like class names and namespaces.
Here are all my layers, in case it helps:
 go
 systemd
 javascript
 rust
 html
 yaml
 vimscript
 csv
 markdown
 auto-completion
 (python :variables python-backend 'anaconda)
 octave
 better-defaults
 emacs-lisp
 helm
 (lsp :variables
      lsp-ui-doc-enable t
      lsp-ui-sideline-enable t)
 (c-c++ :variables
    c-c++-backend 'lsp-clangd
  c-c++-lsp-cache-dir ".cache"
  c-c++-enable-clang-support t
  clang-format-style "file")
  (cmake :variables
        cmake-backend 'lsp
        cmake-enable-cmake-ide-support t)

 multiple-cursors
 spell-checking
 syntax-checking
 latex
 julia
 restructuredtext
 json


texts: Defining function that takes funciton as argument results in "Wrong type argument: commandp, (bm-my bm-next)"

texts:
When using the below and invoking the function via <leader>Bn I get an error of command-execute: Wrong type argument: commandp, (bm-my bm-next)

(defun bm-my (a)
  (interactive)
  (a)
  (bm-show-all)
  )

(spacemacs/set-leader-keys "Bn" '(bm-my bm-next))

What is the cause of the error? Essentially I'm trying to define a function that takes a function to be run, and then runs bm-show-all after it.

This mentions the function must be interactive (which mine is?)
https://stackoverflow.com/questions/1250846/wrong-type-argument-commandp-error-when-binding-a-lambda-to-a-key

I've tried:

(defun bm-my (a)
  (interactive)
  (a)
  (bm-show-all)
  )

(spacemacs/set-leader-keys "Bn" (bm-my 'bm-next))

But that errors in the below when evaluating (with eval-buffer):

helm-M-x: Symbol’s function definition is void: a


texts: Potential bug in geiser installation when using it with guile

texts:
I'm using Emacs 26.0.50.1 on macOS Sierra 10.12.3. I built it from source.

I recently installed Guile 2.2.0 by also building it from source. I can successfully interact with it from the command line with no problem. The sample file I am working with taken from the Guile manual and is as follows:

(define (make-serial-number-generator)
  (let ((current-serial-number 0))
    (lambda ()
      (set! current-serial-number (+ current-serial-number 1))
      current-serial-number)))

(define entry-sn-generator (make-serial-number-generator))

Then, I installed Geiser 0.9 from melpa-stable. After trying to go through the Geiser manual, I get stuck pretty quickly. In particular, when I attempt any of the following commands...

M-x run-geiser <ret> guile <ret>
M-x run-guile
M-x geiser-mode

...I get the following error:

apply: Invalid function: (lambda (&rest) geiser-guile-case-sensitive-p)

I can't see how to work around this problem and I don't know enough to be able to dig deeper. Everything is the stock setup, so I'm a little baffled that there is no mention of this elsewhere.

Can anybody provide me with any suggestions?


texts: Display only not-DONE-yet items in agenda

texts:
I have several agenda commands set up, one of which gives me a block agenda, others give me specific searches.

Since many of my TODOs are hanging around inside of projects, where I only archive the project when the whole thing is done, my system always has a bunch of DONE items hanging around.  So many of my searches result in screens that are 60-80% DONE items, with some TODOs scattered among them.

What I want to do, is to filter it out so I only see non-DONE items in these searches.

I've done web searches and read the manual and tutorials and used C-h, all in vain.

What I did manage to figure out is that the answer is probably in the settings field in org-agenda-custom-commands... but I seem to be unable to find documentation about that, that is good enough to help me figure it out.

Please will someone point me in the right direction here.

How do I make org-agenda-custom-commands show me only non-DONE items?

My current setup for that variable is as follows:

(setq org-agenda-custom-commands
  (quote
   (("d" "Daily Planning Agenda + Next Actions"
 ((agenda ""
      ((org-agenda-span
        (quote day))))
  (tags "URGENT" nil "mygtd.org")
  (todo "WAITING" nil)
  (todo "STARTED" nil)
  (todo "TODO" nil))
 nil)
("h" tags "@home")
("w" tags "@work" nil)
("o" tags "@onlinebanking" nil)
("e" tags "@errands" nil)
("f" . "Agendas with individuals and groups")
("fh" "H..." tags "AGENDA=\"H... W...\"" nil)
("fH" "H..." tags "AGENDA=\"H... B...\"" nil)
("fl" "L..." tags "AGENDA=\"L... M...\"" nil)
("fp" "P..." tags "AGENDA=\"P... S...\"" nil)
("fm" "M..." tags "AGENDA=\"M... M...\"" nil)
("fr" "R..." tags "AGENDA=\"R... B...\"" nil)
("fM" "M..." tags "AGENDA=\"M... P...\"" nil))))


texts: use-package ensure not working: package downloaded but gives warning and skips config

texts:
I have the following code in my init.el file:

(use-package org-plus-contrib
  :ensure t
  :config (progn (require 'ox-extra)
          (ox-extras-activate '(ignore-headlines))))

The :ensure t supposedly installs the package if it is not already installed. Without it, I would get a warning message telling me the package cannot be loaded.

However, even with :ensure t I still get the warning: Error (use-package): Cannot load org-plus-contrib.
This also occurs with other packages (spacemacs-theme, matlab-mode).
But it does properly work for many other packages (org, all-the-icons,doom-themes,neotree, exec-path-from-shell).

Question: Why is this happening and how I can fix it?

Thanks for the help! :D


texts: Suppress "Ignoring " messages on emacs startup

texts:
When I start emacs, I get a bunch of messages
Ignoring charlock_holmes-0.7.7 because its extensions are not built.  Try: gem pristine charlock_holmes --version 0.7.7
Ignoring escape_utils-1.2.1 because its extensions are not built.  Try: gem pristine escape_utils --version 1.2.1
Ignoring eventmachine-1.2.7 because its extensions are not built.  Try: gem pristine eventmachine --version 1.2.7
Ignoring executable-hooks-1.6.1 because its extensions are not built.  Try: gem pristine executable-hooks --version 1.6.1
Ignoring ffi-1.15.0 because its extensions are not built.  Try: gem pristine ffi --version 1.15.0
Ignoring ffi-1.14.2 because its extensions are not built.  Try: gem pristine ffi --version 1.14.2
Ignoring ffi-1.9.18 because its extensions are not built.  Try: gem pristine ffi --version 1.9.18
Ignoring gem-wrappers-1.4.0 because its extensions are not built.  Try: gem pristine gem-wrappers --version 1.4.0
Ignoring github-linguist-7.13.0 because its extensions are not built.  Try: gem pristine github-linguist --version 7.13.0
Ignoring http_parser.rb-0.6.0 because its extensions are not built.  Try: gem pristine http_parser.rb --version 0.6.0
Ignoring nokogiri-1.8.0 because its extensions are not built.  Try: gem pristine nokogiri --version 1.8.0
Ignoring nokogumbo-2.0.5 because its extensions are not built.  Try: gem pristine nokogumbo --version 2.0.5
Ignoring nokogumbo-2.0.4 because its extensions are not built.  Try: gem pristine nokogumbo --version 2.0.4
Ignoring racc-1.5.2 because its extensions are not built.  Try: gem pristine racc --version 1.5.2
Ignoring rugged-1.1.0 because its extensions are not built.  Try: gem pristine rugged --version 1.1.0
Ignoring sassc-2.4.0 because its extensions are not built.  Try: gem pristine sassc --version 2.4.0
2021-04-21 00:29:41.421 Emacs-x86_64-10_14[68954:1066860] Failed to initialize color list unarchiver: Error Domain=NSCocoaErrorDomain Code=4864 "*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: non-keyed archive cannot be decoded by NSKeyedUnarchiver" UserInfo={NSDebugDescription=*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: non-keyed archive cannot be decoded by NSKeyedUnarchiver}

How do I suppress these messages?  I have tried doing what they ask (i.e., running gem pristine charlock_holmes --version 0.7.7), but nothing changes.
Of course, fixing them instead of suppressing them would be good, but I'm not sure that's an Emacs issue.


texts: How to direct `M-:`'s value to the current buffer?

texts: According to the Emacs manual, M-: evaluates an Emacs Lisp expression and prints the value in the echo area. How can I direct the value to the current buffer instead?


texts: Search and replace two consecutive newlines

texts:
Running spacemacs 0.200.

I am sorry if it is too basic. But I am just not able to get this.

How do I convert two consecutive newlines with some text, say, 'there were two newlines here'?

I could see the notation for special character classes like [[:alnum:]], etc. But no clue about newlines.


texts: Hide symlink destination in ls-lisp output?

texts:
By default Emacs' ls-lisp shows the symlink destination in its output like this:

/tmp:
total used in directory 2 available 12933091
lrwxr-xr-x  40 02-07 16:12 foo -> bar
-rw-r--r--   0 03-06 14:45 bar

Is there any way to make ls-lisp not show the symlink destination (the "-> bar" part)?

The reason for asking this is that the symlink destination can in some cases be very long and cause a linebreak, which looks ugly in dired.


texts: Flymake stopped working with elpy...no idea what I did or didn't do [Windows]

texts:
I installed elpy, along with jedi, rope and got it to work briefly yesterday after uninstalling python and reinstalling it with anaconda and setting the environment variable to path. I tinkered around yesterday both with the emacs config files and trying to setup virtualenvs.
Here is my elpy config:
Elpy Configuration

Emacs.............: 26.3
Elpy..............: 1.34.0
Virtualenv........: env (c:/Users/Robby Parliament/python-virtual-environments/env/)
Interactive Python: python 38 (c:/Users/Robby Parliament/python-virtual-environments/env/Scripts/python.exe)
RPC virtualenv....: rpc-venv (c:/Users/Robby Parliament/.emacs.d/elpy/rpc-venv)
 Python...........: c:/ProgramData/Anaconda3/pythonw.exe 3.8.3 (c:/ProgramData/Anaconda3/pythonw.exe)
 Jedi.............: 0.17.1
 Rope.............: 0.17.0
 Autopep8.........: 1.5.3
 Yapf.............: 0.30.0
 Black............: Not found
Syntax checker....: flake8.exe (c:/ProgramData/Anaconda3/Scripts/flake8.exe)

Warnings

Elpy could not connect to Pypi (or at least not quickly enough) and
check if the python packages were up-to-date. You can still try to
update all of them:

[Update python packages]

Pip doesn't seem to be installed in the dedicated virtualenv created
by Elpy (c:/Users/Robby Parliament/.emacs.d/elpy/rpc-venv). This may
prevent some features from working properly (completion,
documentation, reformatting, ...). You can try reinstalling the
virtualenv. If the problem persists, please report on Elpy's github
page.

[Reinstall RPC virtualenv]

The black package is not available. Commands using this will not work.

[Install black]

Options

`Raised' text indicates buttons; type RET or click mouse-1 on a button
to invoke its action.  Invoke [+] to expand a group, and [-] to
collapse an expanded group.  Invoke the [Group], [Face], and [Option]
buttons below to edit that item in another window.

I get two errors when I try to do a syntax check on my test.py sieve algorithm (below):
1. MAX_PRIME = 100
2. sieve = [True] * MAX_PRIME
3. for i as range(2, MAX_PRIME):
4.   if sieve[i]:
5.        print(i)
6.            for j in range(i * i, MAX_PRIME, i):
7.                sieve[j] = False

The third line should be highlighted under as seeing as it's incorrect syntax. It picked up yesterday but not anymore. The two errors are as follows:
Warning [flymake test.py]: Disabling backend python-flymake because
(file-error Spawning child process Exec format error)
Warning [flymake test.py]: Disabling backend flymake-proc-legacy-flymake because
(error Can’t find a suitable init function)


texts: Is there a way to get the output of git status --ignored in a Magit buffer? Preferably in a way that would make opening ignored files easy.


texts:
I am trying to run an ipython interpreter remotely (with Emacs 24.5 and native python.el), but I'm not sure I have the right approach: whenever I try to run such a command for instance (which gets triggered with C-c C-c):

Run Python: /ssh:<server_name>:/usr/local/bin/ipython -i

(with <server_name> a valid entry in my ~/.ssh/config, and ipython available at that remote location), I get an error like:

Warning (emacs): Python shell prompts cannot be detected.
If your emacs session hangs when starting python shells
recover with `keyboard-quit' and then try fixing the
interactive flag for your interpreter by adjusting the
`python-shell-interpreter-interactive-arg' or add regexps
matching shell prompts in the directory-local friendly vars:
  + `python-shell-prompt-regexp'
  + `python-shell-prompt-block-regexp'
  + `python-shell-prompt-output-regexp'
Or alternatively in:
  + `python-shell-prompt-input-regexps'
  + `python-shell-prompt-output-regexps'

as well as:

env: /ssh:<server_name>:/usr/local/bin/ipython: No such file or directory

in a *Python* buffer.. Is this making use of tramp, and is python.el able to run remote interpreters in such a way?


texts: Automatically activating python virtual environments with pyvenv

texts:
I am using pyvenv with doom and am trying to have my python virtual environments automatically loaded when I enter a certain project.
I saw this relevant issue on pyvenv and have added the following code to my config.el
;; autoload python virtual environments
;; https://github.com/jorgenschaefer/pyvenv/issues/51#issuecomment-474785730
(defun pyvenv-autoload ()
  "Activates pyvenv version if .venv directory exists."
  (f-traverse-upwards
   (lambda (path)
     (let ((venv-path (f-expand ".venv" path)))
       (if (f-exists? venv-path)
           (progn
             (pyvenv-workon venv-path))
         t)))))
(add-hook 'python-mode-hook 'pyvenv-autoload)

I expect that whenever I enter a python file inside a project with a .venv directory, it would automatically activate the appropriate virtual environment. However, running M-x shell-command RET which python returns /usr/bin/python when I would expect it to return something like /home/jacob/src/beets/.venv/bin/python
Some debugging:
python-mode-hook's value is
(er/add-python-mode-expansions
 doom--setq-tab-width-for-python-mode-h
 +python-use-correct-flycheck-executables-h
 evil-collection-python-set-evil-shift-width
 doom-modeline-env-setup-python
 pyvenv-autoload
 pipenv-mode)

Which looks good to me.
However,
pyvenv-workon's value is nil which could be the issue.
Activating and deactivating the virtual environment through pyvenv-activate and pyvenv-deactivate works as normal. If I use this method, which python returns the expected /home/jacob/src/beets/.venv/bin/python


texts: How can I stop the confirmation to evaluate source code when exporting to html?

texts:
I have an org document that contains a lot of source code snippets in it. I want the results of the code to be exported when exporting to Html. On export Emacs asks me if I want to evaluate the code block on my system once for every bit of source code. This is a lot of questions.

Is there any way to stop Emacs for asking for confirmation every time?

The exact message is

  "Evaluate this goban code block on your system? (y or n)"

Note goban is the babel language I am exporting. (It is actually an image of a go board).


texts: Expand org-mode subtree with point after ellipsis?

texts:
I love org-mode, but one of the things that has always bugged me is that, if the point is after a collapsed subtree's ellipsis, pressing TAB doesn't expand it.  For example, if the point is here (represented by |):

* Grandiose Plans
** Save the world...|
** Colonize Mars...

...and I press TAB, nothing happens.  Instead, I have to put the point here:

* Grandiose Plans
** Save the world|...
** Colonize Mars...

...and then I can expand the subtree.

Note that using C-e to move the cursor to the end of a heading doesn't fix this behavior, it just works around it.  For example, look at this tree:

* Long level one heading foo bar baz fizz buzz|...
** Shorter level two heading...

The point is at the end of the first heading.  If I press the down arrow or C-n to move down a line, the point will be here:

* Long level one heading foo bar baz fizz buzz...
** Shorter level two heading...|

...and pressing TAB will not expand the second-level heading.

The idea is to fix TAB so that it will expand the heading anyway.  That way, instead of having to do C-n C-e TAB, one can just do C-n TAB.

I haven't been able to find out anything about fixing this behavior.  Am I missing something, or does some code need to be written?  Thanks.