texts: Using `emacsclient` for `$VISUAL` raises `End of file during parsing`

texts:
I want to use emacs as VISUAL with server-mode.  As a test, I write the following in a terminal:
emacsclient -F "((left . 0) (top . 0))" -c -n file

This behaves exactly as expected; it opens my file file in GUI window with the right geometry, exactly the behaviour I want from $VISUAL filename.  So I add the following line to the end of my .bashrc:
export VISUAL='emacsclient -F "((left . 0) (top . 0))" -c -n file'

Now I test this from a terminal:
$ source .bashrc
$ $VISUAL file
*ERROR*: End of file during parsing

I recognize that as an error thrown by emacs when it evaluates elisp with mismatched delimiters.  I thought at first that I might be doing something wrong with single and double quotes, but this doesn't explain the error; emacs is starting, but somewhere it's running into some problem with a mismatched delimiter.
Question: (1) Why is emacs throwing an error when called from $VISUAL like this, despite the fact that the command itself works correctly?  (2) How do I fix it?
P.S. I'm on GNU Emacs 26.3 and GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu); thanks in advance for your help.


texts: importmagic.el isn't respecting configuration style

texts:
I am following the instructions here for how to customize importmagic.
I have the following in my init.el:
(setq importmagic-configuration-style-alist '((multiline . backslash)
                                              (max_columns . 1000)))

And the following in my setup.cfg
[importmagic]
multiline = 'backslash'
max_columns = 1000
indent_with_tabs = 0

And yet I call importmagic-fix-symbol-at-point, I see it use parentheses instead of backslash and it does it at 79 spaces.
(This is especially troublesome because it seems to often introduce a syntax error when it does it---leaving a trailing comma at the end with
from my.very.long.string.of.package.imports.and.myimport import (,  # I fail because of this terminal comma
  whatever, another
)

This means that every time I use importmagic to fix one import, I need to undo all the syntax errors it introduces in all my other imports.  So I'm trying to just set the max_columns so high it doesn't try.
)
Anyway, what is the right syntax to actually change these settings in which file?  Is my setq syntax incorrect somehow?


texts:
Given ~/foo/bar, I can get /home/sds/foo/bar using expand-file-name.

However, given /Users/sds/foo/bar, how do I get ~/foo/bar?

Use case: I want to copy a file between computers and they have different physical paths to my home directory.


texts:
I tried to use

  :for num in [1-30]

today in my spacemacs evil mode. But it says
Unknown command for

Are :for and such command an extension to Vi that is not available for Spacemacs Evil?


texts:
I byte-compile my ~/.emacs.d/init.el. It was done by Emacs 26.1 from Cygwin and I got error when load emacs-nox 25.2 from Debian WSL:

error: Invalid byte opcode: op=183, ptr=2

Were new opcodes introduced into Emacs byte code starting from v26? For what purpose?

I have no issues to load byte compiled files between v22-v25...


texts:
I'm trying to create an emmet-like minor mode that will trigger on SPC (or TAB) if the previous text is expandable, but I don't want to completely override bindings that already exist for the key.

How can I 'layer' my functionality over existing configuration?

(if (should-activate-p)
    (do-the-cool-thing)
  (business-as-usual))


texts:
In ESS mode with hs-minor-mode on, I want to collapse only those comments which directly belong to a function, not other comments which are separated by newlines.  Take this example:

##############
## Section foo
##############

#' This does foobar
#' Returns nothing.
foobar <- function(x) message("hello")

What I would like the comments to fold into is:

##############
## Section foo
##############

#' This does foobar...
foobar <- function(x) message("hello")

And what I get so far is just:

##############...
foobar <- function(x) message("hello")

Now, is there a way to fold just some "connected" comment sections and keep others unfolded?


texts: Does `@` in a tag have a special meaning?

texts: I see that the only allowed characters in tags are letters, numbers, _, and @. While _ apparently serves to visually separate words, why is @ included? Does it have any special meaning, or a typical use case?


texts: Can't send mail from Gnus, but message works?

texts:
I can send mail with message, via C-x m. However, when I try to send a message from Gnus, via m in the summary buffer, or other commands like S r, F etc, the message shows up in my sent folder in Gnus, but doesn't actually get sent. i.e., everything appears to work as expected from Gnus, no errors are generated, but the recipient doesn't get the email.

Do I need to do something specific to configure Gnus to send mail? I have the following config which appears to be sufficient for message:

(setq gnus-select-method
      '(nnimap "<my-mail-server>")
       send-mail-function 'smtpmail-send-it
       smtpmail-smtp-server  "<my-mail-server>"
       smtpmail-stream-type  'ssl
       smtpmail-smtp-service 465)


texts:
I wonder if anyone has gotten BBDB to work with notmuch. I'm looking for the behaviour I had with gnus, where I would type a name from BBDB, press tab and be presented with options to choose from.

The Notmuch 'emacstips' page is frustratingly brief...

  bbdb is a contact database for emacs that works quite nicely together
  with message mode, including address autocompletion.

...and doesn't say actually how to integrate bbdb into notmuch.

I have tried to customize the notmuch-address-command with the value bbdb but this raises the error

  Searching for program: No such file or directory, bbdb

I have the following relevant lines in my init.el

(require 'bbdb)
(bbdb-initialize 'message)
(bbdb-insinuate-message)
(setq bbdb-complete-mail-allow-cycling t)

My Emacs is GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.8) of 2019-04-12


texts: keybinding to yank word/char under cursor into minibuffer?

texts:
Does Emacs have a keybinding to yank the word/character under point into the minibuffer? I know isearch has "C-w" (isearch-yank-word-or-char) and "C-M-y" (isearch-yank-char). I often wish I could use something similar in other uses of the minibuffer.

A common use-case is when I'm reading some elisp and see a variable whose value I've set in my init file, but can't remember what I set it to. I'll run eval-expression and type in its name. But if the cursor is on that variable, I'd like to run eval-expression and hit some key to yank it into the minibuffer.


texts: Why correct regexp not work in query-replace-regexp?

texts:
I want to add 400 in every line where has text "finished".

Here text and regexp:

as you can see the regexp is correct

"finished":\s-*[0-9]+

Nice.

Now I use this regexp in query-replace-regexp

replace by

\1\,(+ 400 (string-to-number \2))

But the result is error:

replace-eval-replacement: Error evaluating replacement expression: (wrong-type-argument stringp nil)


texts: tabbar: optimizing sorting of tabs in alphabetical order

texts:
I alphabetize my tabs when using the tabbar.el library https://marmalade-repo.org/packages/tabbar.  As you may already know, sorting is costly.  I have a feeling that this sorting is even more costly when I have several frames open and buffers displayed in each frame.  I would like to optimize this using a tried and true concept where a previous value is stored to a variable and recalculation using sort is only done when something has changed; e.g., a buffer added/deleted from the buffer-list.  However, I'm not sure how to implement that familiar tried and true concept in this particular context -- especially since figuring out whether a buffer has been added or deleted could also be costly.  How can this optimization be achieved?

  ;; redefine tabbar-add-tab so that it alphabetizes / sorts the tabs
(defun tabbar-add-tab (tabset object &optional append)
  "Add to TABSET a tab with value OBJECT if there isn't one there yet.
If the tab is added, it is added at the beginning of the tab list,
unless the optional argument APPEND is non-nil, in which case it is
added at the end."
  (let ((tabs (tabbar-tabs tabset)))
    (if (tabbar-get-tab object tabset)
        tabs
      (let* (
          (tab (tabbar-make-tab object tabset))
          (tentative-new-tabset
            (if append
              (append tabs (list tab))
              (cons tab tabs)))
          (new-tabset
            (sort
               tentative-new-tabset
               #'(lambda (e1 e2)
                  (string-lessp
                    (format "%s" (car e1)) (format "%s" (car e2)))))))
        (tabbar-set-template tabset nil)
        (set tabset new-tabset)))))

In the event that it makes a difference to the above question, I am organizing and adding/removing tabs dynamically using a concept implemented by Alp Aker in the frame-bufs library -- i.e., the frame-local value for associated buffers are stored in the frame-parameters of each frame.  The code that I use to achieve this frame-local buffer association with the tabbar.el library is contained in the following linked answer:  https://emacs.stackexchange.com/a/10112/2287


texts: How can I change where the customize puts custom-set-variables

texts:
Basically I would like to have (custom-set-variables ...) in a seperate file and for me to load that file.

This is just for the purpose of organisation of my init file.

How can I change the default location of custom-set-variables?


texts: How to get Emacs to use the Mac system-level spell correction capabilities?

texts:
Mac OSX has autocorrect for spelling that:

Doesn't require pressing any buttons to make a retroactive change.
Doesn't require manually inputting these corrections/abbrevs.

I want to get this same autocorrection in Emacs.  I know there is already another thread on autocorrection, but here's the twist that makes this question different.  TextEdit does not actually do autocorrection itself: that part is done at the Mac OSX system level.  How can I get Emacs to use the OSX spell correction facility?


texts: How can I eliminate the 200ms delay before text is redrawn in table-mode?


texts:
In my current Emacs configuration, when ECB is active and I find-file in a non-existing directory, I keep getting interrupted to answer the following question in the echo-area:

File /tmp/new-foo/bar.txt is read-only on disk.  Make buffer read-only, too? (y or n) n

I would like to keep Emacs from interrupting me to type y/n whenever I open a new buffer. Sadly I can't find the ECB option that controls this.

What is the customisation option that controls this annoying behaviour?


texts: How to change caption size in org-mode export to HTML

texts:
Say I have the following figure:

#+ATTR_HTML: :title This Figure
#+ATTR_HTML: :width 50%
#+CAPTION: blah blah blah.
[[./figure.png]]

The resulting caption in the .html (generated from org-html-export-to-html) file looks like this:

Figure 1: blah blah blah.

How can I make the caption smaller? I tried to enclose the caption text in
blah blah blah
 but that prints what I typed literally.

Font tags are no longer supported in HTML5 so not sure what else to try here.


texts: How to copy commit hash from Magit status buffer?

texts:
After I open a Magit status buffer and make a commit, I commonly also want to copy that commit's hash (the shortened version) to my clipboard to post somewhere else.
I can't work out how this should be done, and the Magit documentation doesn't seem to describe this feature. This makes me suspect there's a general way one should do this on these sorts of buffers that I don't yet know about.
I am using Doom Emacs, so I get to the Magit buffer via SPC g g.


texts:
From Org Agenda view, I can do several things like reschedule, reprioritize, tag, etc.

How do I edit the headline itself from the org agenda view? Or it can not be done?


texts: How do I make multiple buffers use a single sql connection?

texts:
I am using sql mode. Is there a way to connect multiple buffers to a single sql connection? When I try to connect an existing buffer to a database, it always creates a new connection instead of reusing the existing one.

Appreciate the help.


texts:
So, I have this function, which works just fine for me and does what I want it to:

(defun mwp-set-grade ()
  (interactive)
  (save-excursion
    (while
        (re-search-forward "- Grade :: \\\(.*\\\)")
      (org-set-property "GRADE" (match-string 1))))
)

