texts: Trying to invoke help (CTRL-H) deletes character on terminal

texts:
When I press CTRL-H in emacs running on my xterm, then this is interpreted as backspace and the character before the point is deleted. I've found various discussions about the "opposite" issue (pressing backspace invokes help), but was unable to modify them to my needs.

How can I access help commands (like the describe functions) from a emacs -nw running in an xterm with the keystroke CTRL-H ?

GNU Emacs 24.5.2, XTerm(312), NixOS x86_64, empty .emacs


texts: How to use `recover-session` and `dired-omit-mode` in Emacs 26 and lower?

texts:
Using Emacs 26.1, I have enabled dired-omit-mode globally with (add-hook 'dired-mode-hook #'dired-omit-mode). When using recover-session, I don't see any files. How to fix this?

Creating a .dir-locals.el containing ((dired-mode (dired-omit-mode))) didn't work.

This bug should be fixed in Emacs 27.1.


texts: How to evaluate the selection through Python and replace the selection with it's result?

texts:
Being more familiar with Python then elisp, I'd like to evaluate the selection as as Python snipped - as a short-cut to opening a calculator or Python prompt and copy-pasting between them.

Is there a convenient way to evaluate the selection as a Python expression?

So I could type for eg 11**13//7 and replace it with 4931816020561


texts: How to prevent mu4e from checking mail when the internet is down?

texts:
Q: how do I prevent mu4e from automatically checking mail
when the internet's down?

Problem

I use mu4e and offlineimap to handle my email.  When on a
laptop, I have to deal with the fact that I sometimes have spotty
wifi connections.  offlineimap freaks out when it gets called
without an internet connection.

Problem as it relates to mu4e

I have mu4e invoke offlineimap automatically every 5 minutes
or so:

(setq mu4e-get-mail-command "offlineimap -o"
      mu4e-update-interval  300)

Unfortunately, that means it doesn't check if I've actually got an
internet connection.

So...

How do I tell mu4e not to invoke offlineimap if there's no
internet connection?


texts: How to initialize Racket libraries, environment at org-mode buffer startup

texts: As the title says, I want a number of things to happen when I open an org-mode file: I want a Racket REPL session to start (as in a code block :session mysess1) and I want various Racket environment-library things to happen, e.g., initialize (require math). I've thought about Emacs local file variables, but not sure how it can first start a particular named REPL session, then run the (require math). There is also the org mode tag #+STARTUP, but again I'm not sure how that would happen. Any ideas?


texts: Emacs colors being set differently when TERM is 'screen-256color' and 'xterm-256color'

texts:
I'm using Emacs in a terminal and am finding that when the TERM environment variable is changed between screen-256color and xterm-256color, the default colors within Emacs are set differently.

Just to be clear, I'm getting full 256 bit color support in both situations (running with byobu/tmux and running with Gnome Terminal respectively), but Emacs is applying different colors such that when I look at the same Python file, the syntax highlighting uses differ colors in each. When I manually change the colors using color-theme-select to the same theme, they then use the same colors. The problem is that I have no idea how the colors are set to begin with, and more importantly, why they are set differently.

This behavior remains constant when I force byobu to use TERM=xterm-256color, so it doesn't seem like this is a problem with either of the terminal emulators.

How can I ensure that Emacs uses the same colors in each situation?


texts: Edit/fork packages installed via package-install

texts:
I would like to make a few changes to a package installed via package-install. What's the canonical way to do so?

I understand that it would probably involve:

Uninstalling the package via list-packages. (Is this necessary?)
Place the package files manually somewhere under ~/.emacs.d (e.g. by cloning the Git repository)
Tell Emacs to load the package from the new location. (How?)


texts: Using both fixed-width and variable-width font in org-mode

texts:
I would like to have an org-mode file with the following content:

#+TITLE: My awesome Emacs file

* My Header
Here's some information under the header

#+BEGIN_SRC sh
echo "this is some code"
#+END_SRC

More text and =verbatim= things

Is it possible to have Emacs display the header and text in a variable-width font and only the #+BEGIN_SRC, #+END_SRC, =verbatim= and source code in a fixed-width font?


texts: rebind C-RET in cua-mode to a different key?

texts:
I use column editing in cua-mode (cua-selection-mode) a lot. A main issue I have is that the most frequently used keybinding,  C-RET (Control + Return), doesn't work in most terminals (Ubuntu 16.04, Emacs 24.5), or with emacs -nw.

I did some research and found that this is a nasty problem as C-RET is often neglected by terminals and emacs does not receive it at all in non-GUI modes.

As a work-around, how can I rebind the functions of C-RET in cua mode to another key, e.g. C-^, that is not lost along the way?

(I searched around here and only found questions about how to
Unbind C-RET in emacs?)

Also, is it possible to rebind in a way that allow both the original key C-RET and the new key C-^ to work?


texts:
When in javascript mode trying to use C-c C-m i get an error saying  "C-c RET is undefined?"

What makes Emacs believe I am pressing RET?

How can i properly make this keybinding work?


texts: Org Mode: reference an org tree for input in code block

texts:
I want to use a (sub)tree of my org file as an imput to a python babel source block to parse it and to stuff with it (in my case generate a folder structure based on the headlines of that tree).

I know I can reference a table and the output of another code block but I didn't find anything to reference a tree.

Is there a way?
Is there probably a hack to explicitely declare a string and reference that?

Thanks for any tipps.


texts: Show done items in current calendar week

texts:
For my weekly report at work I use the org-mode (what else?). The custom agenda I am using is specified in my .emacs file as follows:

 '(org-agenda-custom-commands (quote (("W" "Weekly Meeting"
   ((tags "TIMESTAMP_IA>=\"<-1w>\"/DONE"
     ((org-agenda-sorting-strategy (quote (tag-up)))))
    (tags "TIMESTAMP_IA>=\"<-1w>\"/ABANDONED"
     ((org-agenda-sorting-strategy (quote (tag-up)))))
    (tags "TIMESTAMP_IA>=\"<-1w>\"/FAILED"
     ((org-agenda-sorting-strategy (quote (tag-up)))))
    (todo "URGENT" ((org-agenda-sorting-strategy (quote (tag-up)))))
    (todo "IN PROGRESS" ((org-agenda-sorting-strategy (quote (tag-up)))))
    (todo "PENDING" ((org-agenda-sorting-strategy (quote (tag-up)))))) nil
    ("test.html")))))

Thus, I can see which tasks are urgent, which I am currently working upon and which tasks have been delegated to other people and are pending to be done. Furthermore, I can see what tasks have been done within the last week, which were abandoned and where I failed to deliver the desired result in the last week. (the default export is for different purposes)

Now to my question: As far as I experience it I can only see what I have done/abandoned/where I failed within the last 7 days. A more suitable view would be to see what I have done in the current calendar week. Does anybody know how to achieve this?


texts: How to stop ivy-switch-buffer from trying to connect

texts:
I'm using ivy-use-virtual-buffers to see both currently and recently visited buffers in Swiper's ivy-switch-buffer and it worked great until last month when I opened distant files via ssh/Tramp.
Ever since, ivy-switch-buffer errors, see below.
Questions

How exactly is ivy-ignore-buffers (see config below) supposed to work ? On full buffer names (w/ path)?
How is ivy-switch-buffer trying to connect? I can see in the error buffer that is uses some username that I don't use anymore to connect... Where are those connection details stored?
Why is ivy-switch-buffer trying to connect in the first place ? counsel-recentf does not do that, the distant buffers are sitting quietly in the list, and when selected, Emacs connects (using the right SSH credentials / aliases / keys) and opens the file.

Here is my configuration:
(use-package swiper
  :ensure try
  :bind
  (([f4] . ivy-switch-buffer)
   ([(control c) (f)] . counsel-ag)
   ([(control c) (g)] . counsel-git)
   ([(control c) (j)] . counsel-git-grep)
   ([(control c) (l)] . counsel-locate)
   ([(control d)] . swiper-ag)
   ([(control f)] . swiper)
   ([(control h) (control f)] . counsel-describe-function)
   ([(control h) (control v)] . counsel-describe-variable)
   ([(control o)] . counsel-find-file)
   ([(control shift o)] . counsel-recentf)
   ([f9] . counsel-rhythmbox)
   :map ivy-minibuffer-map
   ([(control f)] . ivy-yank-word)
   :map read-expression-map
   ([(control r)] . counsel-expression-history))
  :config
  (progn
    (define-key
      ivy-switch-buffer-map
      [(control w)]
      (lambda ()
        (interactive)
        (ivy-set-action 'kill-buffer)
        (ivy-done))))
  :init
  (setq  ivy-use-virtual-buffers t
         ivy-ignore-buffers '("^\\/ssh" ; doesn't seem to work
                              "\\` "
                              "\\`\\*")
         ivy-display-style 'fancy
         ivy-count-format "(%d/%d) "
         ivy-initial-inputs-alist nil
         ivy-extra-directories nil))

And the errors:
Tramp: Opening connection for weird_username@myserver.com using ssh...
Tramp: Sending command ‘exec ssh -l weird_username  -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none myserver.com’
Tramp: Waiting for prompts from remote shell...
Tramp failed to connect.  If this happens repeatedly, try
    ‘M-x tramp-cleanup-this-connection’
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for weird_username@myserver.com using ssh...failed
tramp-file-name-handler: Tramp failed to connect.  If this happens repeatedly, try
    ‘M-x tramp-cleanup-this-connection’


texts: Disable subword-mode for some languages in Prelude

texts:
I have found subword-mode to interfere negatively with my flow, specially when using drag-stuff, and I'd like to disable it, if not globally, at least for a couple of languages.

I have tried (subword-mode 0) in my custom.el file and it didn't work. I thought about editing other modes manually, and the idea doesn't seem to scale with updates etc.


texts: How do I make pressing  in helm-find-files open the directory?

texts:
When I run #'helm-find-files, and move point to a directory, pressing <ret> results in opening that directory in dired mode. One has to press C-j to enter that directory in Helm.

I'd like to have <RET> act as C-j does here, but not necessarily everywhere else. I checked, and C-j is bound to #'helm-maybe-exit-minibuffer, whereas <RET> is bound to #'helm-execute-persistent-action. Binding <RET> to #'helm-maybe-exit-minibuffer works for this case, but breaks other cases: for example, the helm autocomplete in describe-function.

So, when using Helm to find a file, how can I make pressing <RET> open that directory in Helm?


texts:
I would like to set (or unset in this case) keys in the org-columns-map at startup but when I use "org-columns" nothing happens. If I use "org" instead I get errors that org-columns-map is not defined.
    (with-eval-after-load "org-columns"
     (define-key org-columns-map (kbd "a") nil)
     (define-key org-columns-map (kbd "o") nil)
     (define-key org-columns-map (kbd "c") nil)
     (define-key org-columns-map (kbd "n") nil)
     (define-key org-columns-map (kbd "p") nil)
     (define-key org-columns-map (kbd "g") nil)
    )

If I use eval-region the definitions work as expected, but they do not set at startup.


texts:
What does the (#o3, #x3, ?\C-c) output in the echo area (next to the 3) represent? Here I've simply evaluated

(+ 1 2)


texts: Org mode make an inactive todo item active on a specific date

texts:
I'm using org mode to keep track of my schoolwork at university right now, a feature I really like is being able to schedule recurring items since many classes have homework be due on the same day of each week. What I'm wondering is, is it possible to specify when a todo item becomes "activated" or shows up in my agenda?
For example, one of my classes has a quiz that's due every Friday but it only gets released every Monday. What I'd love to do is somehow program a todo item that's due on one day (an upcoming Friday for example) but remains "inactive" until the Monday so it's not cluttering my agenda on days where working on it is impossible. I've heard that the way Org mode would have us think about scheduled items isn't strictly intuitive but I'm hoping there's a feature somewhere for this use case. Thanks!


texts: How to speed up function in helm-dependent library

texts:
I have found that the following function is taking up a massive amount of time (75%-85%) in a library I am working on. What is slowing it down? It uses cl-loop, but I don't think that is what is slowing it down. I have tried using Edebug but it is not helping.
The library is here if anyone wants to take a look.
(defun helm-asdf-get-instance-by-display (display-str)
  "Get an instance by its display string.
Argument DISPLAY-STR: the display string."
  (cl-loop with candidates = (helm-attr 'candidates)
           for candidate in candidates
           when (string= display-str (car candidate))
           return (cdr candidate)))


texts: Doom-emacs - How to align chinese characters in org-tables

texts:
I'm trying out doom emacs for the first time (previously was using spacemacs). I've run into an issue where chinese characters are not aligned in org mode tables. For example:
| Character | Pingyin     | Meaning                  |
|-----------+-------------+--------------------------|
| 好        | hao         | good                     |
| 早上      | zaoshang    | morning                  |
| 晚上      | wanshang    | evning                   |
| 对不起    | dui bu qi   | to be sorry              |
| 没关系    | mei guan xi | that's ok/doesn't matter |
| 不        | bu          | no                       |
| 不客气    | bu ke qi    | you're welcome           |
| 在见      | zaijian     | see you around           |
|           |             |                          |

I've read online that this can be resolved by setting the width of chinese characters to double the width of asci characters, but I'm not sure how to do this. In spacemacs the issue is fixed with the following line in config:
(spacemacs//set-monospaced-font  "Source Code Pro" "Hiragino Sans GB" 15 18)

I'm trying to do something similar in doom:
(setq doom-font (font-spec :family "Source Code Pro" :size 15 :weight 'normal :width 'normal)
      doom-big-font (font-spec :family "Source Code Pro" :size 26))

(dolist (charset '(kana han cjk-misc bopomofo))
  (set-fontset-font (frame-parameter nil 'font)
    charset (font-spec :family "Source Code Pro" :size 18)))

But, it's not working. Would appreciate any help!


texts: How to prevent Text is read-only error inside minibuffer after typing C-x h and typing text

texts:
When This is reproducible in emacs -Q in my version of GNU Emacs running on my Ubuntu machine:

GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21) of 2017-09-22, modified by Debian

The steps below are intended to allow me to "select" (mark) all of the text in the default value of any minibuffer prompt, and immediately start typing which should erase the marked text (M-x delete-selection-mode), but not error out with the "Text is read-only" error because I've also marked the prompt part of the minibuffer text:

Type: M-x eval-expression
Type: (read-string "foo")
Type: C-x h which runs the command mark-whole-buffer which positions point at (point-min) in the minibuffer, which is just to the left of the read-only text
Type: x (or any character that would insert that character)
See the error: Text is read-only

What I expect to happen is that only the writable text is selected by C-x h and not the read-only prompt text.

I don't want to have to play games with hook functions that I replace the C-x h binding to (e.g., using text properties such as given in https://emacs.stackexchange.com/a/2133/15483), unless there isn't a cleaner way.

I tried to use the tips suggested in http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html but that does not inhibit motion back to (point-min), that is, this does not work:

(setq minibuffer-prompt-properties (quote (read-only t cursor-intangible t face minibuffer-prompt)))

I suspect there is some special property (https://www.gnu.org/software/emacs/manual/html_node/elisp/Special-Properties.html) that prevents the cursor from "hopping over" the read-only prompt part of the minibuffer, but I can't figure out just what it might be.


texts: I have package X installed as a dependency. How can I discover which package pulls it in? ie Reverse Dependency

texts:
I tried to delete package X (in order to try an older built-in version). But when I restart emacs, it's automatically re-installed. package-list-packages lists it as a dependency so that behaviour seems reasonable, actually quite smart. The trouble is, I can't see what other package has created the dependency. I've tried visiting all the 'installed' and most of the 'dependency' packages in (package|paradox)-list-packages but X does not show up as a dependency.

I'd prefer to know how to find out this information, but X is org-plus-contrib-20181230 (I won't be uninstalling this permanently, it's just curiosity).


texts: flycheck on Windows, python-pycompile: "output contained no errors"

texts:
I'm running a hand-built recent trunk build of emacs on Windows. I have flycheck set up, and flycheck-verify-setup in a python-mode buffer shows it's enabled and OK:

Syntax checkers for buffer foo.py in python-mode:

  python-flake8 (disabled)
    - may enable:         Automatically disabled!
    - executable:         Not found
    - configuration file: Not found

  python-pylint (disabled)
    - may enable:         Automatically disabled!
    - executable:         Not found
    - configuration file: Not found

  python-pycompile
    - may enable: yes
    - executable: Found at c:/Program Files/Python36/python.exe

Flycheck Mode is enabled. Use C-u C-c ! x to enable disabled checkers.

--------------------

Flycheck version: 32snapshot (package: 20171214.1215)
Emacs version:    26.0.50
System:           x86_64-w64-mingw32
Window system:    w32

But whenever I create a syntax error in my .py file, I get this error from flycheck:

Suspicious state from syntax checker python-pycompile:
Flycheck checker python-pycompile returned non-zero exit code 1,
but its output contained no errors:   File ".../foo.py", line 4
    import sys,os
         ^
SyntaxError: invalid syntax

And running M-x flycheck-compile with python-pycompile shows it's compiling it fine, and getting the above error as it should, and returning exit status 1.
So why does flycheck think there are "no errors" in that output? Is there a regex somewhere I need to adjust so it treats those lines as error or something?


texts: Multi-term issue with line wrapping for shell but not applications

texts:
I use multi-term within spacemacs for most of my command-line operations.
It works well except some annoying behavior in the shell prompt (zsh but similar for bash) on commands which go over the screen width.

I tried many things without success to fix it but I discovered that if I run the same shell within neovim within multi-term the prompt has no problem.
Of course that is not ideal as I cannot scroll up but it may help to isolate the issue.

See below the behavior (I type "l" repeatedly then backspace):

Spacemacs (0.200.13@26.1, Ubuntu 16.04, same issue with 25.3) configuration related to the terminal

(setq multi-term-switch-after-close nil)
(setq term-suppress-hard-newline t)
(setq term-char-mode-point-at-process-mark nil)
(add-hook 'term-mode-hook '(lambda () (toggle-truncate-lines 1)))

The issue appears regardless of the value of toggle-truncate-lines.

Any idea of what could cause this behavior?

EDIT:
I debugged with (setq term-log-buffer t) and the syntax highlighting in zsh makes things even more complex.
Disabling it, the cursor simply returns to the beginning of the line instead of one line below:

It seems that when the line reaches the screen width, the shell sends ^M^[[K, a carriage return and a line kill, so emacs does as expected.
Not sure why the shell does not return a line feed too.

With bash --norc, the shell sends only ^M at the end of the line so emacs keeps overwriting the same line without erasing it like for zsh.

EDIT2:
Learning more about terminals, the shell behavior seems to be standard.
The issue is then that emacs doesn't properly handle the SPCR sequence in this case.

EDIT3:
Reported as a bug.


texts: How to fix 'Wrong type argument: characterp, 134217782'?

texts:
I'm using Org 8.2 on emacs 24.4, in a Windows 7 machine. Recently I've managed to install cdlatex.el script by saving this file in one of my 'load-paths'. As you may know, cdlatex is a minor mode that can work with Org-mode and helps speed up writing math in Org by the use of keyboard shortcuts. However, when in cdlatex I get this error message:

  Wrong type argument: characterp, 134217782

This error appears in the mini-buffer every time I press the backquote or backtick key on my keyboard (this symbol: `).

Clearly I must add some line in the .emacs configuration file to fix this problem otherwise I'm unable to use 90% of CDLaTeX commands from keyboard. Can someone please help me out? I'm not proficient in elisp (I just copy/paste other folks lines). This is what I've got in my .emacs file regarding tilde and backquote (they respond to the same key, on my laptop's keyboard, see this question for context):

;;; a key for tilde symbol
(define-key key-translation-map (kbd "M-2") (kbd "~"))
;;; a key for backtick symbol
(define-key key-translation-map (kbd "M-6") "")
(define-key key-translation-map (kbd "M-9") (kbd "`"))

Edit 1

The reply to M-x toggle-debug-on-error is:

Debugger entered--Lisp error: (wrong-type-argument characterp 134217782)
  format("No such math symbol %c on level %d" 134217782 1)
  apply(format ("No such math symbol %c on level %d" 134217782 1))
  error("No such math symbol %c on level %d" 134217782 1)
  (if (or (not symbol) (not (stringp symbol)) (equal symbol "")) (error "No such math symbol %c on level %d" char level))
  (let* ((cell (cdlatex-read-char-with-help cdlatex-math-symbol-alist-comb 1 cdlatex-math-symbol-no-of-levels "Math symbol level %d of %d: " "AVAILABLE MATH SYMBOLS.  [%c]=next level " cdlatex-math-symbol-prefix (get (quote cdlatex-math-symbol-alist-comb) (quote cdlatex-bindings)))) (char (car cell)) (level (cdr cell)) (entry (assoc char cdlatex-math-symbol-alist-comb)) (symbol (nth level entry))) (if (or (not symbol) (not (stringp symbol)) (equal symbol "")) (error "No such math symbol %c on level %d" char level)) (if (or (not (texmathp)) (cdlatex-number-of-backslashes-is-odd)) (cdlatex-dollar)) (insert symbol) (if (string-match "\\?" symbol) (progn (cdlatex-position-cursor))))
  cdlatex-math-symbol()
  call-interactively(cdlatex-math-symbol nil nil)
  command-execute(cdlatex-math-symbol)


texts: Dynamic block columnview and column width

texts:
I collect propoerties of my titles in a columnview dynamic block. But it seems to ignore the width settings from the #+COLUMNS:

Example :

#+COLUMNS: %20ITEM(Projet) %10lead(Meneur)

#+BEGIN: columnview :maxlevel 2 :id global :maxlevel 2
#+END

The Project columns is very large and i'd like to shrink it.
Putting a <20> inside of the dynamic table will not survice a block update.

Any idea ?


texts: Org-mode: customize delimiter for horizontal line in tables


texts: Icicles showing user-error message in echo area during TAB-completion

texts:
i have a strange behaviour of my emacs (25.1.1) running in cygwin within a terminal window (mintty 2.7.3). Every time when doing TAB-competion (eg. M-x describe-func) I got following messages in the echo area:"user-error: Cannot decrease the default face height more than it already is". I can not debug that kind of error, because it is an user-error. All modifications, which are related to "set-face-attribute" were commented one by one and new reloaded. I already tried to set debug-ignored-erros to nil, but no success.

After a bit research:
I am using icicles and i found out it has something to do with the face configuration of icicles completion menu. The hook which narrow down the selecetion appropiately to user input kicks that user-error in the echo area by pressing TAB-key.
But setting all faces used in that completion menu to a high value of 110pt doesn't gave me the result.

After a bit more research:
Setting in icicles icicle-show-Completions-initially-flag or icicle-incremental-completion to t for having an ido-completion feeling then the icicle command completion combined with the output of above mentioned user-error message every time you extend your input (no TAB-Key) makes icicles in that way useless. By the way the error message has changed with these settings to "icicle-execute-extended-command: Cannot decrease the default face height more than it already is", but any way it means the same.

For any hints, background information I would be very thankful.
Falk


texts: Magit - "user" in Branch / Create from Pull Request

texts:
I've been using Magit for a long time, but finally read the manual, and started playing in the deep water. Not sure how to fix what I did...

I tried b Y (Branch / Create from pull request). It asked me for a GitHub id, which seemed strange, but OK, so I entered my email address. Nothing happened, so I tried the command again and it warns me about creating a GitHub API Token.
Presumably I put in the wrong thing for the username. How do I undo this, and how is this command supposed to be used?


texts: Regex search: Why C-M-s does not seem to work like other keystrokes?

texts:
The purpose of this question is primarily to serve my curiosity, but it can maybe save some time for others who may press C-M-s (isearch-forward-regexp) just like they would press C-s (isearch-forward), but who would see nothing happening.

In fact, when I press C-M-s just like I would for any other keystroke, nothing happens, and I lately figured out I had to hold it pressed for about half a second for it to work.

This is also the case if I want to get the description of C-M-s using C-h k.

What is the reason for that? Is it related to my configuration?


texts: org-habit: Any way to mark "skip" for this day?

texts: Sometimes the habit is just temporarily inapplicable. For example you set a habit to clean your house once a day, however say you're out for vacation for 2 weeks, obviously you can't clean your house then, resulting in a false break. In some habit-tracking apps there's an option to "skip" certain days in the chain. Is there a way to achieve that in org-habit?


texts:
Are there reflection methods available in elisp to examine the stack without invoking the debugger?

For example:

Get the calling/callee function
Get the function call stack
Get the (longer) nested statement stack
Get arguments for any of the above

An aside: In my search for applicable features/functions/variables I was surprised to learn that elisp does not (natively) perform tail call optimization!  Presumably elisp does then maintain a complete stack.


texts: How to prefer to break long file names (in neotree directory listings) over fitting the whole word on the next line?

texts:
How can you make long words (here: file names) break e.g. at hyphens?
I'm looking for a way to make my neotree directory listing not break after the icon. I'm fine with both not breaking but truncating file names, and breaking at hyphens or anywhere else in between. Would be nice if the first character of each file name would align on the same column.
I tried variable-width mode to make more horizontal space, but it's still too crammed :)

Currently active minor modes in that buffer:
Enabled minor modes: Auto-Composition Auto-Compression
Auto-Dim-Other-Buffers Auto-Encryption Beginend-Global Blink-Cursor
Buffer-Face Column-Number Delete-Selection Emojify File-Name-Shadow
Global-Edit-Server-Edit Global-Eldoc Global-Emojify Global-Font-Lock
Global-Visual-Line Ivy Line-Number Menu-Bar Mouse-Wheel
Override-Global Projectile Recentf Shell-Dirtrack Show-Paren
Text-Scale Tooltip Transient-Mark Visual-Line

(I tried disabling visual-line-mode, didn't help.)


texts:
I've encountered a problem after upgrading Emacs Speaks Statistics (ESS) from MELPA today to ess-20180926.54.

When I try to start an R session under Emacs with M-x R I'm informed...

autoload-do-load: Wrong type argument: consp, nil

...and the session doesn't start.

The settings I have for ESS are...

;;; ESS
(require 'ess)
;;; Some generally useful key-bindings (mostly ESS specific)
(define-key global-map [f1] 'Control-X-prefix)
(define-key global-map [f2] 'save-buffer)
(define-key global-map [f3] 'find-file)
(define-key global-map [f5] 'switch-to-buffer)
(define-key global-map [f6] 'other-window)
(define-key global-map [f8] 'kill-buffer)
(define-key global-map [f9] 'ess-load-file)
;;; Other specific ESS settings you can use are the following:
(setq comint-input-ring-size 1000)
(setq ess-indent-level 4)
(setq ess-arg-function-offset 4)
(setq ess-else-offset 4)
(setq ess-eval-visibly-p nil)
;;; Set the width of the buffer automatically
(defun my-ess-post-run-hook ()
  (ess-execute-screen-options)
  (local-set-key "\C-cw" 'ess-execute-screen-options))
(add-hook 'ess-post-run-hook 'my-ess-post-run-hook)
;;; Auto-complete and ESS
(require 'auto-complete)
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/site-lisp/auto-complete/dict")
(ac-config-default)
(auto-complete-mode)
(setq ess-use-auto-complete t)
;;; Smart underscore  https://www.emacswiki.org/emacs/ess-smart-underscore.el
(require 'ess-smart-underscore)

Emacs is 25.3.1

A bunch of other MELPA packages were updated and old versions removed but I didn't note down which.

Any ideas or pointers welcome, if more information is required please let me know.

EDIT :

I've obtained the following debug traceback...

Debugger entered--Lisp error: (wrong-type-argument consp nil)
  byte-code("\301\30\"\303\241\210\301\30\"\305\241\210\306\307\300\"\207" [ess-r-customize-alist assoc ess-font-lock-keywords (quote ess-R-font-lock-keywords) inferior-ess-font-lock-keywords (quote inferior-ess-r-font-lock-keywords) defalias R-customize-alist] 3)
  autoload-do-load((autoload "ess-r-mode" "Call 'R', the 'GNU S' system from the R Foundation.\nOptional prefix (\\[universal-argument]) allows to set command line arguments, such as\n--vsize.  This should be OS agnostic.\nIf you have certain command line arguments that should always be passed\nto R, put them in the variable `inferior-R-args'.\n\nSTART-ARGS can be a string representing an argument, a list of\nsuch strings, or any other non-nil value.  In the latter case, you\nwill be prompted to enter arguments interactively.\n\n(fn &optional START-ARGS)" t nil) R)
  command-execute(R record)
  execute-extended-command(nil "R" "R")
  funcall-interactively(execute-extended-command nil "R" "R")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)


texts: Code block evaluated when exporting, not when publishing

texts:
I have this basic org publishing project to test that code blocks evaluation is triggered by publishing in html (org-html-publish-to-html).
While exporting through org-mode export dispatcher does evaluate code blocks automatically, publishing does not.

Here the content of the only file of the project, test.org:

#+NAME: ls
#+BEGIN_SRC sh :export results

echo $(ls)

#+END_src

#+RESULTS: ls

I publish the website running:

emacs --batch --no-init-file --load publish.el --funcall org-publish-all

with this publish.el:

(package-initialize)
;(require 'org)
(require 'ob-tangle)
(require 'ox-publish)
(require 'ox-latex)
(require 'ox-html)

(setq org-confirm-babel-evaluate nil) ; don't ask for confirmation before evaluating a code block
(setq org-export-babel-evaluate t)
(setq org-export-use-babel t)

(setq org-publish-project-alist
      `(("test"
         :recursive t
         :base-directory "."
         :base-extension "org"
         :publishing-directory "./public"
         :publishing-function org-html-publish-to-html
         :section-numbers nil
         )

        ))

(I also tried :results html and :results output with no more luck)

This is a toy test because I ran into the problem while building a website. I didn't see anywhere that publishing would not evaluate code, anyone has any info on that ?

It has been seen locally on my laptop as well as on a distant gitlab repo, the publishing process being ran on the distant git server.

GNU Emacs 24.5.1 / Org mode version 9.0.3 / Debian Jessie


texts: Adding a new project type to Projectile Mode

texts: I would like Projectile Mode to recognize other projects besides the default ones (GIT, Maven, etc.) The README.md describes how to customize project root files, however it doesn't explain how Projectile learns what files belong to a project once it has found a project root file.  Therefore, what are the steps needed to configure a custom project root file?


texts:
I am currently using Webstorm as my daily driver but I am trying to look into Emacs and possibly transition.

One of the most important things to me that I have spent the last 3 years on was to configure the code highlighting (especially JS and TS) to my liking.

I do not like the default whatsoever in either emacs or Webstrom.

Is there an (easy) way to transform any configurations that I have made in Webstorm to Emacs?


texts: How can I change the color of a \enquote quotation inside Emacs?

texts:
When I paste a text inside quotation marks into Emacs+AUCTeX, AUCTeX formats it with a soft red color (see the screenshot below at the first line).

I like this color. However, I'm using csquotes package to handle (multilingual) quotations marks. The \enquote commands (provided by csquote package) use another color. I don't like this last color (see screenshot at the second line). With this ugly soft green color, I cannot find quickly quotation inside a big document.

How can I change csquotes default color to use AUCTeX default one?

The screenshot:

(This screenshot uses French quotation marks but it hasn't any influence on my question.)

There is a bunch of settings about fontification in the csquotes.el file but I didn't see any reference to colors:

  ;; Fontification
   (when (and (featurep 'font-latex)
          (eq TeX-install-font-lock 'font-latex-setup))
     (font-latex-add-keywords '(("DisableQuotes" "")
                ("RestoreQuotes" ""))
                  'function)
     (font-latex-add-keywords '(("enquote" "*{")
                ("foreignquote" "*{{")
                ("hyphenquote" "*{{")
                ("textcquote" "*[[{[{")
                ("foreigntextcquote" "*{[[{[{")
                ("hyphentextcquote" "*{[[{[{")
                ("textquote" "*[[{")
                ("foreigntextquote" "*{[[{")
                ("hyphentextquote" "*{[[{")
                ("blockquote" "[[{")
                ("foreignblockquote" "{[[{")
                ("hyphenblockquote" "{[[{")
                ("blockcquote" "[[{[{")
                ("foreignblockcquote" "{[[{[{")
                ("hyphenblockcquote" "{[[{[{"))
                  'textual)
     (font-latex-add-keywords '(("setquotestyle" "[{")
                ("MakeOuterQuote" "{")
                ("MakeInnerQuote" "{")
                ("MakeAutoQuote" "*{{")
                ("MakeForeignQuote" "*{{{")
                ("MakeHyphenQuote" "*{{{")
                ("MakeBlockQuote" "{{{")
                ("MakeForeignBlockQuote" "{{{{")
                ("MakeHyphenBlockQuote" "{{{{")
                ("DeclareQuoteStyle" "[{[[{[{[{[{")
                ("DeclareQuoteAlias" "[{{")
                ("DeclareQuoteOption" "{")
                ("DeclarePlainStyle" "{{{{")
                ("SetBlockThreshold" "{")
                ("SetBlockEnvironment" "{")
                ("SetCiteCommand" "{"))
                  'variable)))))

;;; csquotes.el ends here


texts:
I'm trying to configure AUCTeX for LuaLaTeX, and compiling works fine with this additions in my .emacs:

(defun my-latex ()
  "Latex mode customizations"
  (auto-fill-mode t)
  (reftex-mode t)
  (TeX-engine-set "luatex")
  (setq TeX-electric-math (cons "$" "$") ) ; auto close dollars
  (setq TeX-electric-sub-and-superscript t) ; use _{} instead of _
  (setq font-latex-fontify-script 'multi-level) ; 2^2^2 as multiple scripts
  ;; Use zathura for previews
  (setq TeX-PDF-mode t)
  (setq TeX-source-correlate-mode t)
  (add-to-list 'TeX-view-program-selection '(output-pdf "Zathura"))
  ;; Hide some boilerplate
  (TeX-fold-mode 1)
  ;; Big faces for sections, chapters, etc.
  (set-face-attribute 'font-latex-sectioning-1-face nil
                      :foreground "#ffcc66" :height 1.5 :bold t)
  (set-face-attribute 'font-latex-sectioning-2-face nil
                      :foreground "#ffcc66" :height 1.2 :bold t)
  (set-face-attribute 'font-latex-sectioning-3-face nil
                      :foreground "#ffcc66" :height 1.2 :bold nil)
  )
(add-hook 'LaTeX-mode-hook 'my-latex)

But if I use preview-latex with C-c C-p C-s, it fails with error in process sentinel: Opening input file: No such file or directory, /tmp/_region_.prv/tmp20357KF2/preview.ps. The file that I'm trying to preview is

\documentclass[a4paper]{article}

\begin{document}
\section{Foo}
\begin{equation}
f = b^{4}
\end{equation}
\end{document}

What should I change in my .emacs to make latex-preview work? Ideally, with Unicode input.


texts: How to determine the line number of the first visible line of a window?


texts: How to set tabulator size in the awk mode?

texts:
After installing a new kubuntu (16.04) and emacs (25.2.2) I have had indentation problems. It seems like indentation default values have changed or maybe I am missing some configuration file? Unfortunately, I don't know which version of emacs I had in my previous kubuntu 14.04, where everything was still fine (like the past 25 years in different unix and linux environments).

I don't know lisp and I have never before needed to customize emacs, but I have looked at instructions and managed to fix some problems by editing .emacs. Now I would like to set the tabulator size to 2 in the awk mode. (In C mode it is 2 by default as I wish.)

I tried to add the following to my .emacs:

;;set awk tabulator size
(add-hook 'awk-mode-hook
(lambda () (setq indent-tabs-mode t) (setq tab-width 2) (setq awk-indent-offset 2)))

but it has no effect. This was modified from an example how to set the tabulator size for python mode.

Do you know what is wrong here? Or is there some other place where to modify the awk mode?


texts: replacing regular expressions with querying on and functions on match

texts:
EDIT: gave more context for my first approach.

My goal is to search my notes for strings of the form "4/1/2014" to org-mode timestamps "<2014-04-01 Wed>" (that particular day-of-week may be incorrect). I also want querying to be on so I do not accidentally do things like replacing part of a URL this way.

Assuming I already wrote a Day-of-the-week function (complaints welcome, though not part of the main question):

(defun dow (year month day)
  (interactive)
  (let ((encoded-time (encode-time 1 1 10 day month year)))
    (nth (nth 6 (decode-time encoded-time))
     '("Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat" "Sun"))))

I seem to be unable to do the rest. Here are my attempts and when they fall short:

First, I tried to use query-replace-regexp:

(defun date-replace ()
  (interactive)
  (goto-char 1)
  (query-replace-regexp "\\([0-9]+\\)/\\([0-9]+\\)/\\([0-9]\\{4\\}\\)"
            "<\\3-\\1-\\2 \\,(dow (string-to-number \\3) (string-to-number \\1) (string-to-number \\2))>"))

I get an "invalid use of '\' in replacement text" error and do not know what to do with that even after googling; it seems the most likely cause is escaping something in the replacement string that's NOT '\', but I do none of that.

By the way, doing

M-x query-replace-regexp RET \([0-9]+\)/\([0-9]+\)/\([0-9]\{4\}\) RET <\3-\1-\2 \,(dow (string-to-number \3) (string-to-number \1) (string-to-number \2))> RET

works, which is why I thought all I had to do was to escape the backslashes.

(another problem with this approach is it does not 0-pad 1-digit numbers in a way that seems clean to me, even if everything else were to work)

Then, I tried to use search-forward-regexp. Here's a clunky solution that works (replacing the relevant portion of above code):

(while (search-forward-regexp "\\([0-9]+\\)/\\([0-9]+\\)/\\([0-9]\\{4\\}\\)" nil t)
  (let* ((ynum (string-to-number (match-string 3)))
       (mnum (string-to-number (match-string 1)))
       (dnum (string-to-number (match-string 2)))
       (dowstr (dow ynum mnum dnum)))
    (replace-match (format "<%04d-%02d-%02d %s>" ynum mnum dnum dowstr) t nil)))

The only problem here is that it does not query, and there does not seem to be flags that allow me to do that.

My final attempt is looking up query-replace and the manual suggesting using perform-replace. So here I have:

  (perform-replace "\\([0-9]+\\)/\\([0-9]+\\)/\\([0-9]\\{4\\}\\)"
           ((lambda (data numreps)
              (format "<%04d-%02d-%02d %s>" (nth 1 data) (nth 2 data) (nth 3 data)
                  (dow (nth 1 data) (nth 2 data) (nth 3 data))))
            .
            ((string-to-number (match-string 3))
             (string-to-number (match-string 1))
             (string-to-number (match-string 2))))
           t t t)

and I get "Wrong type argument: stringp, nil" that I cannot decipher.

While my immediate goal is to find out which type of solution is the correct way to proceed and to make it work, I am overall more interested in why these bugs occur and how to get better at debugging, as I am new to learning elisp. Thanks!


texts: Emacs not asking for password for .gpg file

texts:
Have recently upgraded to Ubuntu 18.04 which required an emacs reinstall of version 24

Now I've noticed that my symmetrically encrypted org mode file (file.org.gpg) no longer requires me to enter the pwd when opening.

Clearly its caching it somewhere now, but where and for how long?

Every now and then, it will prompt for pwd

I don't really want this behaviour, would rather enter pwd every time

I've checked epa-file-cache-passphrase-for-symmetric-encryption and its set to nil

Have also taken a look in ~/.gnupg but therese no gpg-agent.conf file in there

So don't really have a clue where that pwd is being cached and how you can control that caching


texts: How to create calendar entry for last weekday of every month?

texts:
At the last weekday of the month I want to be reminded to prepare
invoice/expenses so I get them filed by the first. It's no use just
getting reminded on the last day of the month, if this is a Saturday
or Sunday. Nor do I want to be reminded several days before the end
of the month, so using diary-float is not applicable.


texts: imenu to copy the target instead of jumping to it?

texts:
Is it possible to use imenu (or another package) to copy the target (specified by a regex) rather than jumping to it?
This is an effort for tackling the question: How to list or autocomplete pandoc-crossref citations in an org-mode buffer?
I'd like to find all labels in the buffer that match a certain regex pattern. Then, instead of jump to that label, I'd like to copy it to the current point. Is this possible with imenu or similar packages?
Related:
How to use a menu to jump between sections of a document?
Get all regexp matches in buffer as a list
-- UPDATE --
To clarify what I was looking for with a minimal example:
I have the following packages installed for the auto-completion:
ivy ivy-hydra imenu imenu-anywhere counsel swiper

and then (require 'imenu) (as suggested).
Now in a buffer with two lines:
aaa
bbb

and the cursor at the third line, I'd like to use the regex aaa to insert the text aaa at the point. E.g. by :
imenu-match-insert('aaa')

I am using a trivial regex, but for a real one, I'd like to use imenu and the minibuffer to select from the list of all labels in the current buffer (before and after the point) that matches the regex.


texts: ESS R workflow with package management in renv (or Packrat)

texts:
I do all my R development in Emacs via org-mode and ESS. All of my R projects are managed out of a single org-mode document (studies.org). Each project has a header and is tangled to its own project directory. This looks something like:

* A study in R
  :PROPERTIES:
  :header-args: :tangle ~/org/studies/study_in_R
  :END:

  #+BEGIN_SRC R :session *R* :dir :results silent

  setwd("~/org/studies/study_in_R")

  #+END_SRC

As I develop each project, I build functions that get moved to my function library (code.org). This gets tangled each time I save it and contains every (reusable) function I have ever written. It looks something like this:

* AppleScript
* Emacs Lisp
* Python
* R
  :PROPERTIES:
  :header-args: :tangle ~/Code/R.R
  :END:

  * Function 1
  * Function 2
    ...
* Shell
* Settings

Recently, I discovered Packrat and its successor renv. I love the idea of ring-fencing my projects into virtual environments. But I'm struggling with the implementation.

So here are a couple of questions:

What is the best way to migrate my legacy R packages into the renv packages cache?
And what about my R function library? Should I tangle this into one giant omniverse which gets installed into all of my R projects? Or would that defeat the purpose of segmenting my packages? If I leave it as is (tangled to ~/Code/R.R and loaded through .Rprofile) is renv smart enough to pick out library() calls from different functions that my projects reference from R.R?
If I am developing my code in studies.org (which is not in my projects directory) and this is referencing additional functions from code.org (also not in my projects directory) how does renv::hydrate() know to auto-add dependencies to my project? Do I need to tangling r projects to their respective project folders first?
There are some packages that I may want to share with all projects (roxygen2, devtools, usethis, etc.). How should I install these to my packages cache? And how should I reference them in my projects? Can I identify a default or base set of packages that are auto-added to every project? If I just install these with install.packages() will this get the job done?
How do I manage multiple versions of R? pyenv does a fantastic job of managing multiple versions of python. And conda conveniently treats python and R as any other package... If I want a specific version of R in my project, is there a way to renv::install(r@3.4.4)?


texts: desktop-save-mode fails to save window layout

texts:
I use Emacs 24.5.1 on OS X in terminal mode.

I intend to use desktop-save-mode to save and restore window layout (i.e. positions of buffer windows) upon exiting and starting Emacs.

From this answer and its comments, people suggest that recent versions of Emacs does save and restore window layout when desktop-save-mode is enabled. However, when I exit Emacs with two side-by-side windows each containing a file buffer, only the last active buffer (the one where the cursor last rested at) is restored upon restarting Emacs.

My relevant configurations are:

(setq desktop-auto-save-timeout nil
      desktop-save 'ask-if-new
      desktop-dirname "./"
      desktop-path (list desktop-dirname)
      desktop-load-locked-desktop nil)
(desktop-save-mode 1)

I've checked the value of variable desktop-restore-frames, and Emacs reports "Its value is t", and its description says "When non-nil, save and restore the frame and window configuration".

I also use perspective.el, but I am not sure if it is related to the problem.

I wonder if the problem is caused by some conflict with other package/settings, and if possible, how do I detect and resolve such conflict.


texts: Search and replace invisible url link in org-mode

texts:
I have following content in a org file:

* test
[[file:foo1.pdf][test file1]]
[[file:foo2.pdf][test file2]]
[[file:foo3.pdf][test file3]]

Normally, the file name (eg foo1.pdf) is folded and invisible. And when I do a search for foo (with ctrl-s), I can't find anything... How can I enable the isearch for those invisible text? I tried M-s i on the isearch command and it does not work.


texts: How to set indentation style substatement-open offset parameter from .dir-locals.el?

texts:
Within CC mode, for C and C++ files inside a directory, I'd like to have the open braces following a case/do/for/if/while not indented, whatever the style is and without having to change anything in .emacs (in particular creating a global new style).

I've found I have to set substatement-open to 0 in c-offsets-alist for the buffer.

In .dir-locals.el, I've tried to modify c-offsets-alist, either directly:

((nil . ((eval . (add-to-list 'c-offsets-alist '(substatement-open . 0))))))

Or by using c-set-offset:

((nil . ((eval . (c-set-offset 'substatement-open 0)))))

Then I've tried to use c-file-offsets, still in .dir-locals.el:

((nil . ((c-file-offsets . ((substatement-open . 0))))))

But none seems to work.

How I can set substatement-open to 0 from .dir-locals.el for C and C++ mode ?


texts: Editing files with one-sentence-per-line

texts:
A bit of background.

I’m trying to version-control my latex documents, and the
effectiveness of this initiative would be greatly improved if I adopt
a one-sentence-per-line approach.

For instance, the following is what my documents will look like.

Some text here.
New stencence on the same paragraph.
Some more text, still on the same paragraph.

This is another paragraph.

My question is simple.
How much of that can I automate/improve with Emacs?

The following two points are what I have in mind.

My sentences are long, so I need to wrap lines without actually
filling them. That is, a very long sentence needs to be displayed
over several lines on my screen, but it needs to be a single line
in the “.tex” file. This would preferably be done in a way that
doesn’t wrap equations.

visual-line-mode wraps at window width, that is too wide. I need
something that wraps lines and limits their width to 80 or so
characters. Just like fill-paragraph would normally do, but
without actually breaking the lines in the file.
I can manually break the line after each sentence, but it would be
highly preferable if I could configure fill-paragraph (or maybe
even auto-fill-mode) to put one sentence per line as well.


texts: Command to Run (Eval) "Hello World" in ELISP on Eshell?

texts:
I am new to Emacs and ELISP

A file (message "Hello World") saved as hello.el.
Now, how to run (evaluate) this file on  Eshell?

~/Documents $ ....... hello.el


texts: How do I disable menu-bar-mode only for tty frames?

texts:
I run both gui frames and tty frames on the same server. I'd like to only have the gui frames have the menu-bar and I want all tty frames to not have a menu bar.

I'm confused by the menu bar docs, is there a way to do this?


texts: is byte-compile-dynamic compatible with use-package?

texts:
If I'm using use-package in a file that I plan to byte-compile, can I still leverage Emacs' byte-compile-dynamic setting to lazy-load compiled function definitions? From the Elisp manual:

  With dynamic function loading, loading the file doesn’t fully read the function definitions in the file.  Instead, each function definition contains a place-holder which refers to the file.  The first time each function is called, it reads the full definition from the file, to replace the place-holder.

So, for example, if my init.el loads a file,

(require 'my-persistence (concat user-emacs-directory "my-persistence")

in which I've put persistence-related settings,

(use-package savehist
  :commands savehist-mode
  :config
  (setq savehist-autosave-interval 60)
  (defun foo () ...)
  (defun bar () ...)
  (defun baz () ...))

(provide 'my-persistence)

I could add -*-byte-compile-dynamic: t;-*- to the top of that file, in hopes that lazy-loading the compiled function definitions of foo, bar, and baz reduces the time spent evaluating the :config section.

I imagine it playing out like:

my-persistence.elc is loaded
user calls savehist-mode
savehist package is loaded
:config section is evaluated
savehist-autosave-interval is set to 60
lazy-loading defers the full definitions of foo, bar, and baz
user calls foo
foo's full definition is loaded

I tried it out, and :config still behaves as expected, but I don't know how to check whether foo, bar and baz are in fact being lazy-loaded.


texts:
Using Rust/Racer/Eldoc is causing performance problems while navigating around the file (hanging while eldoc is fetching the docs).

Running eldoc-mode reports that it's disabled but still runs Racer's eldoc function.

Is there a way to globally disable eldoc?


texts: Emacs Terminal vs Emacs GUI: different look & feel for the same theme

texts:
Whenever I install a theme, I notice it odes not appear exactly the same way on Emacs Terminal and Emacs GUI.

For example, I installed this theme recently, and it behaves as the previous ones I installed:

In this situation, for example, I prefer the look and feel shown on the right picture above. I do not use the GUI version of Emacs though, so I would like to get what I see on the right picture, in the Terminal version of Emacs.

Is this a normal behavior?


texts: wrong behavior of org-open-at-point with certain url

texts:
NOTE, this only happens on mac. Linux is fine.

For the given link, which is directly copied from chrome url bar,

https://lwn.net/Articles/262464/#Quick Quiz 5

org-open-at-point will open it as https://lwn.net/Articles/262464/%23Quick%20Quiz%205

where as the correct url should be: https://lwn.net/Articles/262464/#Quick%20Quiz%205

note that in the wrong one, # becomes %23.


texts: How can I get swiper to remember the last search I ran?

texts:
Sometimes I do a search with swiper and navigate to a location in the code that seems like what I was searching for, only to find it wasn't. This is more common with a symbol name that is a little too generic.
I'd like to simply restart the search, but I have to type the full symbol again.
I could copy/yank the symbol, which would be fine, but even that could be automated, as in: "search for thing under point." I'd probably want that too, but first thing: I'd just like to repeat the previous search.
How can I do that without having to re-type the criteria?  Or have swiper remember the last search?


texts: Go to start of search string after `RET`

texts:
What's the best way to move point to the start of an isearch result instead of the end?

E.g. given the following, where | is point:

|foo bar baz

And searching for bar, I'd like point to be at:

foo |bar baz

instead of

foo bar| baz

The latter is almost never useful.


texts:
When I run (+ 1 1) using eval-print-last-sexp in a buffer, this function inserts a newline and outputs 2. I'd rather its output were just ' 2' (space and 2).

How can I change this?


texts: Interactive terminal solution for Emacs on Windows?

texts:
I recently tried to move from over to Emacs but hit a brick wall while trying to setup a terminal. While shell and eshell work fine, they are not really interactive so you can't really run things such as gdb or vim. There's term and ansi-term, but from online research, it appears as though they don't work on Windows. I get Spawning child process: Invalid argument error whenever I try to run either of those.
I was hoping maybe to use vterm, except it's not available on Windows. Although, I did manage to compile it on MSYS2, but the MSYS2 version of Emacs has no GUI, only terminal.
Can anything be done?


texts: File-local variable to force specific shell for shell-script major mode

texts:
I'm having the same problem as asked in this question: emacs is dropping into shell-script mode, but for the wrong shell variant.

Using a shebang as suggested in that question's answer is semantically incorrect: most of my files are meant to be sourced, rather than run. The same applies for adding file extensions.

Normally, I use the mode file-local variable:

# -*- mode: shell-script; -*-

but this always drops me into shell-script[bash] mode. Is there any way to force tcsh, csh, bash, or sh modes with a file-local variable?

Minor sub-question: is there a specific name for modes that distinguish between specific shell flavors? Not knowing the right verbiage makes this tough to Google.


texts: Function that does `M-x replace-regexp` or `M-x occur` with a fixed pattern and replacement strings

texts:
I often use M-x replace-regexp and M-x occur with some fixed regexp pattern and replacement string on many files.

Doing it manually by opening each file in an Emacs buffer and hitting the keys is very tedious. I was wondering how to write an Elisp function to use as a script, which I can apply to each file?


texts: What happens if variable changed through customize is later changed by package maintainers?

texts:
For example, lets say a package defines a variable foo: (A B C), but through customize, I remove C from the list. Now the variable foo is (A B). What happens if later, the package maintainers change the variable foo so that it is now (A B C D). Will my setting in customize continue to be respected? If so, how will I ever no that this list now includes more members?

If that was a little too unclear, here is the actual use case: I have removed elpy-module-yasnippet from the list elpy-modules as suggested in the comments to this question. Since the list of modules is now explicitly defined in my customizations file, does this mean that if elpy someday adds new and exciting modules, by default I will not have them?


texts: Evil - how to set up keychords for Web-mode only?

texts:
I have the following setup for using comments:

(key-chord-define evil-normal-state-map "cc" 'comment-dwim-2)

This works fine. I can type cc to comment it out or comment out.

However, Web-mode works with an another function, because the comment syntax are differrent for languages like javascript or HTML. So I set up following keybinding for only web-mode in my setup:

(evil-define-key 'normal web-mode-map
  (kbd "cc") 'web-mode-comment-or-uncomment
)

But with the setup above I cannot use other Evil keybindings like cw or ctf anymore, because the keybinding above disabled them. Any suggestion for a way to use keychord in the evil-define-key, but for web-mode only? So that I can use another keys with operator c again, in web-mode only.


texts:
I'm thinking of writing one so that when I get those horrible tracebacks from bytecode files, I can better see where I was at.

Is there one already?

Are there any other tools for showing an error traceback in more Elisp programmer terms rather than computer- (not-human)-oriented elisp bytecode?

Edit: For what it's worth, I've started this on github

It seems to work find on the subset of things I've put in so far. So the two major items are to fill it out more which I have been doing slowly, and covert it all to Emacs Lisp from Python. (That too seems straightforward, just a bit of work.)


texts:
I just got started with Emacs for around 1 week or so and I have the following question: can I make Auto Complete ignore a certain word (in a certain major mode)?

Concrete example: I was writing in a file in Org mode a sort of "tutorial" for my use and I wrote about the <sTAB command which inserts a code snippet. Now whenever I open a file in Org mode and write <s, it offers the completion.

As I prefer commiting completions with the TAB key, my only choice is to C-g the completion list and then TAB.

Moreover, I think that this could serve me well for other cases also. So is it possible to make auto-complete-mode always ignore a certain word in a certain major mode?

If it's difficult enough to implement, where can I find the actual list of completions which is created? I could visit it and erase <sTAB. I'll never write it again. :)


texts:
I try to use alert and copy the example from here as below:

scratch buffer:

(require 'alert)

;; This is the most basic form usage
(alert "This is an alert")

;; You can adjust the severity for more important messages
(alert "This is an alert" :severity 'high)

;; Or decrease it for purely informative ones
(alert "This is an alert" :severity 'trivial)

;; Alerts can have optional titles.  Otherwise, the title is the
;; buffer-name of the (current-buffer) where the alert originated.
(alert "This is an alert" :title "My Alert")

;; Further, alerts can have categories.  This allows users to
;; selectively filter on them.
(alert "This is an alert" :title "My Alert" :category 'debug)

After eval-buffer, it seems nothing happens.

I am not sure what should I expect after evaluate the alert function?


texts: can I use .dir-locals.el to set a default mode for files, and still allow dired?

texts:
I have a directory that is all little shell code snippets for being sourced.

Tried creating an auto-mode-alist, that does not seem to be effective, so tried creating a .dir-locals.el thusly:

((nil . ((mode . sh))))

which does indeed, set the mode of all files to sh-mode.

However, now cannot run dired, get this message:

dired-readin: Wrong type argument: stringp, nil

What should I do to allow dired to run normally in this dir?

Related: How to set major mode for a file in .dir-locals.el?

Or, to rephrase the question, can specific files, not subdirs be specified, so as to only apply to those files?  IOW, not dot files?

Addendum

This was the auto-mode-alist attempt:

(defvar home-lib
  `,(concat (substitute-in-file-name "$HOME/lib") "/.*\\'")
  "Regexp for auto-mode-alist to find anything in ~/lib to be a sh-mode file.")

(add-to-list 'auto-mode-alist `(,home-lib . sh-mode))


texts: How to customize background color for some web pages opened with eww?

texts:
I just installed emacs 24.4 and I've started using eww. But one annoying thing is that when I visit google.com I get a grey background which makes text really hard to read for my theme.
This is how it looks:
Is there any way I could change the color of the background? I first thought I could customize eww faces but there is no option for this. I'm also curious why is this background color there, in the first place.


texts: Using diff-buffer-with-file to merge differences between the disk and the buffer

texts:
I sync my org files via Dropbox. Occasionally, Dropbox will bring in changes into a file whose buffer I've already modified. I can diff the buffer and the file on disk with diff-buffer-with-file; but then what?

Theoretically it's a diff minor mode file, so I should be able to use diff functions such as (diff-apply-hunk), but in practice a get an elisp stack trace.

What am I doing wrong? Is there a better approach?


texts: Why does (format "%x" some-large-number) produces incorrect results?

texts:
I wanted the hexadecimal string for a large integer such as below:

(format "%x" 2738188573457603759)

This returns 2600000000f95c00 which is incorrect, it should be 2600000000f95caf.

The value of most-positive-fixnum on my box is 0x1fffffffffffffff which is less than the number I'm supplying above.

As a user I'm a bit baffled what is happening.  The manual indicates integers larger than this range are converted to a floating-point number which is a concern for precision but I suspect this is what is biting me here?

I should have known there was an issue with this number since normally I evaluate them directly using eval-last-sexp and it didn't show the octal/hex variants.. :)

I wonder why Emacs Lisp doesn't support bignums, so precision would not be an issue?


texts:
When I run M-x compile it spawns a new subshell to execute my compile command. As soon as the compile command returns, the shell process is killed. I can see why this would be desirable in most cases, but I am currently in a situation where it is not helpful.

I am working in a specialized build environment right now which requires that I take some initial steps to setup the build before running the compiler. As long as the environment persists,I only need to do the setup steps once. But when I use M-x compile it means that I have to do the steps each time I want to compile or recompile.

Is there a way that I can spawn a subshell that will persist in the background? One that M-x compile and M-x gdb can use each time they need to run a shell process?

Motivation:

I have a program (which we will call xcc) which builds C code for special platforms. In order to build my code, I first start xcc from the tcsh prompt:

$ xcc

The program takes 10+ seconds to load, and then I can enter commands at its interactive prompt

xcc>> add target myprogram
xcc>> set source myprogram $PROJDIR/src/
xcc>> set includes myprogram $PROJDIR/include/
xcc>> set type myprogram primitive
xcc>> set inputs myprogram int8,int8
xcc>> set outputs myprogram fix16,fix16
xcc>> build myprogram

The above steps can be built into a custom macro buildmyprog.macro so that I can run it directly from the shell, or from emacs with M-x compile

$ xcc buildmyprog.macro

The main problem with this approach is the fact that it takes the xcc program 10 seconds to load, before compilation even begins. I got tired enough of waiting the extra 10 seconds every time I compiled that I have started running xcc in an ansi-term in a separate buffer. Now after I modify and save the code, I switch over to the ansi-term buffer and run

xcc>> build myprogram

This works fine, but every time I switch over to that buffer I think, "Wouldn't it be great if I could just push F7 and my compile command would get sent to the already-running instance of xcc?"


texts: Saving a file with GPG hangs Emacs with *Minibuf-22*

texts:
I open a GPG encrypted file and am prompted for the password. I open it, edit it, and when I save it, I am prompted for the password again. I start typing and Emacs hangs with this screenshot:

Scrolling down has no effect, no shortcut has any effect, and I have to force-quit Emacs. I started using GPG to edit files today, had a different problem in my first attempt with these messages in the mini-buffer and in *Messages*:

error in process filter: font-lock-default-function: Variable binding depth exceeds max-specpdl-size
error in process filter: Variable binding depth exceeds max-specpdl-size

In this first attempt, I could quit with C-g and Emacs didn't hang. I succeeded in my second attempt (with two prompts for the password, the second for confirmation), and failed in attempts after that.

I have GPG 2.2.17, Emacs 26.3, and macOS 10.16.4. My Emacs initialization has:

(require 'epa-file)
(epa-file-enable)
(setq epg-gpg-program "/usr/local/bin/gpg")

What is the problem, and should I follow a better setup to integrate Emacs with GPG?

Update: I tried again launching from the Terminal with emacs and I got to the *Minibuf-22* window, but was able to quit with C-g. The buffer *Messages* shows the two same error messages as above with Variable binding depth exceeds max-specpdl-size, and I am able to save the encrypted file with no problem after that, with the difference that now switching buffer windows with C-x o moves to the mini-buffer. If I try to magnify it with C-x 1, I get Can’t expand minibuffer to full frame.

Starting with emacs -Q, I have no problem saving the encrypted file, even without those 3 symbolic expressions. I tried again starting Emacs from the Terminal: I had the same hang the first time, then I got the variable binding depth problem which didn't hang Emacs. I checked that the only parts of my initialization code that use gpg are those three symbolic expressions and in mail settings, such as (setq smtpmail-auth-credentials '(expand-file-name "~/.authinfo.gpg")).


texts:
I'm a new Emacs user and am unable to successfully change the color scheme.
I have followed numerous guides, YouTube videos but have not been able to load any color scheme, some error always pops up. Many of the guides are quite old so may not pertain to the version I'm using, which is version 27.1 running on FreeBSD.
Could someone point me to a simple color scheme which I can download. tell me the correct location and provide a simple init.el to load it?
I tried using http://www.nongnu.org/color-theme/
but this is over 10 years old and maybe no longer relevant
Whatever I do, whenever I run M-x color-theme-<TAB> RET I always get NOT FOUND which suggests I am unable to get a color theme package in the correct format in the correct location - I have tried many many times without success so far.
Just to stress I'm a NEWBIE and prone to make lots of mistakes.


texts: emacs always calls ipython with matplotlib

texts:
I'm trying using ipython in emacs. I installed python-mode and config ipython:

(require 'python-mode)
; use IPython
(setq-default py-shell-name "ipython")
(setq-default py-which-bufname "IPython")
(setq py-force-py-shell-name-p t)
(setq py-python-command-args '("-colors" "Linux"))
; switch to the interpreter after executing code
(setq py-shell-switch-buffers-on-execute-p t)
(setq py-switch-buffers-on-execute-p t)
; don't split windows
(setq py-split-windows-on-execute-p nil)
(add-hook 'python-mode-hook
  (lambda ()
    (local-set-key (kbd "C-c i") 'py-shell)))

I didn't call ipython with matplotlib, but when I tried C-c i in emacs, I got:

[TerminalIPythonApp] WARNING | Eventloop or matplotlib integration failed.
Is matplotlib installed?
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
....
ImportError: No module named matplotlib

It's the same error with running ipython --matplotlib. I didn't install matplotlib because I don't want to use it. So, I didn't set it in my config.

Why did emacs still call ipython with matplotlib?


texts: Keep selection on/reselect for multiple query-replace sessions

texts:
Following this thread:
https://stackoverflow.com/questions/39808820/replacing-on-mouse-selected-area-in-emacsI can highlight an area, and do replace only on this area. Great! Now, I want to do several replacements...The issue is that after I input ! for all occurrences, I need to re-highlight the area again and again. I think that there is a way to avoid doing the re-highlight, but don't know how. Thanks.


texts:
In an org tree consisting of hundreds of headings, how do I find out if there are any that are duplicates?

So, for instance, in the tree below,

* Heading 1
** some
** other
** headings
** some

I want to latch on to 'some'. I can sort them alphabetically to identify them manually. But with hundreds of headings, it is not practicable.

Also, can I control if it is a perfect match (everything under 'some' is exactly the same in both the instances) or just a heading match (we do not care about what is below 'some')?

This question is very similar to what I am asking. But unfortunately, there is no answer provided there. Although there are some hints in a comment.


texts:
I use MELPA already, this question is about the actual mechanics of installing a package.  My current process is:

M-x package-list-packages
C-s name-of-package
C-s enough times to be on the actual name of the package, not just another instance of that word.
RET (this opens the package details in another buffer, so...)
C-x o Switch to the other buffer
down down C-e left to place the cursor on the word "Install"
RET
y RET

I'd like to think there's a less awkward way to do steps 4-8 (especially #5 and #6).  I know about M-x package-install but I like to read the descriptions in the *Packages* buffer.  Any tips?


texts:
Is there a way to fold a region in org-mode? (Not the whole file, and not an individual item, but a region containing multiple items.)

Often I want to collapse only a portion of an org file, say folding:

* a
** a1
** a2
* b
** b1
** b2
** b3
* c
** c1
** c2
* d
** d1
** d2

into

* a
** a1
** a2
* b ...
* c ...
* d
** d1
** d2

I know in this particular example I could simply fold the whole file using org-cycle, then expand a and d individually, but imagine there are hundreds of items and I want to fold a dozen contiguous items contained in an active region while leaving the rest of the items in the file expanded.


texts: Helm's buffers persist even after an action has been executed in them

texts:
Helm's buffers remain active even after an action has been executed in them.

To illustrate this point, open a new Emacs session, and execute C-x C-b to view a list of all active buffers. The list consists of three items: *GNU Emacs*, *scratch* and *Messages*.

Now execute M-x helm-mini, and select the first item on the list, namely *scratch*.

Finally, execute C-x C-b again. You can see that in addition to the original three buffers, *Completions* as well as *helm-mini* are also on the list.

This behavior is undesirable, as it results in unnecessary buffer clutter.

Is this how Helm's buffers are supposed to behave? Is there a way to force them to truly close once an action has been chosen in them?


texts:
How can I tell Emacs than whenever it tries to open file /a/b/c/foo.txt, it should instead open /d/e/f/foo.txt?

I have a few projects and libraries which are accessible via multiple paths on the filesystem. This is mostly done by symlinks, but not only - sometimes I use bind mounts (some software, e.g. git, treats symlinks differently), and sometimes the files will simply always be identical copies of some other files.

Although when manually opening files, I always open them at their canonical location, following error messages and using "go-to-definition" actions will often open files under aliased paths, and I will end up with multiple buffers pointing to the same file. As such, I'd like to define a rule set of how to rewrite paths of all files it attempts to open. What would be the way to do this?


texts: Align lines of two separate files in two split-windows?

texts: Is there a way to align line numbers of separate buffers, one in each split window?


texts: send email gnus error - need fully-qualified hostname

texts:
I'm trying to send email from emacs-gnus. But still get this error:

  smtpmail-send-it: Sending failed: 504 5.5.2 :
  Helo command rejected: need fully-qualified hostname

My config is:

(setq send-mail-function        'smtpmail-send-it
      message-send-mail-function    'smtpmail-send-it
      smtpmail-smtp-server      "smtp.zenbox.pl"
      smtpmail-smtp-service 587)

Then I found info that it can be configuration with postfix
https://serverfault.com/questions/357990/smtp-auth-with-postfix-reject-with-error-need-fully-qualified-hostname but I haven't found this line "reject_non_fqdn_hostname" in my configuration.
Is it problem with emacs conf or with postfix? How I can fix it?


texts: How can I convert a string form of a list to an actual list?

texts:
I would like to convert these two strings
"(a b c)"
"(9 . 3)"
to these
(a b c)
(9 . 3)
I'd had some luck with the first one evaluating this,
(mapcar 'intern (split-string (string-trim "(a b c)" "(" ")")))
basically, removes parentheses from string, splits it to ("a" "b" "c"), then calls intern
to turn all the elements to symbols and yields (a b c).
When evaluating this with "(9 . 3)" though, It escaped all elements and yields (\9 \. \3),
this however, is not the same as (9 . 3) that I wanted.


texts:
When viewing a keymap, prefix keys and keys in their maps are displayed as numerical values. E.g.

(keymap
 (M-delete . sp-unwrap-sexp)
 (27 keymap
     (23 . sp-copy-sexp)
     (6 . *-forward-sexp)))

Keys at the top-level map, as we can see, are not numbers. Here, there is M-delete, which is clearly easier to understand than 27.

Is it possible to turn these numbers back to keys sequences? How?


texts: Automatically identify obsolete variables in init-file

texts:
When a new version of Emacs is released it is usually the case that some variables/commands/functions become obsolete. They are usually marked as such in the corresponding documentation:

turn-on-eldoc-mode is an alias for eldoc-mode in eldoc.el. [...]
This function is obsolete since 24.4; use eldoc-mode instead.

I'd like to make sure I am not referencing any obsolete variables in my init-file, but I'd also like to avoid checking the whole thing manually.
So my question is: Is there a way to automatically identify all obsolete variables in my init-file (that possibly also works for third-party packages installed via the package manager)?


texts: Unable to decrypt .gpg file using emacs but command line gpg works

texts:
I have an accounts.org.gpg file. I can open it using gpg directly:

$ gpg -d ./accounts.org.gpg

You need a passphrase to unlock the secret key for
user: "Omair Majid <removed@removed>"
4096-bit RSA key, ID 7CC8AAC6, created 2012-01-18 (main key ID 66484681)

gpg: encrypted with 4096-bit RSA key, ID 7CC8AAC6, created 2012-01-18
    "Omair Majid <removed@removed>"
+TITLE: Accounts
<rest of output removed>

But I can't open the same file using Emacs. Trying to open it in emacs
gives me an error:

epa-file--find-file-not-found-function: Opening input file: Decryption failed, No secret key: E295ECEC7CC8AAC6

Is there something I need to configure on the emacs side to make this work?

For some additional background, I created this file on another machine
(using the same version of Emacs), on which Emacs could read/write to
that file just fine. I then copied over the contents of ~/.gnupg
over to this machine. And now gpg can still read it, but Emacs can't.

EDIT: Could this be a gpg1 vs gpg2 difference?

$ gpg2 --decrypt accounts.org.gpg
gpg: encrypted with RSA key, ID E295ECEC7CC8AAC6
gpg: decryption failed: No secret key

How was the Emacs on the other machine (using same configuration, same
version of Emacs (25.1) and same OS (Fedora 24 x86_64, same version of gpg and gpg2 packages)) read from it and write to it. Anyway
using,

(setq epg-gpg-program "/usr/bin/gpg")

Still results in the same error.


texts: How can I hide formatting marks after the formatting they define has been applied in markdown mode?

texts:
I am using markdown mode with the modifications suggested in the excellent answer I received to a previous question. My aim is to have basic rendering capabilities within emacs itself so I can structure and format my text documents. I now would like to extend this so that:

_foo_ renders as foo;
*foo* renders as foo;
#Header renders as

header
`code` renders as code.

At the moment, my documents look like this:

I want it to look as it would if displayed on an SE page:

header

Normal text, bold text, italicized text, and code.

In other words, I would like to add italics, bold, headers and inline code and have them be visible in the emacs buffer I am editing, without needing to export the markdown document, and I would like formatting marks (such as #, _, * and backticks) to disappear once the format they define has been applied.


texts: How to force package-utils-upgrade-all to completely replace packages when upgrading?

texts:
lsp-mode doesn't support upgrading the package, instead, a full re-install is required each time (see report).
(In my case, deleting the directory and re-installing works, upgrading doesn't).
Is there a way to force package-utils-upgrade-all to perform the equivalent of a fresh-install when upgrading a package to a new version?


texts:
On a Mac, using Emacs 26.1, I'd like to bind my windmove functions using:

(global-set-key (kbd "C-x C-<left>")  'windmove-left)
(global-set-key (kbd "C-x C-<right>") 'windmove-right)
(global-set-key (kbd "C-x C-<up>")    'windmove-up)
(global-set-key (kbd "C-x C-<down>")  'windmove-down)

"C-x C-<up>" and "C-x C-<down>" work, but for some reason the left and right ones don't. When I use describe-key on them, it seems I can't even enter those key sequences (i.e. it stops echoing after "C-x", and does not respond to the rest of the input). I also tried the syntax "C-x <C-left>", to no avail.


texts:
I would like to use org-mode to maintain a simple website that is a collection of notes organized by topic.  I understasnd the basics of publishing -- i.e., using C-x C-e P p to publish all the files in the current project -- but these files are all independent of one another and I have to manually link with [[file:nexttopic.org][the next topic]] to make the different topics "aware" of one another.

Is there a better way to make org-mode aware of the structure of the topics and have it automatically generate a single page that is a table of contents as well as link to the next/previous topics?


texts: How to scroll using mouse while keeping cursor on same line/position?

texts:
I am using this minor mode to scroll and keep cursor on same line, mwheel-scroll however screws up the smooth scroll since it moves the cursor to a different line, scrolling return the cursor back to original line but the visual is not smooth.

I tried:

scroll-preserve-screen-position 'always

But that didn't help.

This is the minor mode I am using:

(define-minor-mode centered-point-mode
  "Always center the cursor in the 1/3rd of the screen."
  :lighter "..."
  (cond (centered-point-mode (add-hook 'post-command-hook 'line-change))
    (t (remove-hook 'post-command-hook 'line-change))))

(setq recenter-positions '(0.35))
(defun line-change ()
  (interactive)
  (unless (memq this-command '(mwheel-scroll mac-mwheel-scroll))
   (recenter-top-bottom)))

(define-globalized-minor-mode my-global-centered-point-mode centered-point-mode
  (lambda () (centered-point-mode 1)))
(my-global-centered-point-mode 1)


texts: How can I search through builtin documentation?

texts:
Emacs claims to be self explanatory, but I couldn't find a way, to search through the documentation. This leads to me searching always in google.

So how can is search through documentation in emacs?


texts: Use function calls or constants when propmpted for text

texts:
During my regular reviews, I use the following org-mode matching query:

SCHEDULED<="<2018-05-31>"/!

(it's actually much, much longer, but it contains that).

However, I need to change and adapt the query every month. I'd like to write something like:

SCHEDULED<=end_of_may/!

Or even just:

SCHEDULED<=end_of_current_month/!

This could be done easily if I could use pre-defined constants or functions when prompted for text to match, which could be defined in my file prelude or .emacs configuration file. However, I tried to use functions (substring) when prompted for text using sparse tree matching, and that did not work.

Any ideas?


texts: Bookmarks: how to display both file content and bookmark annotation without closing the *Bookmark List* buffer window?

texts:
When in my *Bookmarks List* buffer (Bookmarks vanilla), I can place point on a bookmark, and call the function bookmark-bmenu-switch-other-window. This will open a second window, to the right, showing the content of the bookmarked file. The *Bookmarks List* buffer, with point, will remain visible in the left window.

However, if I call the function for an annotated bookmark, the *Bookmarks List* buffer closes, and two new windows appear side-by-side. The left one shows the content of the file, and the right one shows the annotation for the bookmark. The point is now located in the window to the left. The closing of the *Bookmarks List* buffer is very unpractical, since I often want to look into the file content/annotation of several bookmarks in a row without having to re-open the bookmark list every time.

I need a new function that can show both bookmark annotation and file content in the right part of the frame (split in two windows horizontally), while retaining the point and the Bookmarks List buffer in the left part of the frame.  Ideally, the upper right window for annotations should only be approx. 5 lines high.

Thanks in advance for any suggestions or code!


texts:
When using org-mode as a front-end to LaTeX, I'm making heavy use of inline code like @@latex:\textit{something italic}@@. Right now, this is mainly displayed as normal text (with proportional font and only \textit appearing monospaced). It would be great if this could be changed in two respects, making it more similar to code blocks that start with, e.g., #+BEGIN_EXPORT latex:

@@latex: and @@ are greyed out;
the content (i.e. \textit{something italic}) is shown using the regular LaTeX font lock.

How can I get to this?


texts: How to get ess-describe-object-at-point to delete-window when I am done?

texts:
I am reading this function and still don't see why it doesn't delete both the buffer and window. Currently it open a new window, and when I hit C-g another buffer (even duplicated to the one I am editing) appears in that window, created unwanted layout. See attach screenshot.

What I want is to get the window behavior like *Help buffer when one calls M-x describe-key for example: It opens its own window, move focus there, and closes it when I hit q or C-g.


texts:
How can I replace a block of code with another, akin to query-replace/query-replace-regexp?

For example:

Replacing the following block:

for(A) {
  if(B) {
     s1;
  } else {
     C;
  }
}

with

for(M) {
  if(N) {
    s1;
  } else {
     O;
  }
}


texts: How do I select the xref completion buffer using the keyboard?

texts:
Prior to the appearance of xref hitting M-v would switch to the completions buffer. Now this does not appear to work however.

I am running GNU Emacs 26.1 (build 1, x86_64-apple-darwin13.4.0, Carbon Version 157 AppKit 1265.21) (aka Mac Emacs).


texts: How to turn off alignment-indent after line continuation in Shell-script mode?

texts:
In Shell-script[sh] mode, Emacs defaults to this style of indentation:

/this/is/an/example/command/broken/over_multiple_lines which \
                                                       causes \
                                                       an \
                                                       annoying \
                                                       indentation

I would like to change this so that each line is indented by only a single tab further than the original line:

/this/is/another example \
  which is indented \
  by a single tab \
  shown here \
  as two spaces

This is what the relevant section of my init.el says I have customised:

 '(sh-backslash-align t)
 '(sh-basic-offset 2)
 '(sh-indent-after-continuation nil)
 '(sh-indent-for-continuation 0)
 '(sh-indentation 2))

What variable am I missing to change the alignment indent to a single-tab indent?


texts: How to highlight digit groups of 3 in numerals?

texts:
I find it very useful to visually distinguish every 3 digit group of numbers in source code so that I can read it. For example something if I see 1000000 it is fairly easy to see that this is 1M rather than 10M or 100k. Basically I want to made digits 4-6, 10-12... look different from the others.

In vim I could do this via a custom syntax rule.

match SpellRare /\d\{1,3}\ze\%(\%(\d\{3}\)\{2}\)*\d\{3}\>/

This relies on zero-length lookaheads to work. Emacs highlighting doesn't appear to have these so the best I could do was multiple highlight-regexp calls.

(add-hook 'prog-mode-hook (lambda ()
    (highlight-regexp "\\([0-9]\\{1,3\\}\\)\\([0-9]\\{3\\}\\|\\)\\>" font-lock-warning-face 1)
    (highlight-regexp "\\([0-9]\\{1,3\\}\\)[0-9]\\{9\\}\\>" font-lock-warning-face 1)
    (highlight-regexp "\\([0-9]\\{1,3\\}\\)[0-9]\\{15\\}\\>" font-lock-warning-face 1)
    (highlight-regexp "\\([0-9]\\{1,3\\}\\)[0-9]\\{21\\}\\>" font-lock-warning-face 1)
    (highlight-regexp "\\([0-9]\\{1,3\\}\\)[0-9]\\{27\\}\\>" font-lock-warning-face 1)
    (highlight-regexp "\\([0-9]\\{1,3\\}\\)[0-9]\\{33\\}\\>" font-lock-warning-face 1)
    (highlight-regexp "\\([0-9]\\{1,3\\}\\)[0-9]\\{39\\}\\>" font-lock-warning-face 1)))

This mostly works for the number lengths I have defined (although it doesn't always update correctly when editing the number). Is there a better solution to this?


texts: Set the mark at the beginning of the current function definition

texts:
I want this function: assume that I am inside a function, and in line 100, now I want to go to the definition of this function, say 80, and set mark, then go back to 100. So now I have an active region between 80 and 100. I write this function like this:

(defun my-select-fun ()
  (interactive)
  (setq myline 'line-number-at-pos )
  (beginning-of-defun)
  (set-mark)
  (goto-line myline)
)

But it is not working, and I get an error: Wrong number of arguments: (1 . 1), 0. Sorry for not be familiar with emacs lisp, could someone help me to implement this simple function? Thank you very much.


texts:
I used to think that you can just type =13*57 into an org-mode table's cell, hit Tab or Ret, and have it enter the result for you. Today, I learned that this isn't true the hard way as I used this a lot, recomputed the entire table via C-u C-c C-c, and performed too many steps to undo the mistakes before I noticed them. Until recently, I didn't recompute entire tables, so I probably got tables using this which will explode upon recomputation.

Apparently, using the above lets the table know that the entire column ought to have that value, for some reason. Upon recomputation of the affected cells, this takes effect.

This yields the question of what I assumed =13*57 does can be done in a similarly easy fashion.

I know that you could use :=13*57 but that enters the formula into the table formulas line which can get it cluttered up pretty quickly. I just want the result of the computation to be entered. How it came to be doesn't have to be preserved.


texts: "Dissasociate" auto-mode for specific files (in ESS)

texts:
I'd like to keep ess as automatic major mode for R files and everything else, except for Julia, for which I want to use julia-mode alone.  However, I cannot find out how to "unbind" the file association of ess-julia-mode.

Without really knowing what I do, I tried putting

 (setq auto-mode-alist (assq-delete-all "\\.jl\\'" auto-mode-alist))

at some places, but it had no effect.  My package loading is essentially the following (in this order):

(use-package ess
  :init (require 'ess-site)) ;; adds association automatically

(use-package julia-mode
  :mode "\\.jl\\'")          ;; set association manually - no effect

How can I make sure that .jl files use julia-mode, while keeping the other associations from ess?

(I use use-package for package loading; but any answer dealing with the same problem in general is equally welcome.  It might also be independent of ess.)


texts:
If I fire up an eshell an try to type the following:

ls *

The * char is automatically deleted.
By calling C-h k on * I get the expected:

  * runs the command self-insert-command

Does anyone know what might be happening?

Emacs 25.0.95.1
Spacemacs 0.105.21
OS X 10.11.6


texts:
Chances  are that every time utf-coding should be activated by invoking 'M-x revert-coding-system` , even though a long list of utf-prefer configuration:

(prefer-coding-system        'utf-8)
(set-terminal-coding-system  'utf-8)
(set-keyboard-coding-system  'utf-8)
(set-selection-coding-system 'utf-8)
(setq locale-coding-system   'utf-8)
(setq-default buffer-file-coding-system 'utf-8)

Try to automate the process by

;;Set buffer coding system
(add-hook 'org-mode-hook (lambda () (revert-buffer-with-coding-system  "utf-8")))

However, it does not work as expected.

What's the problem with my function to to handle the revert-buffer-with-coding-system'


texts: Multiline mode-line using dynamic generated text images

texts:
I've been doing experiments at displaying static text images in the mode-line using Imagemagick to generate the image (see below). I would like now to generate such an image in a dynamic way, providing information from within Emacs.
For example, I could display the current major mode or the cursor line/column (might be slow).

My question is how to dynamically generate the image according to the provided information (e.g. how to call and pass arguments to Imagemagick). Displaying line/column using image Imagemagick might very slow but still, I would like to try.

Imagemagick command used for the screenshot:

convert -antialias -background none -fill white -family Roboto -weight regular -gravity southeast -size 64x42 -pointsize 20 label:"Emacs\nv26.3" label.png

And in the modeline (header line in my case):

(propertize " " 'display (create-image "~/label.png" 'png nil :ascent 90 ))


texts: How do I jump out of enclosing parentheses?

texts:
I'm using spacemacs to edit Python code.

When I type an opening parentheses, the closing parentheses is automatically inserted for me and the cursor is put in the middle for further typing.  But: once I am done typing inside the parentheses, I need a quick way of jumping  out of them and landing after the closing parenthesis.

Right now, I switch to  normal state, move the cursor one unit (when I'm on the character just before the closing parenthesis), and then re-enter insert state with a.  How can I do this more efficiently?


texts: Showing Individual Clock Times in Agenda Column View? (Org-Mode)

texts:
When looking at the log view while in agenda-mode, tasks which have clock time associated with them show up as:

  plan:        9:15-10:48 Clocked:   (1:33) Task A
              10:00...... ----------------
  plan:       10:48-11:05 Clocked:   (0:17) Task B
  plan:       11:05-11:36 Clocked:   (0:31) Task B

Notice how Task B has two separate times associated with it: 0:17 and 0:31. The CLOCKSUM for this task would be 0:48.

Question: When viewing this information in column mode, how do you access the individual clock times for a task? I know that CLOCKSUM gets the sum of them, but I'm interested in the individual chunks of time not their sum. In this case, I would be interested in showing the 0:17 and 0:31 in the column view for Task B. Is this possible?


texts: Emacs client can't find server in terminal

texts:
So, I'm trying to set up emacs as a server but I'm having trouble getting it to work from the terminal. If I run emacs --daemon on some terminal I can connect to it if I run the emacsclient from that same terminal, but if I open a new terminal the emacsclient will not find the server. Things seem to work well if I run emacsclient from the launcher.

I am running

emacsclient -a '' -t

The client says:

emacsclient: can't find socket; have you started the server?
To start the server in Emacs, type "M-x server-start".

Any ideas of what could be happening?

I am using ubuntu 17.04 with gnome/i3 if that matters.


texts: How can I set NeoTree to always show hidden files?

texts: The only way i know to make NeoTree show hidden files is to use neotree-hidden-file-toggle, but this is meant to be used interactively when the NeoTree buffer is the active buffer. Is there a way to globally set in my .emacs init file to make NeoTree always have the behavior of showing hidden files?


texts:
In one of my windows I've opened "output.png" and I would like emacs to automatically reload it if it has changed.

I would like to do this for all PNG files which are currently open, but only PNG files. How to I do this?


texts:
I wanted to disable arrow keys in my Emacs to practice vim key bindings using EVIL mode.
So instead of using global-unset-key as someone here on stackexchange suggested. I used the following code in my init file.

(global-set-key (kbd "<left>") (lambda() ( message "Use Vim keys: h for Left")))
(global-set-key (kbd "<right>") (lambda() (message "Use Vim keys: l for Right")))
(global-set-key (kbd "<up>") (lambda() (message "Use Vim keys: k for Up")))
(global-set-key (kbd "<down>") (lambda() (message "Use Vim keys: j for Down")))

For some reason these don't work inside org-mode.
And also if I am not inside org-mode, It works but instead of the message like I want to give. I get the following error.

command-execute: Wrong type argument: commandp, (lambda nil (message "Use Vim keys: h for Left"))

Complete Beginner here. So fix along with some explanation of how things work is highly appreciated.

Edit:
After the first answer I see that the error has vanished. But the whole thing doesn't work unless I type something. Not as soon as I enter Emacs.
And the error is not specific to org-mode. It also works in org-mode after I type something.
It doesn't work in normal-mode in EVIL.


texts: Files for which to activate generic mode

texts: I've created a generic mode for emacs, but I have trouble matching the file names I want the generic mode to be on, right now I'm using proguard-* but I would like to match only file names with proguard-*.txt and proguard-*.pro. How can I do this?


texts:
I am using popup-tip and popup-menu* from the http://melpa.org/#/popup library in my extension, but I'd like to use something in stock Emacs so that I can remain zero dependencies.

The built in popup-menu (i.e. x-popup-menu) and x-show-tip don't work for me because they are mouse-centric (i.e. they show the popup at the mouse location) but I need point centric (i.e. popup where the point is) because that's where the user's gaze is centered when the popup appears.


texts:
I want to extend a standard Emacs function (package--save-selected-packages), but to cover my tracks I want to save the old defintion under a new name and then redintion teh standard function.
I tried fset but that creates rather something like an alias from a new name to the old name, but it does not save the old definition...


texts: Can I combine key-chord-mode with evil-define-key?

texts:
I like to use evil-define-key like so:
(evil-define-key 'normal projectile-mode-map
  (kbd "M-o") 'projectile-switch-to-buffer)

This is great because I can make bindings for both an emacs mode and an evil state at the same time.
Unfortunately though I cannot figure out how to integrate this style, with key-chord-mode.
I thought I had found the solution with the following, but this is a different kind of key-chord than the ones provided by key-chord-mode.
(evil-define-key 'normal projectile-mode-map
   (kbd "<key-chord> po") 'projectile-switch-to-buffer

Is there a way to essentially say the following?:
(evil-define-key 'normal projectile-mode-map
   (key-chord-define "po") 'projectile-switch-to-buffer))


texts: Can not show inline image in org file: "No images to display inline"

texts:
Linux Mint 19.3
Emacs 26.3
Here is my org file:
* TODO Test insert image
  Test this
  #+CAPTION: This is the caption for the next figure link (or table)
  #+NAME:   Deepspace
  [[KLOCKA6.JPG]]

* TODO Hello from this
  Hello

This org file is in the same folder as image KLOCKA6.JPG.
I want to show the image as an inline image in the org file.
I use the command org-toggle-inline-images but I get an error  message:
No images to display inline

How do I display the file as an inline image?