However, at some point it finds the last match, and then throws a message:

while: Search failed: "- Grade :: \\(.*\\)"

I figure there must be a way to exit gracefully while searching for something in a buffer.  I bet the answer will also help me understand a little more about dealing with errors and failures in elisp, whihc I don't understand well.

Thanks as always...


texts: How to pop up auto-correction box with keybinding using company-mode

texts:
I am using company-mode for auto-completion.

While I am typing a box with suggested words show up, later when I do a space and delete the space same box does not show up.

=> Then I do space and delete the white space, and nothing happens:

curr|
    ^ cursor location

Using M-/ completes it but does not pop up the box.

[Q] At this point is there any keybinding for company-mode to show up the auto-correction box again? In order to achieve it I delete the word and start re-writing which seems inefficient.


texts: "Symbol's value as a variable is void: defun" when reloading .emacs?

texts:
I am always editing my .emacs file, and I was just wondering if I could reload it without restarting Emacs?

Note: I have tried M-x load-file and choosing the .emacs file, but I get this error message:

Could faulty code be causing this?  Here is my code:

(set-background-color "#1E1E20")
(set-foreground-color "#D9CB9E")

(add-to-list 'load-path "~/.emacs.d/")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict")
(ac-config-default)

(defun defun ()
  "Insert defun function."
  (interactive)
  (insert "(defun name ()
  \"Insert description here.\"
)")
  (backward-char 35)
)

(defun hello ()
  "Just a gretting."
  (interactive)
  (message "Hello World!")
)


texts: Tabbar is refreshing groups like 14+ times at once (probably number of tabs) and causing severe slowness with the mods I made on it (lots of IO to sort tabs in mod time). What is the preferred way to debounce or throttle function calls in elisp?


texts: can not access melpa packages- hung up at Contacting host: elpa.gnu.org:80

texts:
I am trying to access the melpa packages but when typing:

package-refresh-contents

emacs gets hung up at: "Contacting host: elpa.gnu.org:80"

I am completely new to emacs and fairly new to Linux and I have been stuck on this for a few hours.

I found this question on stackoverflow below:

https://stackoverflow.com/questions/29085937/package-refresh-contents-hangs-at-contacting-host-elpa-gnu-org80

and added:

(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
             ("marmalade" . "http://marmalade-repo.org/packages/")
             ("melpa" . "http://melpa.org/packages/")))

but it did not help.

I also tried switching https to http but that did not help either.

Can someone please help? Any suggestions or references would be much appreciated. Below is a screen shot of my code.


texts:
As a background, vim modelines is a magic comment in the text file that sets some of the vim options. It is similar to emacs' file variables.

A modeline like ;; vim: set expandtab : in a lisp file enables the option expandtab which convert tab character to spaces.

Is there a package that does emulation of vim modelines for emacs?


texts:
So, i'm finally starting to work with a multi-file Project in C++ and am in need for smart navigation and completion! So far, i've used company-mode (with irony and company-headers), which is great if you're working with single files but if i have defined a class or method in some other file than the one i'm currently editing, i don't get completion or jump to definition and such.

I know about systems like rtags and helm but i feel a bit lost in setting those up!

Can somebody tell me, if i'm even on the right track with these two packages mentioned? If so, can someone guide me in setting such a package up?


texts: How can I preview LaTeX "#+BEGIN_EXPORT" blocks? Is it possible to accomplish this with "org-latex-preview"?

texts:
The context
When editing Org mode files, I like editing code snippets in isolated buffers because that way I can use snippets and language dependent features in those buffers (something which is not possible out of the box in an Org mode buffer).
Because of this, I've decided to enclose every LaTeX environment within a #+BEGIN_EXPORT block because that ensures that when executing org-edit-export-block within that code block, I will be able to edit that code block in an isolated buffer and have all those features that are available on those buffers with latex-mode as major mode.
The problem
The problem with this approach is that executing org-latex-preview (i.e. pressing C-c C-x C-l) does not show the preview #+BEGIN_EXPORT blocks as would occur with embedded LaTeX environments.
Here's a minimal working example. Let's assume we have the following Org mode file
* My heading

\begin{equation}
  x = \frac{10}{10}
\end{equation}

#+begin_export
\begin{equation}
  x = \frac{10}{10}
\end{equation}
#+end_export

Executing org-latex-preview within the equation environment which is outside the #+BEGIN_EXPORT block does show the preview, while executing org-latex-preview within the equation environment which is inside the #+BEGIN_EXPORT block does not show the preview of that equation environment but previews the other equation environment.
The question
How can I make org-latex-preview preview the content of #+BEGIN_EXPORT code blocks?
If that's not possible, then how can I preview a given #+BEGIN_EXPORT code block whose language is LaTeX without exiting the current buffer? This behavior must be similar to previewing LaTeX environments with the org-latex-preview function.


texts: How to see recently opened files in helm

texts:
What's the best way to get the recently opened files in helm. Without helm I just did C-c C-f and then arrow up to get the  last opened file. And with M-r I was  able to to a regexp search through recently opened files. Both doesn't work with helm anymore.

I have

(setq helm-ff-file-name-history-use-recentf t)

in my .emacs file, but it doesn't seem to have any effect.


texts:
At work, we have a policy which states that we have to use 4 spaces for indentation, and in my opinion it makes the code harder to read.

Is it possible to indent with 4 spaces, but display it as 2 spaces?


texts: How to set eshell's ls command to different program in different OS?

texts:
Since result of /usr/bin/ls is more neat compares with eshell/ls when filenames contain non-lattin Unicodes. I add an alias in ~/.emacs.d/eshell/alias, which makes eshell use /usr/bin/ls as default:
alias ls /usr/bin/ls $*.
But this can only apply to Linux/Unix system, how can I make eshell know when it's Windows use eshell/ls as default ls command?


texts: How can I replace outside of org-babel blocks?

texts:
I am using a command which affects the entire buffer, replacing all the ocurrences of a given expression

(goto-char (point-min)) (replace-string "foo" "bar")

Is it possible to apply a command like this only to the ocurrences outside an org-babel source block? That is, only the first foo on this example text should be replaced by bar, but not the second one:

* Test
testing foo

#+begin_src lisp
(setq foo 3)
#+end_src


texts: How to use text-properties in a lambda function

texts:
I wish to map the text properties onto a list and them insert them on a new buffer. For some reason the following snippet doesn't work. I've used the -map utility from dash.el package for the map.

    (-map
 (lambda (x) (insert (propertize "a"
                     'font-lock-face
                     '(:foreground x))))

 '("red" "green" "orange"))

I wish to achieve something like this


texts:
I notice that some of the evil around operators are greedy. As in they grab space around the surrounding delimiters. One such operator is the a".

Assuming that my cursor is | when I use va" the selection contains a whitespace around it. * denotes the beginning and end of the visual selection.

Adam said to Eve "Hello| World". ;; before
Adam said to Eve* "Hello World"*. ;; after
                 ^

I realize this was done to emulate vim precisely, however, I find that in my editing this is far less useful than just selecting the delimiters and everything in the delimiters. I'd like to change all of these surround operators to match only until their delimiters. For evil-a-quote for example, I'd like the output the be what's shown below:

Adam said to Eve *"Hello World"*.

Hoping this would be as simple as changing a parameter, I checkout evil-a-double-quote.

(evil-define-text-object evil-a-double-quote (count &optional beg end type)
  "Select a double-quoted expression."
  :extend-selection nil
  (evil-select-quote ?\" beg end type count t))

Unfortunately setting :extend-selection to nil did not disable the greedy selection.

In the documentation I read that evil-select-quote returns (beg end) where beg and end are locations.

Right now my best idea is to replace evil-select-quote sexp with something like this:

(let ((beg (save-excursion (re-search-backward "\"")))
      (end (save-excursion (re-search-forward "\""))))
  (if (and beg end)
      (list beg end)
    (error "No matching delimiters found")))

Another idea is to surround the output of evil-select-quote in a while loop which will shrink the boundaries of the range by 1 character as long as the at least one of the boundaries is a whitespace character.

Both of these ways are doable but they seem like they could be a bit of work considering that I want to make all operators non-greedy, not just evil-a-quote.

Does anyone have a suggestion on how to do this simply?


texts: OSX: Switching to virtual desktop doesn't focus Emacs

texts:
I have keyboard shortcuts set up to switch to virtual desktops with Ctrl-n. When I switch to a desktop, the "front-most" app in that window becomes focused. But not for Emacs.

Another, perhaps related, issue is that even though I have the When switching to an application, switch to a Space with open windows for the application option checked Mission Control preferences, when I Cmd-Tab to Emacs, the Emacs window is moved to the desktop I'm currently in. That's unexpected since when I Cmd-Tab to any other app, I'm switched to that desktop.

Any idea how to get Emacs to behave like normal applications?

Emacs version: GNU Emacs 25.1.1 (x86_64-apple-darwin15.4.0, Carbon Version 157 AppKit 1404.46) of 2016-10-24 (brew install emacs-mac)
OS version: 10.11.4 (15E65)


texts: How to define a function to be undoable with a single `C-x u`?

texts:
Consider this toy example:

(defun foo ()
  (interactive)

  (replace-string "a" "A" nil (region-beginning) (region-end) nil)
  (replace-string "r" "R" nil (region-beginning) (region-end) nil)
)

(global-set-key (kbd "C-c F") 'foo)

The function foo replaces all a's and r's with A's and R's, respectively.  If one wants to undo it, however, a single undo (C-x u) isn't be enough; two are required.

I'm looking for a way to define foo such that only one C-x u is enough to undo everything it does.

Since the code above is only an example, I'm looking for solutions that do not depend on the specifics of replace-string.  IOW, the solution should work for any foo of the form

(defun foo ()
  (interactive)

  ;;
  ;; body
  ;;
)


texts: How to align "end of line comments" in sh-mode?

texts:
I moved to column 60 of the first line and evaluated set-comment-column. Then I moved to the second column and called indent-for-comment, but it indents the comment randomly but not at column 60.

How to indent all "end of line comments" at column 60?


texts:
As you can see in the screen shot below:

Subdir appears twice under Subdir. All the submenu items are identical

It also happens to Operate, Mark, Regexp and Immediate too

Here are the screenshot of the status lines:

First frame

Second frame

Not sure if these modes triggered this behaviour or  not

How can I remove this behavior?


texts: Load elisp file only when file with specific extension is opened

texts:
I've been using SLIME mode with the quicklisp slime helper, and I load the package with the following code (in my .emacs):

(load (expand-file-name slime-helper-path))
(setq inferior-lisp-program "sbcl")
(require 'slime-autoloads)

However, I noticed that the load uses a lot of startup time. I'd like to only call that code when I open a lisp file (and not on startup), or when I call the slime function. How could I do that ?


texts: How can I easily download/save an attachment in mu4e?

texts:
The title says it all. When I press A with opened email, it
proposes the following options:

open with
open in emacs
import in diary
pipe (haven't tried that)

Is there something straightforward to just save an attachment on disk?


texts: next-line-add-newlines breaks history browsing by cursor arrow keys

texts:
I've always hated "end of buffer" errors, so my .emacs contains

(setq next-line-add-newlines t)

Recently, I've noticed that when browsing a history by cursor arrows (up/down for previous/next), e.g. when opening a file, the down arrow adds a line instead of showing the previous element in the history. M-p and M-n work correctly.

I there a way how to fix the behaivour in the way it was in older Emacs versions, i.e. ↓ adds new lines in a normal buffer, but browses the history in the mini-buffer?


texts: How to print escaped characters with princ

texts:
When Emacs shows an integer value in the minibuffer, or as an output to IELM, it shows three representations of it -- octal, hex and as character:
ELISP> 10
10 (#o12, #xa, ?\C-j)

This is really nice, and I'd like to use something like that in my programs. Now, while I can use format to show an integer as octal (with %o) or with hex (with %x), I don't know how to get the nice formatted character as the above. %c will actually print the character without escaping, and will, for example, print a line feed for 10.
I have tried the print-escape-* variables, without success:
ELISP> (let ((print-escape-newlines t)
             (print-escape-nonascii t)
             (print-escape-multibyte t)
             (print-escape-control-characters t))
             (concat "char: " (string 10)))
"char:
"
ELISP> (let ((print-escape-newlines t)
             (print-escape-nonascii t)
             (print-escape-multibyte t)
             (print-escape-control-characters t))
             (format "char: %s" (string 10)))
"char:
"
ELISP> (let ((print-escape-newlines t)
             (print-escape-nonascii t)
             (print-escape-multibyte t)
             (print-escape-control-characters t))
             (format "char: %s" 10))
"char: 10"
ELISP> (let ((print-escape-newlines t)
             (print-escape-nonascii t)
             (print-escape-multibyte t)
             (print-escape-control-characters t))
             (format "char: %c" 10))
"char:
"

What I want is to get a string with the escaped character, to later print with princ.
I've tried looking into the source for IELM and the minibuffer, but they seem to delegate printing to other parts of Emacs, and I couldn't find how it's done.
How can I get those printed the way I described?


texts: Is there a way to suppress errors in the *Messages* buffer?

texts:
I have a persistent problem with some jit-lock-function somewhere whenever I compile. I'm actually invoking the visual studio compiler, and I assume some of the output is somehow abhorrent to emacs. I updated to a newer version of emacs today because I found that there was an error in cc-fonts.el that would cause trouble, but even with that fix I still see this:

Error during redisplay: (jit-lock-function 80427) signaled (wrong-type-argument stringp nil)

It doesn't seem to be causing any trouble, and it's not worth any more of my time to fix it. Can I get the messages buffer to stop showing it to me?

Edit: It's worth noting that it's many variations on this message that are being displayed, so the function number (80427 in my example) changes on almost every line. That means I end up with hundreds of these messages filling up my messages buffer, pushing out any meaningful information.


texts: How to give my emacs access to ghostscript?

texts:
I strugle to give my emacs access to ghostscript (to make doc-view show me pdf previews), and seem lost in a
plethora of internet advises about how to install gs. Here is what I have done, and
it does not work yet:

I have installed ghostscript at

C:\Program Files (x86)\gs\gs9.09\bin\gswin32.exe

I have set the environmental PATH to

C:\Program Files (x86)\gs\gs9.09\bin
In my emacs init file I have the following code:

(add-to-list 'load-path "C:/Program Files (x86)/gs/gs9.09/bin/")

(add-to-list 'load-path "C:/Program Files (x86)/gs/gs9.09/lib/")

When I give the following shell command from emacs

 M-! gsview32

"gsview32" is not recognized as an internal or external command,
operable program or batch file.

What is lacking in my setup above (and what is not needed)?


texts: Convert between ISO week and a normal date

texts:
How can you convert between ISO year-week-day and an elisp date that can be sent to, e.g., format-time-string? I do not want to go via a string representation.

I found the following old question on stackoverflow:
https://stackoverflow.com/questions/20055504/iso-emacs-elisp-to-determines-dates-corresponding-to-first-last-days-of-a-week/, but haven't been able to find a published answer.


texts:
Currently I use:

(checkdoc)
(byte-compile-file (buffer-file-name))
(package-buffer-info)

to validate Elisp code. This takes me some stupid errors and it is easy to resolve them.

Code intending can be checked via C-x h C-M-\ C-x C-s M-x vc-diff if file under VCS.

What methods should I use to validate Elisp code for common errors?


texts:
No matter what I do, the *BBDB* buffer always pops up when I read an incoming mail message.

I've googled around and tried all tricks I saw. Nothing works.

This is my bbdb config:

(require 'bbdb)
(require 'bbdb-gnus)
(bbdb-initialize 'gnus 'message)
(add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)
(add-hook 'gnus-startup-hook 'bbdb-insinuate-message)
(add-hook 'message-setup-hook 'bbdb-mail-aliases)
(bbdb-mua-auto-update-init 'message 'gnus) ;; use 'gnus for incoming messages too
(setq
 bbdb-popup-target-lines 1
 bbdb-use-pop-up nil
 bbdb-mua-auto-update-p 'query ;; or 'create to create without asking
 bbdb-message-all-addresses t
 bbdb-offer-save 1 ;; guardar sin preguntar
 bbdb-complete-name-allow-cycling t
 bbdb-complete-name-full-completion t
 bbdb-completion-type 'primary-or-name
 bbdb-completion-display-record nil)
(add-hook 'bbdb-change-hook 'bbdb-save)

Any help would be highly appreciated.


texts: Is there a way to delete or clear a register?

texts:
For example, if I have too many registers and would like to get rid of some of them, is there a way to do that?

I realize that quitting the emacs session will clear all registers, but is there a way to do that within a session?


texts: I use ido-mode, but one thing I hate about it is that after C-x C-f I cannot use up/down keys to cycle through recently opened files, as it used to be for example with iswitchb. How can I set ido to work this way?


texts:
I've created a diary function to allow me to record cyclic events.
So something like (diary-limited-cyclic-weekday 8 '(0 3 6) 01 01 2018) will create an event for every Sunday, Wednesday, and Saturday since the start date. So in the example: the 3, 6, 7, 10, 13, 14, 17, and 20th of January 2018 should be marked with an event.

I put this function in an org file as:

* Blooop
<%%(diary-limited-cyclic-weekday 8 '(0 3 6) 01 01 2018)> 09:00-10:00

When I run it I get

Bad sexp at line 9 in /home/luis/Documents/org/agenda/schedule.org: (let ((entry ) (date (quote (1 1 2018)))) (diary-limited-cyclic-weekday 8 (quote (0 3 6)) 1 1 2018))

I get subsequent errors just like this except with the day in (quote (1 1 2018)) incremented by 1.
For example:

Bad sexp at line 9 ... (quote 1 2 2018)...
Bad sexp at line 9 ... (quote 1 3 2018)...
...

At first this made me think that perhaps my function was too slow and because of this taking too long to return a value for a single date.

I wrote this function trying to emulate the diary-limited-cyclic function I found online.

What could be the problem with my function? Note that even when I remove the potentially complicated (> recurrences ...) sexp at the end, and expect it to just return every Sun, Wed, Sat afterwards, I get the same error.

(defun diary-limited-cyclic-weekday (recurrences weekdays m d y)
  "For use in emacs diary. Cyclic item with a limited number of occurences.
WEEKDAYS is a list of the days of the week (0-6) in which event will repeat starting on
  YYYY-MM-DD, for a total of RECURRENCES occasions."
  (let* ((today-day (calendar-day-of-week date))
         (today (calendar-absolute-from-gregorian date))
         (start (calendar-absolute-from-gregorian (list m d y)))
         (start-day (calendar-day-of-week start))
         (day-range (- today start)))

    (and (not (cl-minusp day-range)) ; not less than start day
         (cl-member today-day weekdays) ; is one of the desired weekdays
         ;; number of target weekdays in full weeks
         ;; + number of target weekdays in remainder days
         (> recurrences (+ (* (cl-list-length weekdays) (cl-mod day-range 7))
                           (cl-loop
                            for day from start-day to (+ start-day (cl-rem day-range 7))
                            count (cl-member day weekdays)))))))

(defun diary-limited-cyclic (recurrences interval m d y)
  "For use in emacs diary. Cyclic item with limited number of recurrences.
Occurs every INTERVAL days, starting on YYYY-MM-DD, for a total of
RECURRENCES occasions."
  (let ((startdate (calendar-absolute-from-gregorian (list m d y)))
        (today (calendar-absolute-from-gregorian date)))
    (and (not (cl-minusp (- today startdate)))
         (zerop (% (- today startdate) interval))
         (< (floor (- today startdate) interval) recurrences))))


texts: I am considering implementing an ivy-powered bash_history greper for term-mode, but before I do I wanted to know if this has already been done, by some fancy company-bashhistory package or whatever. Something like a company-style dropdown for C-r in a terminal. Is this available already?


texts: What are these underlines shown for whitespace at the end of some lines?

texts:
The following screenshot shows Emacs 26.3 (GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14) of 2020-03-26, modified by Debian) editing a Markdown file:

Note that on some lines of the code block, some of the space characters at the end of lines are rendered as _. If I go to any of these locations and do a describe-char, they are reported as normal spaces:
character: SPC (displayed as SPC) (codepoint 32, #o40, #x20)

Looking at the file with a hex editor, I can confirm that these are normal 0x20 spaces just like all the other ones that don't show any artefacts.
These artefacts are stable across closing and reopening the file in Emacs. However, they are not shown in fundamental-mode, only markdown-mode.
What do they mean, do they mean anything or is it just a bug, and is there anything I can do to get rid of them?


texts: yas-new-snippet always duplicates the selected input. What might be causing it?

texts:
I've experienced this issue for some time. It's not a blocker but it is a bit annoying.
Steps to reproduce:
Select a region that you want to extract into YASnippet snippet("foo bar").
Eval yas-new-snippet.
You are redirected to a new buffer +new-snippet+ with the following content:
# -*- mode: snippet -*-
# name:
# key:
# --
// foo bar
// foo bar

Expected behavior:
# -*- mode: snippet -*-
# name:
# key:
# --
// foo bar

pkg-info-package-version yasnippet 20200604.246


texts: distinguish ido/ivy's virtual-buffers with equal names using directory?

texts: I really like the ido-use-virtual-buffers/ivy-use-virtual-buffers features, but unfortunately if you have five files named style.css in different projects, it is less useful. With already-opened buffers in ivy-switch-buffer, I see style.css|fooproject style.css|barproject, while for the stuff from recentf, I just see a single style.css with no distinguishing folder name. Is there a way to put distinguishers on the virtual buffers too?


texts:
If I have a heading with a tag :noexportoninclude: on a file to_be_included.org, and I include it on another file which has #+EXPORT_EXCLUDE_TAGS: noexportoninclude, the tagged heading will be exported anyway.

How can I have EXPORT_EXCLUDE_TAGS exclude tags from included files?


texts: Re-fill compilation-mode buffer from shell script

texts:
This might require more tricks than just Emacs-fu, but since Emacs is at the heart of it I hope to get some ideas on how to approach my need here.

I use Emacs/Make/gcc as my development environment. I have a script that watches my source files so that whenever a change is saved it rebuilds, run all tests and updates coverage (thanks cov-mode).

I'm normally running this in a separate terminal window so any compilation errors will show up there, when what I really want is for those errors to end up in a compilation-mode-type buffer in Emacs so I can go to next-error with one key-stroke.

Here are my attempts so far:

run script in a term-window - failed to get next-error to work
run script in a shell-window- same problem
run script and collect output in a file which is visited in a buffer - couldn't get that window to auto-update (can I?)

I also want to ensure that next-error is from the last "round", but since the buffer is not cleared on a ^L/clear-command you would have to step through all the errors unknowing when you are actually on a current one.

Update:

I have been exploring writing the output from the script into a file and then forcing my running Emacs to re-read it using auto-revert-mode while still keeping the *compilation*-like behaviour in that buffer. This works, but the problem is that next-error can't be reset to start from the new errors after reverting. Using C-u C-x ` just errors with "Moved past last error". Not even using the after-revert-hook to do (next-error 4 t) seems to do the trick.

How can I reset the next-error "pointer" in this scenario?

Or are there any other approaches I should try?


texts: Why do easy templates, .e.g, "< s TAB" in org 9.2 not work?

texts:
Easy templates in Org 9.2 are not working for me on GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30.

I have changed my elpa/ directory to smelpa/.  I load emacs -q and switch to the *scratch* buffer and toggle M-x org-mode.  A call to  org-version returns

Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ c:/Program Files/emacs-26.1-x86_64/share/emacs/26.1/lisp/org/)

When I type <s TAB, the easy template expands as expected.

<s|<-----<press TAB here>

#+BEGIN_SRC

#+END_SRC

Now, to upgrade to Org 9.2, I do list-packages and install org.  (For some reason package-install doesn't return org).  Returning to the *scratch* buffer, running org-version returns

Org mode version 9.2 (9.2-elpa @ c:/Users/%USERNAME%/.emacs.d/elpa/org-9.2/)

It seems like Org 9.2 installed correctly.  The same is true if I just directly install Org 9.2 and create a new org buffer (i.e. don't load the default org first).  Easy templates won't work in Org 9.2.

I looked around for a bug tracker, but I don't see anything on the official repo.

Did I install Org 9.2 correctly?
Is there perhaps some compiled file lingering somewhere from a bad install?
If this is a bug, how do I submit it?  With report-emacs-bug?

Update

To address the side questions:

Did I install Org 9.2 correctly?

Yes.  Installing org via list-packages will "override" the default version.  This can be seen by running org-version.  Note that it may be necessary to restart Emacs (or the Emacs server).

If this is a bug, how do I submit it? With report-emacs-bug?

According to the org-mode homepage (at the bottom), use M-x org-submit-bug-report.  Make sure you Ask Questions the Smart Way so as not to spam the developers!  This would include checking the release notes of the new version!


texts:
When I open a file with extension .plt, emacs behaves in a strange way. For example, I cannot type a space. I believe it has to do with something called the "PLT Package" because that name is displayed at the bottom of my window. However, no such package is listed in my .emacs file or in the list of packages accessible through emacs' menus.

I would simply like to remove/disable this package.

PS: In response to the suggestions so far, here is a screenshot that seems to indicate that "PLT Package" is related to a major mode.


texts: ctl-x-map key map has entries of different kind

texts:
when i run,

 (dolist (elt ctl-x-map)
             (print elt))

it prints,

#^[nil nil keymap
#^^[3 0 pop-global-mark nil list-buffers save-buffers-kill-terminal list-directory eval-last-sexp find-file nil nil indent-rigidly nil kmacro-keymap downcase-region (keymap (108 . set-language-environment) (99 . universal-coding-system-argument) (28 . set-input-method) (88 . set-next-selection-coding-system) (120 . set-selection-coding-system) (112 . set-buffer-process-coding-system) (107 . set-keyboard-coding-system) (116 . set-terminal-coding-system)
#^^[3 0 pop-global-mark nil list-buffers save-buffers-kill-terminal list-directory eval-last-sexp find-file nil nil indent-rigidly nil kmacro-keymap downcase-region (keymap (108 . set-language-environment) (99 . universal-coding-system-argument) (28 . set-input-method) (88 . set-next-selection-coding-system) (120 . set-selection-coding-system) (112 . set-buffer-process-coding-system) (107 . set-keyboard-coding-system) (116 . set-terminal-coding-system) (70 . set-file-name-coding-system) (114 . revert-buffer-with-coding-system) (102 . set-buffer-file-coding-system)) set-goal-column delete-blank-lines mark-page read-onl
(67108896 . pop-global-mark)

(C-left . previous-buffer)

(left . previous-buffer)

(C-right . next-buffer)

I expected Ctl-x-map to be a plain map with key sequence as key and function name as value (ex - (C-left . previous-buffer)). But the second & third entry that begins with #^^[ proves it to be wrong. Is ctl-x-map variable, some sort of map within a map ?


texts: Emacs terminal - the location before the command prompt

texts:
My emacs terminal is currently displaying ;0user@Ubuntu: ~user@Ubuntu:~$".
This happened after my friend was using my laptop, and is persisting after uninstalling and reinstalling emacs, as well as deleting .emacs related files. I have tested the terminal on emacs on different accounts on my laptop, and it is not suffering from this, so migrating my files is an option, but annoying. Does anyone have a way of fixing the terminal on emacs? I'm running Ubuntu as well.


texts:
The Mail application in macOS allows creation of rules, such as Sender X and keyword Y in subject -> mark as read and move to archive. I am looking for something similar in mu4e.

Smart refiling has a similar feature:

  you can select some messages in the headers view, then press r, and have them all marked for refiling to their particular folders.

What I'm looking for is that result without having to see the message or press r to refile it.

Does it exist?


texts: Is it possible to perform a search/isearch just in comment regions of the text?


texts: Why does this function (that uses save-excursion) leave me at another buffer

texts:
I'm trying to write a command that allows me to search for an org-mode entry and inserts a link to it at point (using its id). Here's the code:
  (defun org-link-to-entry ()
    (interactive)
    (let (link description)
      (save-excursion
        (setq link (org-id-complete-link))
        (org-id-goto (string-remove-prefix "id:" link))
        (setq description (org-get-heading t t t t)))
      (insert (format "[[%s][%s]]" link description))
      ))

As far as I understand it, the only form that changes point is org-id-goto, and that is inside a save-excursion. In my setup, the code actually inserts the link at the proper place, but leaves me at the start of the heading with the given id.
This question seems related, but no enough: Why save-excursion doesn't save point position?
I've also tried using save-current-buffer (as in https://emacs.stackexchange.com/a/17577/27223) both around save-excursion and the let binding, but both also leave me at the buffer where the entry with id is.
I'm on Spacemacs, if that's relevant.
Note that this is what I get when I pull-up the documentation for save-excursion:

save-excursion is a special form in ‘C source code’.
(save-excursion &rest BODY)
Probably introduced at or before Emacs version 20.
Save point, and current buffer; execute BODY; restore those things.
Executes BODY just like ‘progn’. The values of point and the current
buffer are restored even in case of abnormal exit (throw or error).
If you only want to save the current buffer but not point, then just
use ‘save-current-buffer’, or even ‘with-current-buffer’.
Before Emacs 25.1, ‘save-excursion’ used to save the mark state. To
save the mark state as well as point and the current buffer, use
‘save-mark-and-excursion’.

What am I doing wrong? How to make this function leave me at the point and buffer I was before calling it?


texts: Match data clobbered by buffer modification hooks

texts:
I want to setup a Journal entry template that prompts for a date/time, so that I can process current entries, as well as older ones.

This is what I have so far:

;;; Org-capture settings
(setq org-capture-templates
      '(("j" "Journal" entry (file+olp+datetree "~/org/journal.org")
         "* %U\n%?" :time-prompt t :empty-lines 1)))

;;; Set keyboard shortcut
(global-set-key (kbd "C-c c") 'org-capture)

The trouble is, when I run the capture template, any date I select that is earlier than what is already in the datetree produces the following error:

Any ideas?


texts:
After using a emacs for a while all I see is Garbage collecting...done in the modeline.  At this point emacs is constantly garbage collecting but can't free any memory and has to be restarted.  Emacs is sluggish in general on this machine, even after a fresh restart, as it's constantly garbage collecting so something is clearly wrong.

I've tried all builds I could think of for emacs.  I've installed 24.5 and 25.1 from brew.  I've tried the binaries same binaries from emacsforosx.com. Right now I'm running the version at https://github.com/railwaycat/mirror-emacs-mac, as a last try.

Everyone I've talked to is happily using emacs on a mac so it's clearly nothing wrong with emacs itself.  How can I find out which package / function is causing this nightmare?

I'm on a brand new macbook pro running the latest version of el capitan.


texts:
frame-list returns a list of references for live Emacs frames.  How does one get a reference for the current Emacs frame?  I have been unable to find an appropriate function.  Current could be either (1) the Emacs frame that has focus (one or zero references) or (2) the Emacs frame that last had focus.

I'm presently looking to use (1) under w32, but for didactic purposes I'm interested in both and whether there are any caveats for focus tracking in Emacs.


texts: Problems with keybindings when using terminal

texts:
I have the following line in init.el:

(global-set-key [(control \;)] 'comment-region)

It works very well in GUI window, but if emacs is invoked with the -nw option then C-; doesn't comment region, only inserts ; character. M-x comment-region RET works fine however.

I tried follow this answer on similar problem, but C-q C-; returns just ; and I obviously don't want to bind bare ;.

How to achieve desired effect?


texts: desktop-save doesn't save file names with emoji properly

texts:
desktop-save-in-desktop-dir doesn't save file names that include glyphs from upper unicode range like emoji characters properly. By "upper", I mean "greater" like one with a code point 1F604 instead of 0022.

For example, when I have a file that has the title like ".txt" opened in a frame and I run desktop-save, it saves its file name as " .txt" in the emacs-desktop file and when I desktop-read, it just opens a *scratch* buffer instead of the ".txt" file.

My copy is a desktop version. 24.5 (9.0) downloaded from GNU Emacs For Mac OS X

How can I get around this bug? I need to name certain files like this and not being able to use commands like desktop-save to save sessions would really slow down my workflow.


texts: Delete from point to beginning of the line

texts:
Have read the GNU manuals on erasing, killing, and deleting.

In bash C-u deletes from the cursor to the beginning. I have searched and in much disbelief can't find out what the equivalent is in emacs? Very often in a buffer and in the minibuffer I wish to delete from the cursor to the beginning of the line.


texts:
I'm using emacs 26.0.50.1 in my spanish laptop and keyboard. Emacs has binding to the ! key for examle

M-! => M-x shell-command

In a Spanish keyboard this is impossible (at least for me) to amke with one hand

So I write this to the init.el

(global-set-key (kbd "M-¡") 'shell-command)

now i use two hands also but it is better than M-shift-1.

In magit there are key binding to !-p, so how can I change ! (shift-1) to ¡, for my emacs globally but still can write !


texts: Configure x-export-frames to take svg screenshots (Mac/OSX)

texts:
Using this reddit post as inspiration, I am trying to create a screenshot-svg command using the following config:
(defun screenshot-svg ()
  "Save a screenshot of the current frame as an SVG image.
Saves to a temp file and puts the filename in the kill ring."
  (interactive)
  (let* ((filename (make-temp-file "Emacs" nil ".svg"))
         (data (x-export-frames nil 'svg)))
    (with-temp-file filename
      (insert data))
    (kill-new filename)
    (message filename)))

However, when I try to run the screenshot-svg command, I get the message let*: Symbol’s function definition is void: x-export-frames, and nothing seems to happen. How do I check if x-export-frames is available on my build? What do I need to do to get this working? Are there any other ways to get svg screenshots on emacs?
EDIT: I am using OSX, so I am also wondering if Cairo, or something similar is available for OSX?


texts: gnus "fancy" hyperlinks, bullet points, etc

texts:
Is there a way to get more formatting options from a gnus message buffer when composing a mail? I'd like to do hyperlinks of the style common in markdown or org-mode, viz:

[[example link][http://www.example.com]]
[example link](http://www.example.com)

Similarly, I'm wondering if there's a way to enable more "fancy" options such as bullet points, blockquotes, etc. I found org-gnus.el, but I'm too much of a newbie to understand what it does.

-Steven


texts:
I don't understand why all my music artist/genre/album etc. are classified under misc/unknown given the fact that I'm confident that 90% of 200G music do have metadata. I managed to get the source of emms-print-metadata and installed it, tested it on an mp3 and it does return a result. I have the following configuration. There is nothing special: I just followed the documentation and tweaked a bit to use mpv as default player.
(use-package emms
  :ensure t
  :requires (emms-setup emms-player-mpv)
  :config
  (emms-all)
  (setq emms-player-list '(emms-player-mpv)
    emms-browser-covers 'emms-browser-cache-thumbnail-async
    emms-source-file-default-directory "~/Music/"
    emms-info-functions '(emms-info-libtag)
    emms-player-mpv-parameters '("--really-quiet" "--no-video"))

  (when (executable-find "emms-print-metadata")
    (require 'emms-info-libtag)
    (add-to-list 'emms-info-functions 'emms-info-libtag)))

Question. How to let emms understand metadata and display them correctly in emms-browser-search-by-* buffers ?


texts: correct usage of package-upload-file for multi-file package?

texts:
At my work (Windows 7), we don't have access to elpa or melpa, but we have a network drive which contains emacs packages that have been manually downloaded and approved.

Using code similar to the following (heavily based on https://emacs.stackexchange.com/a/17408/5142) Emacs users are able to have a MELPA-like experience.

(require 'package)
(setq myelpa-msde "//network/fsf/emacs-plugins/"
      myelpa (expand-file-name "myelpa/" user-emacs-directory)
      package-archives `(("myelpa" . ,myelpa))
      use-package-always-ensure t)
(package-initialize)
(unless (file-exists-p myelpa)
  (require 'package-x)
  (setq package-archive-upload-base myelpa)
  (mkdir myelpa)
  (dolist (file (directory-files myelpa-msde 'fqn "\\.*[.]\\(el\\|tar\\)"))
    (message "Preparing %s" file)
    (package-upload-file file)
    (when (string= (file-name-extension file) "tar")
      (copy-file file myelpa 'force)))
  (package-refresh-contents)
  (package-install 'use-package))
(require 'use-package)

However, look at that again

    (when (string= (file-name-extension file) "tar")
      (copy-file file myelpa 'force)))

without this hack, any tar file that gets uploaded to the "myelpa" local repository is corrupt (it seems to be a file containing just the directory listing of the original tar). The package index is updated correctly, so I was able to apply this workaround by just force copying the tarball again.

Is this a bug in Emacs or am I doing it wrong? According to https://www.gnu.org/software/emacs/manual/html_node/elisp/Package-Archives.html I would have thought this would be considered a "multi file package" and just work.


texts: mu4e mime part is sent with multi account setup and german umlaute

texts:
I have a setup with three different accounts on macos, switching works e.g. with the context setup and I am able to send emails with each one of them.
An account is a ms exchange account which uses davmail, the other is a gmail account and the third a gmx.
Though only with the davmail account I am able to read the mails correctly in the macos mail.app.
When sending with the two other accounts I have a wrong display of german umlaute, e.g.
Gau=C3=9Fstra=C3=9Fe

where it should be
Gaußstraße

in addition the mime-version info is sent and shown by the mail.app as well, e.g. see below (where you also can see that the signature separator is written as "--=20":
--text follows this line--
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

--=20

Update:
I also get
--text follows this line--
Vielen Dank und viele =?utf-8?B?R3LDvMOfZSE=?=
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

when it should say:
Vielen Dank und viele Grüße

No, I see a different charset!? Not sure, if this is relevant...
Do you have an idea what is going wrong?
This is the setting which I have for gmail
                (smtpmail-starttls-credentials . (("smtp.gmail.com" 587 nil nil)))
                (smtpmail-auth-credentials . (expand-file-name "~/.authinfo.gpg"))
                (smtpmail-default-smtp-server . "smtp.gmail.com")
                (smtpmail-smtp-server . "smtp.gmail.com")
                (smtpmail-smtp-service . 587)
                (smtpmail-stream-type . starttls)
                (mu4e-sent-messages-behavior . delete)

Do you need more information about the setup for each account?
Here is an update and further information:

I am using spacemacs with emacs 28.0.50 (and I tested it with 27) mu 1.4.13 on macos

Using gnus the sending works fine with these settings in .gnus.el
(setq send-mail-function 'smtpmail-send-it)
(setq smtpmail-smtp-server "smtp.gmail.com")
(setq smtpmail-smtp-service 587)

This short settings does not result in correct mails with mu4e.
When looking in the drafts folder with the mail.app client on my gmail account, I see the message in a correct way.
I tried also plenty of other things for setting the encoding... the problem is however that I do not not know in which direction I have to look further
e.g. I tried something like:
(set-default-coding-systems 'utf-8-unix)
(setq mm-coding-system-priorities '(iso-latin-1 utf-8))

and similar settings without success.
Next Update using msmtp:
I was testing the sending with msmtp for all three accounts using mu4e and the context setup. Sending itself works again, but only the davmail account sends correct emails. The other accounts (one is gmail) results in the same problem as above.
And testing a plain file with msmtp like this
cat test.mail | msmtp -a default <username>@domain.com

with something like
To: username@domain.com
From: username@gmail.com
Subject: A test

Vielen Dank und viele Grüße

works great with gmail as well... but the buffer from mu4e gets sent somehow in a wrong way!?
The plain file which I sent in a correct way was encoded as 'unix'; the standard way which mu4e seems to use is 'utf-8' (at least this is chown in the modeline); chaning it to 'unix' as well does not result in a correct mail!?
msmtp with mutt
Tested it and it works as well; just for the record; there I have set:
set send_charset = "utf-8:iso-8859-1:us-ascii"
set charset = "utf-8"


texts:
I am setting up a few hydras, one of which should open a frequently accessed file. The following command works, if I bind a keyboard sequence to it:

(lambda () (interactive) (find-file "~/capture.org"))

How would I rewrite it if I want to get the file (capture.org here) from a variable?

(setq my-file-variable "~/capture.org")
(lambda () (interactive) (find-file my-file-variable))

This returns an error: "Wrong type argument: stringp, ("~/capture.org")"

It seems that the variable contains a list with one element (the string I want), and not just the string.


texts:
I'm using Emacs 24.4. When writing Python code, Emacs behaves strangely with respect to indentation.

For example:

for i in range(10):
    print(i)
for i in range(10)

When I input :, Emacs adds a needless indent at the beginning of the third line. This is quite strange, is this a bug?


texts: Multiple files for reading abbreviations?

texts:
Is it possible to have multiple files to tell emacs reads abbrevs? In other words I would like that emacs reads abbrevs from files A and B, but write abbrevs only in A.
Is it possible?
(setq abbrev-file-name "~/.emacs.d/abbrev_defs")


texts: Weird cursor position of emacs 26.1 on macOS 10.12.6

texts:
I am new to emacs and I met a weird emacs problem, which I don't even know is a feature or what :)

Behavior:

The emacs is in the text-mode and turned off all the plugins, and I want to type ["ls"], but when I finish typing ] and wait for around 1 sec, the cursor will move to the second ". Then if I keep typing, let's say abc, then the text will become ["lsabc. When I switch to another buffer and switch back, the text will be back to normal ["ls"]abc.

Another scenario, in c-mode, when I type #define HI "hhhh, it becomes #dhhhh, which is really weird.

Does anyone have an idea of what happened here?

I am using Emacs (daemon/client) 26.1 under macOS 10.12.6, installed using homebrew, specifically, this binary package.


texts:
I want to delete trailing whitespace on save for every mode except org-mode.

In my .emacs, I have the following line:

(add-hook 'before-save-hook 'delete-trailing-whitespace)

I use the use-package macro, and I tried adding (remove-hook 'before-save-hook 'delete-trailing-whitespace) to my :config block, but that removes the hook globally. How can I remove it specifically for org-mode?


texts:
At the moment, I only know one way to determine which Emacs functions are called by any given Evil command (e.g. a sequence of key bindings in the Normal state): read the Evil source code.

Is there a more reliable and efficient way, and if so, what is it? For example, does Evil (or Emacs) have a mechanism that allows the user to tell Emacs:

  "When I enter my next command, show me afterwards which Emacs functions it mapped to."


texts: How to automatically remove a hook provided by a minor mode after disabling that mode?

texts:
I want to write a minor which evaluates some code in the buffer after saving a file. I activate after-save-hook for this mode:

(add-hook 'my-minor-mode-name-hook #'(lambda () (add-hook 'after-save-hook #'a-func-from-my-minor-mode))

Everything works as intended until I disable the minor mode with the command  my-minor-mode-name. I get the message that the mode has been disabled but after-save-hook is still active (although evaluating after-save-hook in the buffer indicates that a-func-from-my-minor-mode is not on the list).

I want a behaviour where disabling the minor mode removes automatically the hook -- how should I fix that?


texts: eval-when-compile and eval-and-compile identical definitions?

texts:
How can eval-when-compile and eval-and-compile have different behavior if their definitions are identical?
From byte-run.el:
(defmacro eval-when-compile (&rest body)
  ;; ... documentation string omitted ...
  (declare (debug (&rest def-form)) (indent 0))
  (list 'quote (eval (cons 'progn body) lexical-binding)))

(defmacro eval-and-compile (&rest body)
  ;; ... documentation string omitted ...
  (declare (debug (&rest def-form)) (indent 0))
  (list 'quote (eval (cons 'progn body) lexical-binding)))


texts:
I would like to see a bent arrow (↩) in the window fringe, when I'm using visual-line-mode becuse with no linum-mode (e.g. org, md, latex..) I'm not able to distinguish the lines.

References: LineWrap


texts: What changed with Mark/Region behavior between GNU Emacs 24.3.1 and 24.5.1?

texts:
I wrote a little search function a long time ago, binded to ctrl-f.  It has been working perfectly until I tried Emacs 24.4.

The purpose of the function is to highlight (region) the found word.  Furthermore I have other functions that can select/look backward/forward for the same text.  This set of dunctions are pretty useful and I am use to it.

The problem: Any key I hit (right arrow for example) after searching with this function with v24.3.1 will automatically disable the region highlighting.  With v24.4 and above the region is still active and I need to disable it manually with ctrl-space before doing anything which is annoying.

Questions: Any idea on what change concerning this behavior between those versions?  Is there a work around to have the old behavior?

Thanks

Function:

(defun mp-search (string)
"Search using search-forward instead of i-search, this search
cannot search whole word only"
(interactive "sSearch for : ")

; backup point
(setq mp_backup_point (point))
(set-mark nil)

; search forward the selection if there is a selection
(if (search-forward string nil t)

    (progn (set-mark (point))
           (backward-char (length string))
           (exchange-point-and-mark))

    (progn (message "Return at the file's beginning...")
           (goto-char 0)
           (if (search-forward string nil t)
           (progn (set-mark (point))
                  (backward-char (length string))
                  (exchange-point-and-mark))
           (progn (goto-char mp_backup_point)
                  (message "Nothing was found...")))))
)

Binding:
(global-set-key [(ctrl f)]              'mp-search)

Picture:


texts: How to count the number of lines between two points? (ignoring word wrap)

texts:
Is there a convenient way to count the number of lines between two points?

While I could search for \n in a loop and limit it to one of the points, this seems like an overly verbose way of doing it.


texts: TERM, terminfo, termcap. What are they how does Emacs use it?

texts:
I have a few questions about the relationship between TERM, terminfo and termcap and Emacs.

I do not know exactly what TERM, terminfo and termcap are.
I am on OS X.  I do not know what values (and where) I should set variables such as TERM.

But since such information is not really about Emacs I will seek it elsewhere.

With respect to Emacs, my question is this: How are such things are used by Emacs by shell and ansi-term?


texts: Making AUCTeX use tabs for leading indentation doesn't work

texts:
This answer says how to make AUCTeX use tabs for leading indentation. However, it doesn't work for me and I don't understand why it doesn't.

After adding the code to my init file, LaTeX-mode just stopped indenting altogether.

I suspected that's because I customized variable and removed the LaTeX-mode- and indentation-related lines

 '(LaTeX-indent-level 4)
 '(LaTeX-item-indent 0)
 '(TeX-brace-indent-level 4)
 '(indent-tabs-mode t)

from the block

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(LaTeX-indent-level 4)
 '(LaTeX-item-indent 0)
 '(TeX-brace-indent-level 4)
 '(indent-tabs-mode t)
 '(org-agenda-files
   (quote
    (<I censored the strings in here.>)))
 '(org-file-apps
   (quote
    ((auto-mode . emacs)
     ("\\.mm\\'" . default)
     ("\\.x?html?\\'" . default)
     ("\\.pdf\\'" . "evince %s"))))
 '(safe-local-variable-values (quote ((TeX-master . t))))
 '(show-paren-mode t)
 '(tool-bar-mode nil))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

in my init file after backing ~/.emacs.d up as the comments say I'm not supposed to modify that block by hand. LaTeX mode still didn't indent (at all), so I had to remove the code I got from the linked answer and go back to indentation via spaces.

How do I get indentation via tabs working?

Update

After removing the customization with Andrew Swann's help and adding the code stated in the linked answer back to my init file, AUCTeX still doesn't use tabs for indentation. Or rather: It doesn't seem to indent anything. I tried setting LaTeX-indent-level to 4 and LaTeX-item-indent to 0 and even setting LaTeX-item-indent to 4, too. It still didn't indent.

When I hit Tab, however, it actually enters a tab character.


texts: Tried to update Emacs on my mac using Homebrew, and now it doesn't run at all

texts:
Up until an hour ago I had a working installation of Emacs version 26.2 on my Late 2013 iMac running macOS Catalina version 10.15.7 (this is the latest version available for my computer). I would run Emacs from the terminal by cd-ing to a certain directory and then executing:

emacs

Everything was dandy until, yesterday, for no good reason, I decided it was time to update my Emacs to the latest version. This was especially asinine since I'm in the middle of writing my thesis and I'm already behind schedule. But I went along and tried to update it via Homebrew.
I described my failed attempt to update Emacs in this post that I posted yesterday to the apple stachexchange forum.
A certain user named nohillside suggested in the comments that I uninstall emacs, remove Emacs from the Applications directory, and then try to reinstall it. I followed this suggestion about an hour ago. Unfortunately, it didn't succeed in updating my Emacs installation. Worst: the command emacs no longer works at all.
Please help me get Emacs working again.


texts: Find and replace a text among the files of a project

texts: How can I do a "find and replace a string" in the files of a project? Is there a standard, built-in way?


texts: Why does calc subscr work with index vectors in org tables?


texts: Why can't I type a dollar sign in this latex equation?

texts:
Consider the following latex document.
\documentclass{article}

\usepackage{tikz}

\begin{document}
Consider the following picture.
\[
  \begin{tikzpicture}
    \node (X) {X}; % this X should be enclosed in a dollar sign to be in math mode
    \node[right of= X] (Y) {Y}; % this Y should be enclosed in a dollar sign to be in math mode
    \draw[->] (X.east) -- (Y.west);
  \end{tikzpicture}
\]
\end{document}

I want to enclose the X and Y in the tikzpicture environment with dollar signs (because I want them typeset in math mode). However, when I attempt to do so, emacs throws an error in the minibuffer reading Math mode started with '\[' cannot be closed with dollar.
What's wrong here?
I'm using GNU Emacs 27.1 with AUCTeX-version 12.3.1.
Note that this is not a latex question since my desired code (below) compiles fine in latex.
\documentclass{article}

\usepackage{tikz}

\begin{document}
Consider the following picture.
\[
  \begin{tikzpicture}
    \node (X) {$X$};
    \node[right of= X] (Y) {$Y$};
    \draw[->] (X.east) -- (Y.west);
  \end{tikzpicture}
\]
\end{document}


texts: Save buffer immediately after org-archive-location

texts:
Question

How do I immediately save the .org buffer created by org-archive-location?

Context and what I've tried so far

Current .emacs settings:

FILE: .emacs
(setq org-archive-location (concat "~/Documents/Reference/org/archive/" (format-time-string "%Y-%m") ".org::"))

Consider

FILE: main2.org
* Done item

Calling org-archive-location with C-c $ results in the following buffers

FILE: *Messages*
Subtree archived in file: ~/Documents/Reference/org/archive/2019-06.org

and

FILE: 2019-06.org
Archived entries from file /Users/janmeppe/Documents/Reference/org/main2.org

* Done item
:PROPERTIES:
:ARCHIVE_TIME: 2019-06-18 Tue 11:26
:ARCHIVE_FILE: ~/Documents/Reference/org/main2.org
:ARCHIVE_CATEGORY: main2
:END:

Now the problem is this, I have to manually save the buffer for it to appear in the finder, how do I automatically save this buffer after calling org-archive-location?

I tried adding the following but it this help

(advice-add 'org-archive-location :after #'org-save-all-org-buffers)


texts: How to customize org-latex-export-to-pdf?

texts:
I have a text file that I want to turn into a pdf. I found org-latex-export-to-pdf so I've saved the text file as an org file and when I run the command M-x org-latex-export-to-pdf I get a pdf file but I want to go more into how to customize the look of the resulting pdf. Looking at the .tex (LaTex) file I see there there is

% Created 2016-06-25 Sat 00:20
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\author{Me}
\date{\today}
\title{}
\hypersetup{
 pdfauthor={Me},
 pdftitle={},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 24.5.3 (Org mode 8.3.4)},
 pdflang={English}}
\begin{document}

\tableofcontents

Is there an emacs variable for setting the documentclass part of the latex file? Setting a default for org-latex-export-to-pdf so I don't have to include the headers defined here My goal is mainly changing textsize, font type, taking out page numbers, space after paragraph.

Side question as well, from the looking around I see that you can install external packages such as org-article, XeTex then follow this blog but what is the bare minimum to be able to make the above changes? Are those extra packages even needed?

EDIT: The usepackage lines I'll probably have to look at later but for now I'm mainly concerned with the documentclass. To start, I've tried adding

#+LATEX_CLASS: article
#+LATEX_CLASS_OPTIONS: [44pt]

but the font size doesn't seem to change in the resulting exported pdf file though I do see this at the top of the .tex file (the text in the pdf still looks like 11pt)

% Created 2016-06-26 Sun 16:31
\documentclass[44pt]{article}


texts: How to set multiple directories for helm-do-grep-ag

texts:
How to setq the directory or directories where to search with helm-do-grep-ag?
I would like to use helm-do-grep-ag so it always searches within specific folders. Is this possible?


texts:
I'm working with an old compiler that puts out error lines like this:

./code\driver.c(327): WARNING C4200: Other...

I need to fix a couple things:

Fix the path from Wine/DOS mode to local: ./code\driver.c -> driver.c
Rewrite "Entering directory ..." lines
Rewrite the line info:  driver.c(327): -> driver.c:327
And keep everything after that intact

Anybody know a way to re-write compile output to be emacs compatible?

I ended up writing a Python script, but I wouldn't be surprised if there is something directly in emacs that can do all this.


texts: Text substitution only in specific column of org table

texts:
I came across this problem today: I had a table with many entries and wanted to perform a text substitution (normal text substitution was sufficient as I hardly ever need regex text substitutions) in all cells of a single column. I ended up pressing y and n many times, instead of just ! as it would've been had I had a way of restricting the text substitution (I used M-% / query-replace).

What's the best way of performing this task?


texts:
Could you help me with smarter way of handling package-archives?
At the moment I have the following in my init.el

;; This is dumb but...
(if (eq system-type 'windows-nt)
    (setq package-archives '(("elpa" .  "http://elpa.gnu.org/packages/")
                             ("melpa" . "http://melpa.org/packages/")))
  (setq package-archives '(("elpa" .  "https://elpa.gnu.org/packages/")
                           ("melpa" . "https://melpa.org/packages/"))))

Can I make it more DRY?
Like this one (doesn't work):

(defvar package-protocol "https://")
(if (eq system-type 'windows-nt) (setq package-protocol "http://"))
(setq package-archives '(("elpa" .  (concat package-protocol "elpa.gnu.org/packages/"))
                         ("melpa" . (concat package-protocol "melpa.org/packages/")))))

thx, combined from the answers, using local variable:

;; Set up packaging system
(let ((package-protocol (if (eq system-type 'windows-nt) "http://" "https://")))
  (setq package-archives `(("elpa" .  ,(concat package-protocol "elpa.gnu.org/packages/"))
                           ("melpa" . ,(concat package-protocol "melpa.org/packages/")))))


texts: Make output of source code blocks be inserted regardless of the exit status of the evaluation

texts:
The context
When evaluating the following code block, the output is not inserted in the #+RESULTS code block. This happens because of the return 1 statement.
#+begin_src cpp :results output
#include <stdexcept>
#include <iostream>

int main()
try {
  throw std::runtime_error("A runtime error ocurred");
  return 0;
}
catch(std::runtime_error& e) {
  std::cout << "runtime_error: " << e.what() << '\n';
  return 1;
}
#+end_src

#+RESULTS:

If I replace 1 with 0, then the output is indeed shown in the #+RESULTS code block
#+RESULTS:
#+begin_example
runtime_error: A runtime error ocurred
#+end_example

Additional context
Note that this behavior is also  present in #+begin_src whose language is sh. Here's a minimal working example: Evaluating the following code block would result in
#+begin_src sh
f() {
  return 1
}

printf "%s" "a"
f
#+end_src

#+RESULTS:

If the return value of the f function is changed to 0, then the output of the printf is shown
#+begin_src sh
f() {
  return 0
}

printf "%s" "a"
f
#+end_src

#+RESULTS:
#+begin_example
a
#+end_example

The question
How can I make the output of the evaluated code block be inserted in its corresponding #+RESULTS code block regardless of the exit status of the evaluation?


texts: Prevent emacsclient from blocking other instances

texts:
I use emacs in the terminal, typically with many emacs instances running at once in different tabs. This is a perfect use case for emacsclient, but it has always had various glitches that have stopped me from using it. In particular, sometimes one client will "block" the other, preventing it from doing anything. It looks like things work better in emacs 24.4, but it still happens.

For instance, if I start two clients, and run M-g M-g in one, to get the "Goto line" entry, the other client will be completely locked down until I quit in the first one.

I am using emacs 24.4 compiled without windowed support in Mac OS X 10.10 (in iTerm 2). I can reproduce it by starting emacs --daemon -Q. If you want the exact emacs binary I am using, download Miniconda for OS X and run conda install -c asmeurer emacs.


texts: YASnippet: Avoid electric pairs at expansion time

texts:
I am used to bind my YASnippet trigger keys to sequences that start with < (e.g. when I type <hn in org-mode, it expands to a custom header for my notes).

The problem is that in some modes, the < character is part of electric pairs (I have electric-pair-mode enabled), which automatically writes a closing > when I type it. As a consequence, my snippet expansions are followed by an unwanted >.

The < character is not in electric-pair-pairs nor in electric-pair-text-pairs, so it does not seem easy to just avoid electric pairing for this character (which, besides, I do not want for certain modes).

How should I go about it?
Is there a way to make YASnippet delete the > character at expansion, before the actual expansion is written?


texts:
Quoting from use-package

  If you aren't using :commands, :bind, :bind*, :bind-keymap, :bind-keymap*, :mode, or :interpreter (all of which imply :defer; see the docstring for use-package for a brief description of each), you can still defer loading with the :defer keyword:

But why I found many people including jwiegley himself still use :defer even it's already have :bind


texts: How to execute emacs commands in background

texts: When executing some time consuming commands like magit-status or using scp to transfer files, then Emacs freezes and waits for return. Is there any way I can tell Emacs to run those commands in the background?


texts: Powerline separators on Windows -- create XPM image?

texts:
I'm running Emacs 24.4.1 on Windows 8, and am unable to get powerline to display the fancy separators (arrows, etc). There are a handful for packages and forks that implement powerline for Emacs, of which I've tried a couple (such as emacs-powerline and powerline).

The root of the problem seems to be with the use of create-image to create XPM images. I haven't debugged in depth but it seems like in my case the create-image calls are always returning nil.

From searching online it seems like there are people running Emacs+Windows for which powerline renders properly, possibly with older versions of Emacs. It seems like xpm support is included so no additional libraries should be required, but I've never dealt with create-image before so perhaps I'm overlooking something.

Update

Well, I've confirmed that on my system XPM support is not working:

(image-type-available-p 'xpm)
==> nil

So I suppose the question is: how do I get XPM support?


texts: Problem with nil element in load-path in Emacs 24.4

texts:
I just installed Emacs 24.4 from source (on Ubuntu 14.04). I now get the following error when running Emacs:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match("/[._]emacs\\.d/?\\'" nil nil)
  command-line()
  normal-top-level()

For debugging, I reduced my ~/.emacs init file to:

(setq debug-on-error t)
(add-to-list 'load-path nil)

Then the error occurs only when starting Emacs with two arguments, where the first argument is an option, for example --no-splash, and the second argument is a file name with a suffix, for example a.txt. Some other observations:

If I remove the option (--no-splash) it works fine,
if I remove the line (add-to-list 'load-path nil) it works fine,
if I run with Emacs v. 24.3 it works fine,
if I change nil to ".", in ~/.emacs it works fine,
if I remove the suffix from the file name, that is: changing a.txt to a, I get another error: Args out of range: 0.

Edit After adding nil to load-path, the variable looks like:

(nil "/opt/emacs24.4/share/emacs/24.4/site-lisp" "/opt/emacs24.4/share/emacs/site-lisp" "/opt/emacs24.4/share/emacs/24.4/lisp" "/opt/emacs24.4/share/emacs/24.4/lisp/vc" "/opt/emacs24.4/share/emacs/24.4/lisp/url" "/opt/emacs24.4/share/emacs/24.4/lisp/textmodes" "/opt/emacs24.4/share/emacs/24.4/lisp/progmodes" "/opt/emacs24.4/share/emacs/24.4/lisp/play" "/opt/emacs24.4/share/emacs/24.4/lisp/org" "/opt/emacs24.4/share/emacs/24.4/lisp/nxml" "/opt/emacs24.4/share/emacs/24.4/lisp/net" "/opt/emacs24.4/share/emacs/24.4/lisp/mh-e" "/opt/emacs24.4/share/emacs/24.4/lisp/mail" "/opt/emacs24.4/share/emacs/24.4/lisp/leim" "/opt/emacs24.4/share/emacs/24.4/lisp/language" "/opt/emacs24.4/share/emacs/24.4/lisp/international" "/opt/emacs24.4/share/emacs/24.4/lisp/gnus" "/opt/emacs24.4/share/emacs/24.4/lisp/eshell" "/opt/emacs24.4/share/emacs/24.4/lisp/erc" "/opt/emacs24.4/share/emacs/24.4/lisp/emulation" "/opt/emacs24.4/share/emacs/24.4/lisp/emacs-lisp" "/opt/emacs24.4/share/emacs/24.4/lisp/cedet" "/opt/emacs24.4/share/emacs/24.4/lisp/calendar" "/opt/emacs24.4/share/emacs/24.4/lisp/calc" "/opt/emacs24.4/share/emacs/24.4/lisp/obsolete")

According to the Emacs manual:

Variable: load-path

  The value of this variable is a list of directories to search when
  loading files with load. Each element is a string (which must be a
  directory name) or nil (which stands for the current working
  directory).


texts: Mark Cursor Vertically on Multiple Lines

texts:
I can enter rectangle mark mode with C-x SPC, and then do C-p or C-n to set mark to the line above or below.

How do I vertically mark multiple lines in one go without having to do C-p or C-n multiple times?

Also, is it possible to set mark vertically to the beginning or end of document?


texts: Display documentation in Company results

texts:
The GitHub page for emacs-racer shows function signatures in company completion results.

My results display "Function" and nothing beyond.

I've searched through customize-group company and can't find any variables that seem to be relevant. How can I achieve the advertised behavior?

I do not believe the problem is with the racer command itself. It works as expected when invoked from the command line, and eldoc-mode displays correct signatures.


texts: How to fix indentation that I do not like?

texts:
I love emacs and its modes but sometimes I do not agree with its indentation.  In this specific case I am talking about glsl-mode . When I type an array inside a function, I want the square brackes to be indented past the curly braces. Like so:

void main () {
    vec4 thing = [
     1, 2, 3, 4;
    ]
}

What I get by default is this:

void main () {
    vec4 thing = [
     1, 2, 3, 4;
] // I do not want this
}

and I am wondering if there is a simple way to fix this.  Can someone explain to me a possible solution?


texts: How to Find Out Where a File is Being Required?

texts: Using benchmark-init, I see that helm files (helm-elisp, helm-mode, helm, etc.) are being required, but I don't have "(require 'helm)" or "(require 'helm-config)" or "(helm-mode 1)" anywhere in my init file. I'm using use-package, and all helm-related packages are deferred, including helm. Is there some direct way I can figure out where helm is being required from? I also want to find out where semantic is being required from.


texts:
I want to recover a file from system failure

M-x recover-file

It did not restore the auto-saved file, but to throw an error:

/var/folders/n8/dz3thx0x4sd2p8zdqyqbflrc0000gn/T/#!Users!gaowei!desktop!pubrepo!org!projects.org# not current
user-error: Minibuffer window is not active
Mark set
<s-double-drag-mouse-1> is undefined

I definitely  cannot read the info at the current level.

How could I solve the problem?


texts:
I sometimes want to read mailing list archives for projects that I'm not subscribed to.  There are nice HTML archives online (e.g. https://lists.gnu.org/archive/html/emacs-devel/2014-12/msg00347.html), but I don't enjoy reading mails in the browser.

Is there an interface for Emacs to read mailing list archives?  I already use mu4e to read my personal email inside of Emacs, but I'd also like to be able to read other people's email in Emacs (to the extend that these other people have posted to public mailing lists).

There's got to be a mode for that.  (I suspect gnus is the answer, but I have never used it.)


texts: How to use a hyphenated user-name with postgres in sql-interactive-mode?

texts:
I have the following configuration in emacs init files to set a variable (user) to the current Unix login user:

(setq sql-postgres-login-params
      `((user :default ,user-login-name)
        (database :default ,user-login-name)
    (server :default "127.0.0.1")
        (port :default 5432)))

With this, I was able to login into PostgreSQL databases with the Unix login user as the default database user. However, this stops working when the Unix user name contains dashes -, and needs to be double-quoted. For example, in PostgreSQL, when the unix user is myuser, it's OK to use it directly as the database user name. However, when the user name is my-user, it needs to be quoted as "my-user" to be used as a user name (or database name). My question is:

How can I make the user-login-name in the above example quoted?

e.g. if ,user-login-name is my-user, how do I use "my-user" instead?

I am not familiar with elisp, and the below is the best I can come up with (concatenating with "\""s). But database login still fails.

(setq sql-postgres-login-params
      `((user :default ,(concat "\"" user-login-name "\"") )
        (database :default ,(concat "\"" user-login-name "\"") )
        (server :default "127.0.0.1")
        (port :default 5432)))


texts: Name of Emacs Lisp library that provides `with-gensyms' classic macro

texts:
I have the feeling that Emacs Lisp macros are written in some different way than Common Lisp macros. This can't be true, but where is all the gensym things? Recently I was writing a macro and I needed to avoid capturing a lexical variable, so I started searching for gensym function. There is no such function! How can a Lisp that has macros don't have gensym? Maybe it's handled differently in Emacs Lisp?

I've found gensym in cl-lib, that's already something. But what I really need is with-gensyms. Do you know where can I find such a macro (third party package is fine if it's in ELPA or MELPA, although it should be built in Emacs by now, I think).

I'm ready to write these eight lines myself, but this sort of thing shouldn't be rewritten every time, IMHO.

Edit: to make it clear: I'm searching for a way to get this once and for all, that's a library that contains it that I can depend upon. If you think it's OK to rewrite it everywhere every time developer needs it -- that's your point of view. If you vote to close the question simply because there is no such library and

  Lisp hackers generally do what is practical for them, such as writing a small utility macro and leaving it at that

-- I think your reasoning is fallacious. Lisp hackers generally don't like to redo something simply because that's how people do it. They create what they need and then use it everywhere.

There are quite a few different libraries that make life easier, and they often do more trivial things. Yet when I ask for something that's useful but missing I get this typical answer "well, don't you know, just copy paste it from Goggle because it isn't there".

You can of course close this question, but IMHO it's normal question asking for certain tool that Emacs Lisp developer might find useful in some cases. If you don't know decent solution, that doesn't mean that the question is bad.


texts: Can I use find to pass a list to emacs commands?

texts:
I'm trying to modify a script I got from an old question of mine.

I have many .org files under many subdirectories of ~/foo. I want to quickly run htmlize on each .org file. I have some elisp code

$ cat ~/htmlize-script.el
(add-to-list 'load-path "~/.emacs.d/elpa/htmlize-20130207.1202/")
(require 'htmlize)

and my script is

$ cat ~/script.sh
find ~/foo -name "*.org" -exec emacs --eval "
(progn
  (load-file \"~/htmlize-script.el\")
  (htmlize-many-files \"{}\")
  )
" --kill \;

However, running this code gives the error

Wrong type argument: listp

What is the issue here?

Issuing C-h f htmlize-many-files returns

htmlize-many-files is an interactive autoloaded Lisp function in `htmlize.el'.

(htmlize-many-files FILES &optional TARGET-DIRECTORY)

Convert FILES to HTML and save the corresponding HTML versions.

FILES should be a list of file names to convert.  This function calls
`htmlize-file' on each file; see that function for details.  When
invoked interactively, you are prompted for a list of files to convert,
terminated with RET.

If TARGET-DIRECTORY is specified, the HTML files will be saved to that
directory.  Normally, each HTML file is saved to the directory of the
corresponding source file.

Is the problem that the find command does not pass the right list to emacs?


texts: Org Mode - Is there a way to reverse org-list-make-subtree?

texts:
By using org-list-make-subtree (C-c C-*) you turn an Org List into a sub tree:

- Item 1
 - Item 2
  - Item 3

would turn into

* Item 1
** Item 2
*** Item 3

But is there a built in function (like org-subtree-make-list)to reverse this operation or would you need to do it by hand?


texts: Unable to deactivate the selection mode with C-SPC

texts:
Sometimes I can't deactivate the mode of selecting text which is C-SPC. Even if I press it a second time and move the cursor, the text still gets selected. I press C-SPC one more time, it activates and selects the text as I move the cursor. Then if I press C-SPC again and nothing changes except the label says "Mark deactivated" but really it's not. In order to really deactivate, I have to click somewhere in a buffer by mouse.

Is this a bug?


texts: Display the beginning of a scope when it is out of screen

texts:
I would like to display the opening part of a scope when this one get out of screen.

Example:

namespace a
{
...
--------------------- <- display frame
...                 |
}*                  | * when cursor is here display "namespace a" in the minibuffer
---------------------   or on screen

This could work for many programming language but I am mainly thinking of C++.

To clarify a bit more and for those who know VS, I would like a similar feature as what exist for Visual Studio. i.e. positioning the cursor at the end of a scope display the beginning of the scope at the top of the edit buffer.

Is this feature already existing somewhere ?


texts: Display #+INCLUDE File Contents in Github README.org?

texts:
I learned from How to embed external file contents in org file? about including contents from another file into the org file. I tried that for my README.org. My code in org file looked like this:

#+INCLUDE: "~/.emacs.d/init.el" src emacs-lisp :lines "2-20"

This indeed worked when I export the org file into html, looked very neat and even have syntax highlighting.
However, when I upload the README into Github and try to view it in my Github project homepage's README area, the entire section of code disappeared.

I wish to be able to function like BEGIN_SRC emacs-lisp, so that I am able to view the chunk of code within README. How can I do this?


texts: copy to clipboard without overwriting kill ring

texts:
I'm looking for a way to copy to clipboard from emacs without passing through the kill-ring, moving the marker or using the mouse.
If I use x-select-enable-primary and x-select-enable-clipboard, I can unite the clipboard and the kill-ring, but it is really great to have two kill-rings (ring + clipboard) available and I don't want to give it up (scrolling between kill-ring items is less fun than having two rings).
I'm using emacs 25.1 on linux (not OSX) and also limited on what I can add to my emacs (it is on a secured web).

Anyone knows if it is even possible?
p.s.
My ultimate goal is to be able to catch the entire word/ phrase the marker is currently on and copy it to clipboard.
I plan doing it by taking code bits from ffap (find-file-at-point), but if such a thing already exists, this can be a much better solution to this question...

A testcase:
/this/is/a_filname/that_might/appear/in-my.logs
I want to be able to put the marker anywhere on the name (say, the "g" in the middle) and grab the entire thing into my clipboard without overwriting my killring, moving the marker or using the mouse.


texts:
I'm trying to open a remote shell after connecting to a machine using Tramp with the plink method on MS Windows.

However every time I call shell it prompts me for 'Remote shell path' and suggests a local directory.  I think I have to type /plink:Server:/bin/bash to be able to run the shell.

Is there any way to avoid having to do this every time I want to run shell on a remote machine?


texts: Function `cd` not working correctly in conjunction with `tramp` and `compile`

texts:
For context I am looking at a remote file; for example: /ssh:desktop:/home/user/project/src/file.cpp.
I then issue the interactive command compile like so:
cd /ssh:desktop:/home/user/project/Release && make
And get the following output:

-*- mode: compilation; default-directory: "/ssh:desktop:/home/user/project/Release/" -*-
Compilation started at Wed May 20 22:42:42

cd /ssh:desktop:/home/user/project/Release && make
/bin/sh: 2: cd: can't cd to /ssh:desktop:/home/user/project/Release

Compilation exited abnormally with code 2 at Wed May 20 22:42:43

Then I tried issuing the interactive command compile differently (without the remote prefix):
cd /home/user/project/Release && make
And get the following error:

No such directory found via CDPATH environment variable

I can't quite figure it out, but I suspect that the function cd (in site-lisp file emacs/lisp/files.el) has something to do with it:

(defun cd (dir)
  "Make DIR become the current buffer's default directory.
If your environment includes a `CDPATH' variable, try each one of
that list of directories (separated by occurrences of
`path-separator') when resolving a relative directory name.
The path separator is colon in GNU and GNU-like systems."
  (interactive
   (list
    ;; FIXME: There's a subtle bug in the completion below.  Seems linked
    ;; to a fundamental difficulty of implementing `predicate' correctly.
    ;; The manifestation is that TAB may list non-directories in the case where
    ;; those files also correspond to valid directories (if your cd-path is (A/
    ;; B/) and you have A/a a file and B/a a directory, then both `a' and `a/'
    ;; will be listed as valid completions).
    ;; This is because `a' (listed because of A/a) is indeed a valid choice
    ;; (which will lead to the use of B/a).
    (minibuffer-with-setup-hook
        (lambda ()
          (setq-local minibuffer-completion-table
              (apply-partially #'locate-file-completion-table
                       cd-path nil))
          (setq-local minibuffer-completion-predicate
              (lambda (dir)
            (locate-file dir cd-path nil
                     (lambda (f) (and (file-directory-p f) 'dir-ok))))))
      (unless cd-path
        (setq cd-path (or (parse-colon-path (getenv "CDPATH"))
                          (list "./"))))
      (read-directory-name "Change default directory: "
                           default-directory default-directory
                           t))))
  (unless cd-path
    (setq cd-path (or (parse-colon-path (getenv "CDPATH"))
                      (list "./"))))
  (cd-absolute
   (or
    ;; locate-file doesn't support remote file names, so detect them
    ;; and support them here by hand.
    (and (file-remote-p (expand-file-name dir))
         (file-accessible-directory-p (expand-file-name dir))
         (expand-file-name dir))
    (locate-file dir cd-path nil
                 (lambda (f) (and (file-directory-p f) 'dir-ok)))
    (error "No such directory found via CDPATH environment variable"))))


texts: How can I change Org-mode time format for one buffer?

texts:
In general all timestamps in Org-mode appears as [YYYY-MM-DD Day]. I have one file (buffer) where I would like the format to be different. Either just [YYYY-MM-DD] or [YYYY-MM]. How do I tell Org-mode to use a custom format for this one buffer?

I'd be happy to have it automatic, which I think means something like:

# -*- coding: utf-8; eval: (org-time-stamp-custom-formats '("<%Y-%m>")); -*-

As the first line, or have a code block that I evaluate with C-c C-c each time I work in that buffer.

#+BEGIN_SRC emacs-lisp
(make-local-variable 'org-time-stamp-custom-formats)
(make-local-variable 'org-display-custom-times)
(setq org-time-stamp-custom-formats '("<%Y-%m>"))
(setq-default org-display-custom-times t)
#+END_SRC


texts: Running Emacs through X2Go, the bidirectional clipboard does not work, even though it works for other programs

texts:
Being in home-office due to the Corona outbreak, I am using Emacs and other programs through X2Go.

I am also running a terminal through GNU Screen in a MinTTY window, because scrolling the terminal for analyzing the output is very slow over X2Go.

I was running into the problem, that I couldn't copy/paste between the remote Emacs and other applications, native or remote.


texts:
I use two Macs in my day to day coding studies: one iMac and one Macbook Air (three, if you count Emacs, ha ha ha). I often code on the same files with both computers, and iCloud Drive makes sense as a way to manage these files. I currently have a plain old folder alias set up from my iCloud drive to my desktop, but I can't Ctrl-X Ctrl-F my way into the iCloud Drive.

I use Emacs to work with Coq Proof Assistant, which requires Coq Proof General, Coq / Coqtop, and a bunch of installation. I want to open .v files, which I can already normally do.

Current problem: So I can access desired folder through iTerm and terminal, but navigating to that folder (~/Library/Mobile Documents/com~apple~CloudDocs/Documents/fpp) and then typing in emacs Assignment 5.v gives me this error:

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}

When I enter sudo emacs Assignment5.v, emacs opens up but it is completely blank (i.e empty). Do help!

Desired outcome: to be able to ctrl-x ctrl-f and open any file in emacs, with the default path being directly into my iCloud\ Drive/fpp folder. Would be nice if I could ls and emacs Assignment5.v.

P.S while you're here give me your best Emacs tips for better proofing!