texts:
In org-mode, I have a custom agenda set with:

(setq org-agenda-custom-commands
      '(("d" "todo"
               agenda ""
               ((org-agenda-span 1)
        (org-agenda-start-day "-0d")
                (org-agenda-start-with-log-mode '(closed))
        ))
    ))

I can call it with C-c a d.
I want to call it programmatically. The documentation offers passing an argument:

(org-agenda &optional ARG ORG-KEYS RESTRICTION)
Dispatch agenda commands to collect entries to the agenda buffer.
Prompts for a command to execute.  Any prefix arg will be passed on to
the selected command.  The default selections are:
a     Call ‘org-agenda-list’ to display the agenda for current day or
week.

I tried:
(org-agenda "a")

and get the same prompt as if I had run (org-agenda). So I don't know how to proceed to the next step of selecting the custom agenda (the "d" after the "a").
How can I call this custom agenda programmatically?


texts:
So, I am writing a function to italize/unitalize the current line (without the surrounding blanks) by surrounding it with slashes /.

  (defun my-italize-line-dwim ()
    (interactive)
    (save-excursion
      (if (and (progn (evil-last-non-blank) (equal (following-char) ?/))
               (progn (back-to-indentation) (equal (following-char) ?/)))
          (progn (delete-char 1) (evil-last-non-blank) (delete-char 1))
        (progn (back-to-indentation)
               (insert "/")
               (evil-last-non-blank)
               (evil-append 1)
               (insert "/")
               (evil-normal-state t)))))

While this may seem to work, there are some problems. If I want to use undo after the operation, undo-tree-undo undoes slashes one by one, instead of both at once. What's more, going to the previous line always means the cursor will jump to its first character. I feel like there should be a way to avoid both problems by somehow "atomizing" the operation, maybe by doing a copy/replace of the whole line at once. How should this be done?


texts: Using Ubuntu Emacs init file on Windows; possible multiple issues

texts:
I've seen Manage same init file for Linux and Windows, but it is not quite what I want. Bear with the description of issues and my attempts for resolution.

I recently installed Emacs on Windows using emacs-25.3_1-x86_64.zip from the gnu ftp server, and did not install any other file. I found the init file .emacs, and the diretory .emacs.d in C:\Users\MyUSer\AppData\Roaming\ -- as the docs indicated. I copied my .emacs for emacs25.3 on Ubuntu 16.04 and the accompanying .dotemacs.org and pasted them in Roaming. I also pasted the org-dotemacs.el in Romaming\.emacs.d\. The contents of my init file are as follows:

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ansi-color-faces-vector
   [default default default italic underline success warning error])
 '(custom-enabled-themes (quote (wheatgrass)))
 '(initial-frame-alist (quote ((fullscreen . maximized))))
 '(package-selected-packages (quote (pdf-tools org-dotemacs))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

(require 'package)

(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))

(setq package-enable-at-startup nil)
(package-initialize)

;;;;org-mode configuration
;; Enable org-mode
(require 'org)

;;org-dotemacs
(require 'org-dotemacs)
(load-file "C:/Users/MyUser/AppData/Roaming/.emacs.d/org-dotemacs.el")
(org-dotemacs-load-default)

The message I get is: Cannot open load file: No such file or directory, org-dotemacs. So I decided to look into the list of packages. Here I have another perplexing behaviour. The list loads, but I get errors contacting to org archive; output given below because I don't know if it is relevant to the problem mentioned ahead:

gnutls.c: [1] (Emacs) GnuTLS library not found
Opening TLS connection to `orgmode.org'...
Opening TLS connection with `gnutls-cli --x509cafile nil -p 443 orgmode.org'...failed
Opening TLS connection with `gnutls-cli --x509cafile nil -p 443 orgmode.org --protocols ssl3'...failed
Opening TLS connection with `openssl s_client -connect orgmode.org:443 -no_ssl2 -ign_eof'...failed
Opening TLS connection to `orgmode.org'...failed
Package refresh done
Failed to download `org' archive.
You can run the command `package-list-packages' with M-x pa-l- RET
Failed to download `org' archive.
Contacting host: melpa.org:80

Within the list of packages I find many with the label incompatible which is where I find org-dotemacs and on clicking it:

Status: Incompatible because it depends on uninstallable packages.
Archive: melpa

Version: 20151119.1022
Summary: Store your emacs config as an org file, and choose which bits to load.
Requires: org-7.9.3 (not available), cl-lib-1.0
Homepage: https://github.com/vapniks/org-dotemacs

The problem is in the Status and Requires fields, because I have org-mode, in fact M-x org-version gives Org-mode version 8.2.10 (release_8.2.10 @ c:/Users/MyUser/Downloads/emacs-25.3_1-x86_64/share/emacs/25.3/lisp/org/). I assumed something that needs org-7.9.3 would work with org-8.2.10.

What is wrong? Did I miss downloading some files from the gnu ftp server? Do I need to install some other software alongside for emacs to run properly on Windows? I can program but I am not a professional, I have somehow managed to use emacs on Ubuntu. I don't even understand how to run emacs with the --debug-init option on Windows.


texts: Emacs auto-indenting comments in an unhelpful manner

texts:
New Emacs user here. Hitting enter after a semicolon commented line in any file type (.el and .lisp at the very least) indents the comment in a very unhelpful way that I have to assume is not intended behavior. This problem does not occur if I move away from that comment line in any way besides hitting return (triggering auto-indent presumably).
For example, If I type the following
; this is a comment

Then hit return, I get the following (32 spaces indentation)
                                ; this is a comment

What is causing this behavior, and how can I prevent it?
I am running Emacs 26.3.0.20191219 installed through Chocolatey on Windows 10


texts: How can I preview TeX formulas inline in arbitrary modes?

texts: How can I get TeX previews inside modes other than AUCTeX or org-mode? I'd love to see TeX equations in jabber, erc and markdown. If I ever switch to Emacs for email, I'd presumably like to see previews there too.


texts: ORG-MODE - Trigger TODO status on a certain date?

texts: Rather than manually check a tickler file or calendar every morning, how can I create a trigger that will set the status of an item to TODO on a certain date?


texts: Multi-Term does not color the whole background

texts:
I want a black background in my multi-term buffer and therefore, I call :

(custom-set-variables
'(term-default-bg-color "#000000")
'(term-default-fg-color "#dddd00"))

in my emacs initialization file. But, it does not color the entire background. See the attached image. I want the entire background color as black.


texts: How to customize to open helm-mini buffer in the same buffer on bottom or right-hand side?

texts:
I just want to open helm-buffer (*helm recentf* and *helm for files*) to open as mini buffer on the 40% bottom of the buffer. If possible I want to costumize to open just only *helm for files* on right-hand side.
I tried most of the guide but it keeps opening on the complete buffer, I don't know what is going wrong or preventing it.
My configuration is as follows:
(require 'helm)
(require 'helm-config)

(setq helm-split-window-inside-p           nil ; open helm buffer inside current window, not occupy whole other window
      helm-move-to-line-cycle-in-source     t ; move to end or beginning of source when reaching top or bottom of source.
      helm-ff-search-library-in-sexp        t ; search for library in `require' and `declare-function' sexp.
      helm-scroll-amount                    8 ; scroll 8 lines other window using M-<next>/M-<prior>
      helm-ff-file-name-history-use-recentf t
      helm-echo-input-in-header-line t)

(setq helm-display-header-line nil) ;; t by default
(set-face-attribute 'helm-source-header nil :height 0.1)

(setq helm-autoresize-max-height 40) ;; <= this did not make any affect
(setq helm-autoresize-min-height 40)
(helm-autoresize-mode t)
(helm-mode 1)

(projectile-global-mode)
(setq projectile-completion-system 'helm)
(helm-projectile-on)


texts: How to set the glyph of a unicode character?

texts: I would like to set the glyph of a certain unicode character. Specifically, I would like the glyph § (SECTION SIGN) to represent the unicode character U+202A (LEFT-TO-RIGHT EMBEDDING), a normally non-visible character, in the main buffer. However, this glyph assignment must be confined to the main buffer; in particular, it must not be used when printing the document as a PDF file.


texts: Keep text selection after indenting with evil

texts: I'm using emacs with evil key-bindings and I like to know, after getting some text into visual mode, how do you make sure that after hitting >> for indenting the text, the selection is kept, such that you can re-indent it again, or do something else with the entire selection?


texts: How to make org-mode DWIM when it reads times in timestamps?

texts:
Q: how can I make org-mode read the time in timestamps intelligently?

org-mode uses org-read-date (which in turn relies on parse-time-string) to create/modify timestamps, scheduled items, and deadlines.  I'm trying to figure out how to make it smarter when it reads in the time of an event.

One can enter times:

on a 24-hour clock (9:00 => 9:00AM, 21:00 => 9:00PM), or
with AM or PM suffixes (9am => 9:00AM, 9pm => 9:00PM).

That's all well and good, but here's where I'd like it to be smarter in a DWIM fashion.  There are whole stretches of the day during which, on a 12-hour clock, I always mean PM (ie, for times in the middle of the night).  For example, if I enter 2:00, I always mean "2:00PM", but on the 24-hour clock it means "2:00AM".  The problem is that I commonly forget to append the pm part, and then my agenda informs me that the meeting I have for 2:00 in the afternoon is actually scheduled for 2:00 in the morning.

So: how can I convince org-read-date to accept a range of times to mean PM unless I explicitly add the am suffix?  I'd like to be able to enter any time from, say, 1:00 to 6:59 and have it mean 1:00PM to 6:59PM unless I explicitly enter something like 1:00am.

NB: see this related thread on getting org-mode to understand alternative day/month abbreviations.


texts: Keyboard macros or command for quick refiling using dired or similar

texts:
I scan all the mail (not email, but good ol' mail) I receive and have these saved as PDF files into a directory, which we think of as an inbox. I would like to find a workflow to quickly refile these PDF files by moving them to one of several pre-defined directories. From a user perspective, the closest thing I can think of is org-capture and capture templates, where I can have a couple of custom defined destinations that have a simple one key shortcuts. I want the same thing but for refiling actual files, using dired or similar, so when I have the list of files I can go just press two quick keys and have it moved to one of my predefined directories.

To further illustrate my wanted workflow, imagine org-capture-templates, which can look like this;

  (setq org-capture-templates
        '(
          ("t" "Todo Work" entry (file+headline "~/org/work.org" "Tasks") "* TODO %?\n  %i\n  %a")
          ("p" "Todo Personal" entry (file+headline "~/org/personal.org" "Tasks") "* TODO %?\n  %i\n  %a")
  ...

So after bringing up the capture menu, I can press t or p to choose either a work related todo or a personal todo. Similarly for my PDF refiling operation, I want to define some "templates" with a shortcut for each, so after selecting a file and bringing up my "quick-refile" menu, I can press a single letter, like 'p' for personal files or perhaps 'w' for work related files, which will then move the file.

I'm open both to configuration suggestions on how to achieve this as well as plugins or suggestions on workflows for doing this. I concocted this workflow for myself but otherwise try to follow BASB (building a second brain) and PARA for filing stuff. If anyone has broader workflow suggestions I'm listening.

Many of these files are closely associated with tasks I have in org, so it's nice to have en Emacs centric workflow to handle all aspects of refiling. Extra points for an answer that can update references to these files from within org, when the actual file is moved. I imagine that I will always refile the file first, then reference it, but perhaps sometimes it is useful to be able to refile later as well, in which case I don't want my org mode references to the file to break.


texts: How do I enable/disable flycheck when changing buffer content-type of web-mode

texts:
I am using emacs daemon, and with the default config for js, jsx:

(flycheck-add-mode 'javascript-eslint 'web-mode)

When I edit *.html.erb files, I have an error: Parsing error: Unexpected token at <%= or <% on ruby code block.

I think javascript-eslint causes the problem. So, How do I select another flycheck checker or just disable automatically flycheck when I open *.html.erb files on web-mode?


texts: How to prevent Emacs from moving my mouse pointer out of the way?

texts: I'm using Spacemacs on MS Windows (msys2 build) and when a tooltip pops up Emacs seems to move my mouse pointer out of the way. How can I prevent this automatic movement?


texts: How to center the current line vertically during Isearch

texts:
During search and especially search-and-replace it would be nice to have the surrounding lines as context. But when jumping to the next hit, the cursor sometimes ends at the lowest visible line (or even worse at a corner).

I would like the text to follow the cursor during search. Is there a way to do this?

This question is similar to this one, but I don't want that all the time but only when jumping during search


texts: How can I have an agenda timeline view of multiple files?

texts:
I'm using org-mode as a knowledge base, where each file is for a specific project that I'm working on.

Each file has its own journal and I would love to see an aggregated journal of all the things I've done.

That information is in a bunch of .org files in a specific directory.

The functionality I'm looking for is what the agenda timeline provides, but it only works for one file.

Is there a way to make it work for all files in org-agenda-files?


texts: Can't mark specific folder in all subfolders in dired mode

texts:
Emacs 26.1
Windows 10,
Dired

Show content of folder "myproject". All files and subfolders.
M-x dired-maybe-insert-subdir (C-u i) -R
and here result

Nice.

Now I want to mark only folder build

%m
^build$

But I get  message:

0 matching files marked

Why?


texts: org-src-mode is not being loading in the source block edit buffer

texts:
In Org mode, when attempting to edit an elisp source block such as the following:

#+BEGIN_SRC emacs-lisp
  (setq trees '(pine fir oak maple)
        herbivores '(gazelle antelope zebra))
#+END_SRC

Using the key-chord C-c ' loads the source block in a new window. Though org-src-mode is not loaded in the new buffer. So I get the message C-c ' is undefined when attempting to close the buffer and move back to Org mode. I am able to manually load org-src-mode, which works, though it would be nice for it to be loaded automatically.

I am using emacs 25.1 with no special emacs-lisp-mode or org-mode configuration.

Plus to ensure the issue was not caused by some other part of my configuration, I load the file in emacs without my init file emacs -Q and still had the issue.

With (setq debug-on-error t) the following error is shown in the debugger:

Debugger entered--Lisp error: (wrong-type-argument listp t)
  delete((org-filtered) t)
  remove((org-filtered) t)
  org-move-to-column(0)
  org-edit-src-code()
  org-edit-special(nil)
  funcall-interactively(org-edit-special nil)
  call-interactively(org-edit-special nil nil)
  command-execute(org-edit-special)

Any suggestions on how to resolve the issue?


texts:
Problem

I've recently switched to NixOS and I'm having a couple of problems with my init.el. One I think is NixOS related and so I won't elaborate here, but I can't think of any NixOS component to this one.

When I start emacs (25.3) it tells me it can't load markdown. Starting with debug-init shows the following:

Debugger entered--Lisp error: (file-error "https://melpa.org/packages/markdown-mode-20171021.1714.el" "Not found")
  signal(file-error ("https://melpa.org/packages/markdown-mode-20171021.1714.el" "Not found"))
  package-install-from-archive([cl-struct-package-desc markdown-mode (20171021 1714) "Major mode for Markdown-formatted text" ((emacs (24)) (cl-lib (0 5))) single "melpa" nil ((:commit . "ef6b4d9def67051f3b8cbd147b09bfaa2f7f6cdb") (:url . "https://jblevins.org/projects/markdown-mode/") (:keywords "markdown" "github flavored markdown" "itex")) nil])
  mapc(package-install-from-archive ([cl-struct-package-desc markdown-mode (20171021 1714) "Major mode for Markdown-formatted text" ((emacs (24)) (cl-lib (0 5))) single "melpa" nil ((:commit . "ef6b4d9def67051f3b8cbd147b09bfaa2f7f6cdb") (:url . "https://jblevins.org/projects/markdown-mode/") (:keywords "markdown" "github flavored markdown" "itex")) nil]))
  package-download-transaction(([cl-struct-package-desc markdown-mode (20171021 1714) "Major mode for Markdown-formatted text" ((emacs (24)) (cl-lib (0 5))) single "melpa" nil ((:commit . "ef6b4d9def67051f3b8cbd147b09bfaa2f7f6cdb") (:url . "https://jblevins.org/projects/markdown-mode/") (:keywords "markdown" "github flavored markdown" "itex")) nil]))
  package-install(markdown-mode)
  use-package-ensure-elpa(markdown-mode t nil :ensure)
  eval-buffer(#<buffer  *load*> nil "/home/garry/.emacs.d/init.el" nil t)  ; Reading at buffer position 3825
  load-with-code-conversion("/home/garry/.emacs.d/init.el" "/home/garry/.emacs.d/init.el" t t)
  load("/home/garry/.emacs.d/init" t t)
  #[0 "\205\266   \306=\203\307\310Q\202? \311=\204\307\312Q\202?\313\307\314\315#\203*\316\202?\313\307\314\317#\203>\320\321\322!D\nB\323\202?\316\324\325\324\211#\210\324=\203e\326\327\330\307\331Q!\"\325\324\211#\210\324=\203d\210\203\247\332!\333\232\203\247\334!\211\335P\336!\203\201\211\202\214\336!\203\213\202\214\314\262\203\245\337\"\203\243\340\341#\210\342\343!\210\266\f?\205\264\314\325\344\324\211#)\262\207" [init-file-user system-type delayed-warnings-list user-init-file inhibit-default-init inhibit-startup-screen ms-dos "~" "/_emacs" windows-nt "/.emacs" directory-files nil "^\\.emacs\\(\\.elc?\\)?$" "~/.emacs" "^_emacs\\(\\.elc?\\)?$" initialization format-message "`_emacs' init file is deprecated, please use `.emacs'" "~/_emacs" t load expand-file-name "init" file-name-as-directory "/.emacs.d" file-name-extension "elc" file-name-sans-extension ".el" file-exists-p file-newer-than-file-p message "Warning: %s is newer than %s" sit-for 1 "default"] 7]()
  command-line()
  normal-top-level()

This suggests to me that emacs might somehow be looking for the wrong location on melpa, since markdown-mode-20171021.1714 doesn't seem to exist there.

What I've tried

I though of deleting all trace of markdown-mode from my .emacs.d/elpa directory but I don't seem to have anything in there anyway. I've also tried installing markdown-mode system wide but nix doesn't seem to have a package for it.

Question

Is there any way to force emacs to look for the markdown-mode that is current on melpa, or otherwise get it installed? My init.el has been in its current state (or close to it) for a while without many problems.


texts: Semantic linefeeds (one sentence per line) in Emacs

texts:
I'm trying to get Emacs to insert a line break at the end of each sentence as I type. (Why? Makes for easier version control of tex files.)

Looking around I found a few places with some suggestions for how to do something similar.

This question's answers are mostly suggestions for how to take a document and insert line breaks after each sentence after the fact.
This question is asking for a slightly different feature, viz. having Emacs insert two spaces after each sentence.

In an answer to the second question, abo-abo suggests something like this:

(defun electric-space ()
  (interactive)
  (if (looking-back "\\w\\.")
      (insert " "))
  (self-insert-command 1))

(defvar electric-space-on-p nil)

(defun toggle-electric-space ()
  (interactive)
  (global-set-key
   " "
   (if (setq electric-space-on-p
             (not electric-space-on-p))
       'electric-space
     'self-insert-command)))

A small change to this almost allows me to do what I want: replace insert "  " with insert "%\n". One downside of this is that the point always ends up on the second column of the following line. Thus, this is what results if I call toggle-electric-space:

Hello world. %
 This is another line.

Is there an obvious way around this?

Another problem with this approach is that there are cases where . does not come at the end of a sentence (though that's easy to fix by writing, e.g. p.~23 instead of p. 23, which is good practice anyway) as well as cases where a sentence ends with something other than a period (?, !, .), etc.).

Now, it seems to me that these problems should be easy to get around in Emacs, since we have something like forward-sentence around, which is smart enough as far as I can tell to recognize that (This sentence.) ends after the closing parenthesis. But I don't know how to make use of forward-sentence in combination with the definition of electric-space above.

This package manages to do something similar to what I want. The difference is that it makes . electric, so it requires explicitly listing all the possible exceptions, i.e. all cases where a period does not end a new line. And in order to allow for sentences that do not end with a period, the package makes ? and ! electric, but I see no easy way of allowing for .) and ?), etc., to be recognized as ending sentences.

I suppose adding a condition like if (looking-back ".") in making the closing parenthesis electric might work... I'll need to study that package more careful and see how I could modify it to suit my purposes. But being effectively a lisp illiterate, I'd appreciate any pointers you may have.

Update

The way to implement abo-abo's suggestion should instead be this:

(defun electric-space () ; Trying to get Emacs to do semantic linefeeds
  (interactive)
  (if (looking-back (sentence-end))
      (insert " %\n")
       (self-insert-command 1))
       )

(defvar electric-space-on-p nil)

(defun toggle-electric-space ()
  (interactive)
  (global-set-key
   " "
   (if (setq electric-space-on-p
             (not electric-space-on-p))
       'electric-space
     'self-insert-command)))

I don't know if there's a more elegant way to do this, but for now it seems to work.


texts: Is it possible to auto-save a file when focus is switch to another tab?

texts:
I am not sure that this possible but I have I two splitted panes while using tmux inside iTerm2 and I am using emacs daemon. I am using iTerm's keybinding to switch between tabs.
One one of them emacs is open and on the another one shell is open.
---------------
|file  |$     |
|      |      |
|      |      |
---------------

I usually make a change on the file and switch to other tab (that is on shell) to run the test.

During this whenever I switch to other tab is it possible for emacs to save the file automatically triggered by the iTerm's keybinding to switch between tabs without using C-x C-s?

If not from the shell can I force emacs save all its open files right before running its tests?


texts: Making counsel-find-file not open dired on ./

texts:
I sometimes "accidentally" hit TAB again when I've already completed myself into a subdirectory. This means the current dir ./ is highlighted and ivy opens it with dired.

This is basically never ever ever what I want to do. I will do it one million times by accident for every time I actually want to open ./ with dired. So I rebound TAB from ivy-partial-or-done to ivy-partial. But this means ivy doesn't actually enter subdirs on TAB, it just completes them. This works, but forces an extra RET press every time I want to enter a subdir.

So what I basically want is the default behaviour, BUT have ivy special-case ./ by doing nothing. Is this possible?


texts:
I asked another question yesterday but this bothers me a little. I use 4 spaces as indentation for programming (ShellScript, C and Python, mostly). When I want to delete the 4 spaces, I had to do one by one. When I was using vim, I didn't have to do in that way.

What I want to set up is that, when you put the cursor at the beginning of the first word after indentation and press DEL, it deletes the 4 spaces at once.

An example:

int main () {
    ▮int a = 0;
    if (a = 0) {
        printf("Hello!");
    }
    return 0;
}

int main () {
▮int a = 0;
    if (a = 0) {
        printf("Hello!");
    }
    return 0;
}

(Suppose that ▮ is with the i).

Is it possible to do that in emacs?

Result of doing C-u C-x = on the indentation:


texts:
Getting this on running ./configure on Ubuntu 20.04 for the new 27.1 install
...
checking for X... no
checking for X... true
configure: error: You seem to be running X, but no X development libraries
were found.  You should install the relevant development files for X
and for the toolkit you want, such as Gtk+ or Motif.  Also make
sure you have development files for image handling, i.e.
tiff, gif, jpeg, png and xpm.
If you are sure you want Emacs compiled without X window support, pass
  --without-x
to configure.

I've been running 26.3 just fine with X. I should have all the necessary libs from that install. What should I do here?


texts: org-mode: How can noweb handle a multiple line output

texts:
I have a code chunk in my document that I want to use as a list of patterns to search for with grep.

If I were just writing a script without org-babel, I could write.

a="ar
er
ir
or
ur"

printf "Four\nscore\nand\nseven\nyears\nago" | grep -F "$a"

And the results would be

Four
score
years

But instead of $a, I want to use the output of an earlier code block.

#+NAME: vowel_r
#+BEGIN_SRC sh :shebang "#!/bin/bash" :results verbatim
a="ar
er
ir
or
ur"
echo "$a"
#+END_SRC

#+RESULTS: vowel_r
: ar
: er
: ir
: or
: ur

I would have thought that this would work.

#+BEGIN_SRC sh :shebang "#!/bin/bash" :noweb yes
printf "Four\nscore\nand\nseven\nyears\nago" | grep -F "<<vowel_r()>>"
#+END_SRC

But it throws the error.

/tmp/babel-4438QgK/sh-script-4438Wst: line 8: unexpected EOF while looking for matching `"'
/tmp/babel-4438QgK/sh-script-4438Wst: line 9: syntax error: unexpected end of file

By looking at the code with C-c C-v v, it seems that noweb is treating each line of the output separately, instead of as a multi-line string.

printf "Four\nscore\nand\nseven\nyears\nago" | grep -F "ar
printf "Four\nscore\nand\nseven\nyears\nago" | grep -F "er
printf "Four\nscore\nand\nseven\nyears\nago" | grep -F "ir
printf "Four\nscore\nand\nseven\nyears\nago" | grep -F "or
printf "Four\nscore\nand\nseven\nyears\nago" | grep -F "ur
printf "Four\nscore\nand\nseven\nyears\nago" | grep -F ""

Removing the quote marks around <<vowel_r>> just leads to a grep error.

How can I get noweb to treat the output of the earlier block as a multi-line string, instead of handling each line separately?

Thank you!


texts: My question is how to customize this kind of blocks' background color?


texts: bookmark+: The bookmark specific jump handlers don't work: `(wrong-type-argument listp bmkp-dired-history)`

texts:
I have bookmark+ Version: 2020.12.29
When I try to jump to a dired bookmark (bmkp-dired-jump), I get the error:
In ‘bmkp-dired-jump History’ source: ‘#[0 \304\302\300\305\303$\211\205\0\306\307\310\301""\207
[nil nil bmkp-dired-history t helm-comp-read-get-candidates nil delete  helm-cr-default] 6]’
 (wrong-type-argument listp bmkp-dired-history)

When I change the expression:
(list (bmkp-read-bookmark-for-type "Dired" alist nil nil 'bmkp-dired-history)
   current-prefix-arg)

to
(list (bmkp-read-bookmark-for-type "Dired" alist nil nil nil)
   current-prefix-arg)

in the function bmkp-dired-jump, it works as expected.
I don't understand the use of the symbol 'bmkp-dired-history since it doesn't seem to be bound anywhere?
Is this a problem of my setup or a problem with bookmark+ and how can I solve it?


texts: something like delete-frame but that would also delete the last frame -- like alt+f4

texts:
I would like a more handy shortcut to basically the system's alt-f4 to close the current emacs window. delete-frame is not far from that, but it refuses to close the last frame: Attempt to delete the sole visible or iconified frame.

How could I get a function that would override that safety? Note that I'm using emacs-client with emacsclient -c "$@" --alternate-editor= & and I would like that the server stays running -- with is the behaviour with alt-f4.

I'm not interested in OS shortcuts because I'm using spacemacs and I can get better shortcuts, like SPC o F for instance.


texts: problem of loading a package at emacs startup

texts:
According to Emacs Eclim, I added the following to ~/.emacs.d/init.d for emacs-eclim:

(require 'eclim)
(global-eclim-mode)

; If you want to control eclimd from emacs, also add:
(require 'eclimd)

The output of emacs -nw --debug-init is:

Debugger entered--Lisp error: (file-error "Cannot open load file" "eclim")
  require(eclim)
  eval-buffer(#<buffer  *load*> nil "/home/tim/.emacs.d/init.el" nil t)  ; Reading at buffer position 4117
  load-with-code-conversion("/home/tim/.emacs.d/init.el" "/home/tim/.emacs.d/init.el" t t)
  load("/home/tim/.emacs.d/init" t t)
  #[0 "^H\205\262^@     \306=\203^Q^@\307^H\310Q\202;^@ \311=\204^^^@\307^H\312Q\202;^@\313\307\314\315#\203*^@\316\202;^@\313\307\314\317#\$
  command-line()
  normal-top-level()

If I add the following line at the beginning:

(add-to-list 'load-path "~/.emacs.d/elpa/emacs-eclim-20140809.207/")

(require 'eclim)
(global-eclim-mode)

; If you want to control eclimd from emacs, also add:
(require 'eclimd)

The output of emacs -nw --debug-init is:

Debugger entered--Lisp error: (file-error "Cannot open load file" "s")
  require(s)
  byte-code("\300\301!\210\300\302!\210\303\304\305\306\307\310%\210\311\312\313\314\315\316\307\304&^G\207"
[require etags s custom-declare$
  require(eclim)
  eval-buffer(#<buffer  *load*> nil "/home/tim/.emacs.d/init.el" nil t)  ; Reading at buffer position 4115
  load-with-code-conversion("/home/tim/.emacs.d/init.el" "/home/tim/.emacs.d/init.el" t t)
  load("/home/tim/.emacs.d/init" t t)
  #[0 "^H\205\262^@     \306=\203^Q^@\307^H\310Q\202;^@ \311=\204^^^@\307^H\312Q\202;^@\313\307\314\315#\203*^@\316\202;^@\313\307\314\317#\$
  command-line()
  normal-top-level()

If I instead add a different line at the beginning, it works without
error:

(package-initialize)

(require 'eclim)
(global-eclim-mode)

; If you want to control eclimd from emacs, also add:
(require 'eclimd)

If I add both lines at the beginning, it also works:

(add-to-list 'load-path "~/.emacs.d/elpa/emacs-eclim-20140809.207/")
(package-initialize)

(require 'eclim)
(global-eclim-mode)

; If you want to control eclimd from emacs, also add:
(require 'eclimd)

I wonder what the two lines I added do, and why they can work or not work? Thanks.


texts: Recursively list all files and sub-directories

texts:
Is there a way, possibly using a package, to recursively list all the files (with paths) and sub-directories (or at least the empty sub-directories, since the paths to the non-empty ones can be gleaned from the paths of the files contained therein) of the current directory?

The closest I could find is the projectile-find-file function of the projectile package (alternatively, the helm-projectile-find-file function of the helm-projectile package), but it doesn't seem to be able to list empty folders. Additionally, it seems to work only with Git and other version control repositories, but there may be a workaround for this limitation.


texts:
When I'm using remote X forwarding to run X toolkit emacs and I press C-SPC and move the cursor around, things get very slow. The emacs profiler says all the time is spent in line-move-visual, but I don't think that's it. I think it's an issue with the highlighting being expressed inefficiently at the X layer because it only happens when remoting.

transient-mark-mode help says it uses the region face to decide the color:

  Transient Mark mode is a global minor mode.  When enabled, the region
  is highlighted with the region face whenever the mark is active.

But it doesn't indicate there's any way to toggle the rendering. My thinking is I want to throttle how quickly it will highlight (e.g. wait for 50ms of idleness) since usually I'm highlighting several lines or characters and all the intermediate renderings are going to be short lived.

Is there any way to do this? I assume I have to keep the mode active to not affect editing.


texts: How to get variable type definition in lsp for using in Lisp code?

texts:
I want a helper command for refactoring code in Go language. I have not found ready for use function for this task in go-mode and lsp. It should declare variable from the word under the point and place it as a type definition for example in the previous row. In Go syntax it looks like: var name type where name is a variable name and type is a variable type.
I have got the code:
(defun my-go-declare-var ()
  "Insert var declaration."
  (interactive)
  (let ((name (current-word)))
    (previous-line)
    (insert "var " name " <type>")))

It looks for current word and inserts it on previous line.
The problem is how to get the type of my variable? I tried to find appropriate lsp functions but not found any that returns the type in plain text. Also lsp-ui shows the hint with variable type in echo area:

But I can't understand how to catch it.


texts: Is there any way to hide agenda date header?

texts:
If i set (org-agenda-format-date "") it still shows empty line.
If i set (org-agenda-overriding-header "") i get org-agenda-list: Args out of range: 0, 1 error.


texts: Is it possible to get ESS to display results of help(package=xxx) in a new buffer, like it does for ?xxx?


texts:
I'm trying to connect and edit files on my openwrt box.
But every time I tried Emacs shows me a blank buffer.

C-x C-f /ssh:user:192.168.200.1:/etc/config/network RET

the filesystem on openwrt

cat /proc/filesystems
nodev   sysfs
nodev   rootfs
nodev   ramfs
nodev   bdev
nodev   proc
nodev   tmpfs
nodev   debugfs
nodev   securityfs
nodev   sockfs
nodev   bpf
nodev   pipefs
nodev   devpts
    squashfs
nodev   jffs2
nodev   overlay

edit: Hi I did a typo on the original question.

I've use this
/ssh:user@192.168.200.1:/etc/config/network

same error.

If I use /ssh:root@192.168.200.1:/etc/config/
I get into dired mode but when I select the file again blank buffer.

Doing the same on the terminal outside emacs all works.


texts: I just installed Fedora 24 with Emacs and IPython. When I launched the IPython shell in Emacs, the prompt symbol, which should be "In [1]", is displayed as "^[[?12l^[[?25h". Is there a way to solve this issue?


texts:
Is it possible to have a global prettify-symbols-alist that other modes add to?
A lot of major modes override prettify-symbols-alist instead of pushing into it.
One solution I thought of is to push the global entries in a hook that runs after the buffer and its mode have initialized. I don't know of such a hook, unfortunately.


texts: Why TAGS file is loaded/visited automatically if it exists in project root directory?

texts:
If the root of the project has a TAGS file, and I load/visit a file FOO from this dir into a freshly started Emacs, Emacs loads/visits two files, and the buffer list shows FOO and TAGS.

I also get a message Starting a new list of tags tables.

Is this a normal behavior?

Edit: this seems to happen when projectile-mode is enabled. Is this related?


texts: How do I get a fancier mode line that uses solid colors and triangles?

texts:
People occasionally post screenshots with modelines that have solid colors and triangles:

How do I replicate this effect?


texts: Org-Mode: Using Source Code Blocks in Table Formulas

texts:
I would like to use source code blocks in org-mode table formulas using something similar to:

#+NAME: square
#+BEGIN_SRC python :var x=0
return x**2
#+END_SRC

| 1 | 1 |
| 2 | 4 |
| 3 | 9 |
#+TBLFM: $2=$square($1)

Is there any way to accomplish this?


texts: How to give user free rein to edit a buffer in the middle of lisp code?

texts:
I'm trying to run some code, a little like this:

(defun myfun ()
  (message "one")
  (user-does-things)
  (message "two")

I would like the code to do this:

display "one"
let the user edit in another buffer
When the user is done editing, display "two"

All my attempts so far have just displayed "one" and "two", leaving the user to do his editing after the code has finished running.

I'm also OK with a more disconnected approach, such as "I launch a buffer with a custom keymap so the user is able to do whatever they want in emacs until they hit a keybinding which calls back to my custom code" - I could use some help to do this as well though :D


texts:
Using emacs 24.3-22 on CentOS 7.6.1810. Writing to home directory on cifs mounted share.

When writing a file auto-saves will work, but actually clicking the save button or doing Save As gives IO Error writing filename: Input/Output error

Although Save As gives an IO error, the new file is saved. However subsequent attempts to update that new file fails with IO errors

I started Emacs with the --debug-init option, but it didn't reveal anything.
I also checked the logs on the network server, it shows the files being opened, saved, and closed. No errors we seen on that end.

I would like to know if anyone has encountered this problem or what other troubleshooting steps can I take.


texts:
Is there a way to bind a key in a mode defined using define-generic-mode such as xmodmap-generic-mode? Generic does not appear to create keymaps.

ELISP> (require 'generic-x)
generic-x
ELISP> (let (result)
     (mapatoms
      (lambda (sym)
        (when (and (boundp sym)
               (string-match-p "generic.*keymap$" (symbol-name sym)))
          (push sym result))))
     result)
nil


texts: org-noter: how to jump to place without moving cursor

texts: When in org-noter, how to jump to the PDF place of the annotation without moving the cursor to the PDF (usually I don't need to move the cursor, but I want to continue jumping to other PDF places). With pdftools, one can do this using the space bar.


texts: solve error: variable is void: projectile-mode-map

texts:
I'm trying to bind projectile-find-file to a keyboard shorcut and running in to this error.
Apparently projectile is installed, because M-x listing shows at least a dozen projectile prefixed commands.


texts: What's the right order of the settings on init file?

texts:
I've had an annoying moment with emacs (GUI). I'm a newbie and now I'm trying to use emacs for writing, so I need spell checking. Well, the consensus is flyspell. In order to load flyspell when starting up emacs with Org mode I've added the next settings:

(dolist (hook '(text-mode-hook))
    (add-hook hook (lambda () (flyspell-mode 1))))

But when I restarted emacs, flyspell did not work. The problem was the order of the settings.  Here  is a part of my init file:

;;--------------------------
;; CONFIG
;;--------------------------

;;Open notes files
(find-file "/home/pcuser/notes/notes.org")

...

;; Flyspell
(dolist (hook '(text-mode-hook))
   (add-hook hook (lambda () (flyspell-mode 1))))

When I change the order to do the flyspell part first, and then (find-file "/home/pcuser/notes/notes.org") it all works.

The big questions is: Why? And... What's the right order of the settings in the init file? For me, the last question is very important, because in the future I will add many custom settings and I don't want to guess the order of settings:  maybe there exists a format, consensus or documentation for writing the init file of emacs.

Soft Specs:

OS: Debian 10

Emacs: 26.1


texts: Run an external program with customized environment/options in current buffer

texts:
How can I organize Emacs to run a specific external program with some specific environment/options for the mode or the buffer currently open.

My current solution is to use setenv before running the external program, however it seems to change the environment for all the buffers in Emacs.

Example

To work around a bug in Groovy 3.0.0 (see below) I need to set some java option before running groovysh. In terminal, I can do the following:

JAVA_OPTS=--add-opens=java.base/jdk.internal.jrtfs=ALL-UNNAMED groovysh

However, Emacs run groovysh thanks to run-groovy function from the inf-groovy.el file in groovy package. So I usually run eval-expression with:

(setenv "JAVA_OPTS" "--add-opens=java.base/jdk.internal.jrtfs=ALL-UNNAMED")

which solves the problem, the inferior Groovy process is now working.

However, all my other buffers now use this value for this environment variable which is not desirable, since I need some other specific java options for other codes. My current solution is to invoke setenv every time I change buffer.

groovysh 3.0.0 not working with jdk 11.0.6

Open a simple file in groovy mode and try to run-groovy

With Groovy 3.0.0 and JDK 11.0.6 installed it raises an error:

java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:111)
    at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:129)
Caused by: java.lang.IllegalAccessException: class org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite cannot access class jdk.internal.jrtfs.JrtFileSystem (in module java.base) because module java.base does not export jdk.internal.jrtfs to unnamed module @6d4e5011

It took me a while to figure out that it was a problem due to version incompatibility between groovy and java, see https://issues.apache.org/jira/browse/GROOVY-9390


texts:
When I try to trash a remote directory, either through dired or with delete-directory, Tramp just deletes it.  If I try to trash a remote file, it does trash it properly.

I have delete-by-moving-to-trash set to t.  If I call tramp-get-remote-trash for my remote host, it returns "\\trash".

I've been stepping through the calls, and it ends up calling tramp-sh-handle-delete-directory, which doesn't seem to have a trash option.  I wonder if things aren't going wrong in delete-directory, where the cond clauses are ordered such that the file name handler is found and called without a trash argument before the clause which handles trashing a directory.  But I might not yet understand this code properly.

Does anyone know how to get Tramp to trash a remote directory properly?


texts: How do I view an image in a new buffer in emacs?

texts:
I have the path to a pdf file or a png file (whichever is easiest to show, but bonus points for showing both).

How do I show the image in a new buffer? (It makes no sense to show it inline since it is a graph representation of the makefile I am writing.)


texts: Why in compilation-mode do my go (golang) compile errors not include the column on goto-error?

texts:
When I compile a simple (incorrect) go program like this from emacs

package main

func main() int {
}

I get this result

-*- mode: compilation; default-directory: "~/Go/" -*-
Compilation started at Mon Aug 12 22:37:46

go run assert.go
# command-line-arguments
./assert.go:3:6: func main must have no arguments and no return values
./assert.go:4:1: missing return at end of function

Compilation exited abnormally with code 2 at Mon Aug 12 22:37:46

The problem is easier to see in a screenshot

Notice how only the part of the filename and line number up to the second : is red.  This means that when I use goto-error emacs jumps to the start of the line, whereas the compile info has the column in it too.

This looks like a pretty standard compiler output so I would have thought emacs should be doing this by itself.

Is this a bug?  Or is it something I should be configuring?

I'm using emacs 1:26.1+1-3.2ubuntu2 from ubuntu 19.04.


texts:
I have a decent number of different org files I use to store useful information.
I can easily search and navigate org files.

Lately I've been reading the emacs (and other packages) manual which is in GNU "Info format". I'm considering converting some or all of my personal notes into Info format to see if I can improve my workflow.

I like the idea that Info format is the standard emacs manual format but org-mode has a lot of capability and is really flexible for changing or moving content. It has tables, latex support etc that are all really nice features.

What are the advantages of "Info format" compared to org mode?


texts: does anybody know this light-blue emacs theme's name?

texts:
emmm.
i just found through all the MELPA by keywords theme,
but still cant find this theme, if someone can point out,
i'll appreciate a lot, i love this theme very much.


texts: While in the log buffer, is there a way to move the cursor directly to the HEAD commit?


texts: dired not showing recently created files when emacs is run in daemon mode

texts:
When running emacs in daemon mode, a directory listing using dired does not seem to show the latest created files.

What could be the cause of this issue, and how can I fix it?


texts:
Does anyone know how to add a column to helm-buffers-list ?

I try to hack it, but just find helm-buffers-list-cache contains
buffers names and can't find how to add size or directory (which exists
acquiescently)

(defclass helm-source-buffers (helm-source-sync helm-type-buffer)
   ((buffer-list
   :initarg :buffer-list
   :initform #'helm-buffer-list
   :custom function
   :documentation
   "  A function with no arguments to create buffer list.")
    (init :initform 'helm-buffers-list--init)
    (candidates :initform helm-buffers-list-cache) ;;****!!!!!here is candidates
    (multimatch :initform nil)
    (match :initform 'helm-buffers-match-function)
    (persistent-action :initform 'helm-buffers-list-persistent-action)
    (resume :initform (lambda ()
                   (run-with-idle-timer
                    0.1 nil (lambda ()
                              (with-helm-buffer
                                (helm-force-update))))))
    (keymap :initform helm-buffer-map)
    (migemo :initform 'nomultimatch)
    (volatile :initform t)
    (resume :initform (lambda () (setq helm-buffers-in-project-p nil)))
    (help-message :initform 'helm-buffer-help-message)))

How can I modify helm-buffers-list?


texts: Send org-mode subtree to certain file, and headline

texts:
In many case, I often wants to send a org-mode subtree to certain file, at certain headline.  Here is an example workflow of such todo:

Let's say I capture any todos to inbox.org first, as many todos occur asynchrounously, those pops into my mind.  Later, I view them in the agenda file, and start dispatching them into more adequate org file, at adequate headline (e.g. projecta.org, * todo heading)

I wondered if I can achieve this in a existing elisp.  In more systematical description, I imagine it to be like an org-capture, but it does not create a new entry; it sends current subtree to the whatever defined destination.

Is there any such feature?


texts:
When searched for space repetition mode for emacs org-drill is the one google lists and looks popular but org-learn is written by the current maintainer of emacs John Wiegely. Its hard to choose one over another without knowing the pros and cons of each package.

 Those who have tried both please list the pros and cons of both the packages?.


texts: How can I change the installation folder for Melpa packages?

texts:
I have just started using Melpa, and I installed the first package. The package though goes to the folder

~/Library/Preferences/Aquamacs Emacs/Pakcages/elpa/

but I would prefer if it went to my .emacs.d/packages folder.

Is there a way to do that or is it not advisable for some reason? If not advisable, is there a way to ensure that if I use another computer that I still have that package installed so that the configurations are the same?

This is what I put on my .emacs file to get Melpa working as per this answer

;; Package installation - MELPA
(require 'package) ;; You might already have this line
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line


texts: Calling shell-command from org-capture-templates to scrape verb conjugations

texts:
I want to use org-capture-templates to scrape french verb conjugations from the web and insert them into an org-file to use with org-drill.

I have a (functioning) scraper that gets the desired data from www.verbix.com and prints out the preformatted conjugations like so:

    ** Indicatif
    *** Present
    | je ... | tu ...|
    |  ....  |  ...  |

I would like to call this python script from my capture using shell-command.

Here is my lisp function:

    (defun my-french-verb-template ()
    "Capture template for French verbs"
      (let* ((arg (org-completing-read-no-i "Verb: " nil))
             (conjugations (shell-command (concat "python2 ~/Nextcloud/05Code/python/verbix_scraper.py " arg))))
      (format "** Verb: %s :drill:\n    :PROPERTIES:\n    :DRILL_CARD_TYPE: french_verb\n    :END:\n*** Infinitive\n %s\n%s\n"
          arg arg conjugations)))

and my capture template:

    ("f" "French verb" entry (file+headline "~/Nextcloud/org-mode/brain/french.org" "Verb")
         (function my-french-verb-template))

Evaluating just

    (shell-command (concat "python2 ~/Nextcloud/05Code/python/verbix_scraper.py " arg))

from a scratch buffer prints out the desired output in a new minibuffer. However, calling org-capture-template will only print 0.

I think the problem is that shell-command will use a minibuffer to output the result from the shell command. How can I insert the result in the capture buffer?

Calling shell-command with (current-buffer) will replace whatever buffer I am in when I call the capture-template.

Any ideas? The documentation is not helping so far.

Edit 1:

I have also tried redirecting the result from shell-command to 'CAPTURE-french.org', but then my capture buffer will be renamed to 'CAPTURE-2-french.org'.

So I can think of two possibilities:

1) Delay the evaluation of (shell-command ...) until the capture buffer has been created.

2) Specify a (scratch) output buffer to catch the text from (shell-command ...) and then bind the buffer content to a variable which I insert in the capture buffer.

But I cannot think of a way to do this in emacs...

Edit 2:

lawlist's solution worked for me: using shell-command-to-string works pretty flawlessly for me and I now have a working capture which lets me type in a french verb as infinitive and then scrapes conjugations from the web and inserts them into my french-vocab.org file. #STARTUP: align takes care of table formatting. SAWEEEET!


texts:
In my config file, how do I set the frame title so that it shows:

The buffer name
If a file buffer, show the path to the file without the filename

So something like this:

.emacs.el -- D:\Dropbox\dotfiles


texts: detecting obsolete/deprecated settings in elisp files, particularly .emacs

texts:
I recently got bitten by a  deprecated setting breaking a new package I was trying to use.
The same behaviour had been reported by a number of users before me,
but the authors were unable to reproduce the problem
and the prior reporters were unable to isolate the problem.

Is there any mechanism for detecting out of date settings and other constructs in elisp files?

I am primarily thinking about customization settings, but this really applies to elisp code in general


texts: Emacs mail - The TLS connection was non-properly terminated

texts:
I am trying to send mail through emacs via my gmail account. I understand that this means it is senting using SMTP.

However, when I go through the basic steps to send mail through my gmail account,

gnutls.c: [0] (Emacs) fatal error: The TLS connection was non-properly terminated.

I am following the information found here which seems very easy, however I get that error.

At first I got a warning from google about a suspicious sign in attempt, but I have enabled that and now get this strange TLS issue.


texts: Where does the Python shell from `run-python` store its input history?

texts:
As in the question title, I want to know where the inferior Python shell stores its command history (the history you cycle through through with the up arrow).

I've been searching high and low. I'm trying to make this variable persistent using savehist-additional-variables, but I can't find the variable. I've looked for all variables containing history, ring, command, input, etc, and none of them have been it. The few I thought might be it all were valued nil despite my having stuff in my command history that I could cycle through.


texts: Scrolling seems to add an unwanted chunk into my kill ring

texts:
Anybody know why this may be occurring?

Here is an outline of how I recreate the issue...

I copy or kill something to my kill ring.
I scroll up or down with the mouse.
I then yank and get an unexpected chunk of code
Pressing M-y steps back one position in the kill ring and I get what I wanted to yank.

Here is my config file. Something in there must be doing it I'm guessing.


texts: How can I protect Org spreadsheet columns from calculation?


texts:
I am trying to customize emacs/spacemacs to run a command after a key stroke, like running eslint --fix command on the buffer to fix errors.

I already tried

(defun fix-errors-with-eslint ()
  (shell-command-to-string (format "eslint --fix %s" buffer-file-name)))
(global-set-key (kbd "s-f") 'fix-errors-with-eslint)

but i receive an error: Wrong type argument: commandp, fix-errors-with-eslint

I am an emacs beginner, using only basic spacemacs and its layers, any help appreciated.


texts:
I want to add a last-reviewed date for some headings.
And in org agenda view, I want to filter outer the headings that have not been reviewed for some days.
What's the org tools/functions/setup that are involved here?


texts: Why does emacs put a black background on comments?

texts: For some reason emacs shows comments on a black background. The image shows an example from my emacs with the otherwise amazing color theme "aalto-dark" from the color-theme-modern package. I don't like how the comments look. Is the black background a part of the color theme, or is it some other configuration in my .emacs file that creates this? How do I get rid of it?


texts: Multiple Quit messages in my *Messages* buffer

texts:
When I hold C-p or C-n to navigate any page, the movement is jerky and I get multiple Quit messages in my *Messages* buffer.

I checked the C-h l to see the commands ran, it only has the C-n [next-line] I expect.

This does not happen in Org mode, but it happens in many of the programming modes.
For example, in YAML mode, it happens.

Here is my list of all active modes where this is happening.

Enabled minor modes: Ansible Ansible-Doc Async-Bytecomp-Package
Auto-Composition Auto-Compression Auto-Encryption Clean-Aindent
Column-Number Delete-Selection Diff-Auto-Refine Discover Display-Time
Electric-Indent Emojify File-Name-Shadow Flycheck Flycheck-Pos-Tip
Flyspell Font-Lock Gdb-Many-Windows Global-Auto-Complete
Global-Auto-Revert Global-Discover Global-Eldoc Global-Emojify
Global-Flycheck Global-Font-Lock Global-Git-Commit Global-Hl-Line
Global-Magit-File Global-Pointback Global-Semantic-Idle-Scheduler
Global-Semanticdb Global-Smart-Shift Global-Smart-Tab Global-Undo-Tree
Golden-Ratio Goto-Address Helm Helm-Autoresize Highlight-Indentation
Keyfreq Keyfreq-Autosave Line-Number Magit-Auto-Revert Magit-File
Mouse-Wheel Nyan Override-Global Persistent-Scratch-Autosave Pointback
Projectile Pyvenv Recentf Semantic Shell-Dirtrack Simpleclip
Size-Indication Smart-Shift Smart-Tab Tooltip Transient-Mark Undo-Tree
Volatile-Highlights Which-Key Winner Yas Yas-Global

Any ideas on what might be causing this?

Using M-x toggle-debug-on-quit gave me this:

Debugger entered--Lisp error: (quit)
redisplay_internal\ \(C\ function\)()

I have shared my full init.el here - https://gist.github.com/darshanime/c65b4bb318db722a66b42753f1bc4041


texts:
I've just started to use org-mode in emacs (spacemacs). One simple thing that is confusing me is how to quickly access my org files. What is a solid and simple strategy for quickly pulling up a list of org files?
By way of example, let's say I have a directory where I store org files (though the solution I'm looking for would hopefully work for multiple directories). I want to be able to quickly access that directory, search for a specific file, and load it.  How would I do that?
The functionality I am thinking of here is similar to that the the projectile project provides for a coding project...


texts: I know about kill-matching-buffers but that searches buffer names, I want instead to search buffer modes. For example, I might want to kill all buffers that have "notmuch-" or "[Notmuch]" as substrings in the mode column in the *Buffer List*.


texts:
For what I do I tend to define a lot of functions that I use temporarily. Life span is usually about 1-2 weeks - and then I define a new set of functions.

I was not able to find where these definitions actually are, nor how to delete them just by supplying a function name (which would be useful).


texts:
It's really handy to get stuff calculated in minibuffer using quick-calc (C-x * q) - I especially like that it automatically copies the result into buffer so it's just one C-y away.

Now the questions is - can I get all this goodness via emacsclient? Just printing out the results of calculating some string would be nice but having it in clipboard as well - even better.


texts: Using variables on org-publish-project-alist

texts:
I am having some trouble setting my org-publish blog. Basically I have the following config, but when I try to publish I get the following error:

Wrong type argument: stringp, (\, publish-directory-path)

So what this means to me is that, the :publishing-directory property is expecting a string, and I am not giving it a string, even though clearly the variable publish-directory-path is a string.

I have been going crazy with this. Any idea on what is happening?

(defvar publish-directory-path "~/Projects/Public/")

(setq org-publish-project-alist
      '(("org-notes"
     :base-directory "~/Projects/blog/"
     :base-extendion "org"
     :publishing-directory ,publish-directory-path
     :recursive t
     :makeindex t
     :html-postamble nil
     :publishing-function org-html-publish-to-html
     :auto-sitemap t
     :html-link-home "theindex.html"
     :html-link-up "theindex.html"
     :sitemap-filename "theindex.org"
    )
     ("org-static"
     :base-directory "~/org/"
     :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
     :publishing-directory "~/Projects/Public/"
     :recursive t
     :publishing-function org-publish-attachment
     )
     ("org" :components ("org-notes" "org-static"))
))


texts:
I want to make my ibuffer not to be pompted.

So it is my config for ibuffer

(setq ibuffer-expert t) ;; disable prompt when deleting modified buffer.
(add-hook 'ibuffer-hook (lambda ()
              (ibuffer-auto-mode 1) ;; keeps ibuffer list up to date
              (setq ibuffer-show-empty-filter-groups nil) ;; don't show empty group
              (ibuffer-vc-set-filter-groups-by-vc-root)
              (ibuffer-do-sort-by-recency)))

first line of it I setted ibuffer export to true.
But I open ibuffer then I execute to kill modified buffer or special buffer like multi-term. It is still asked to prompt.

What is problem?


texts: Better hook for a function activating a mode when there is only one window

texts:
As @drew asked me to do here I'm asking one question per problem
I'm trying to enable/disable visual-fill-column when there is one window/multiple windows.
(defun my-visual-fill-one-window ()
  (global-visual-fill-column-mode -1)
  (if (one-window-p)
      (global-visual-fill-column-mode 1)
    (global-visual-fill-column-mode -1)
    )
  )

(add-hook 'window-state-change-hook 'my-visual-fill-one-window)

I'm hooking it to window-state-changed-hook because it looked like the most suited one but maybe I could do better (the main problem being that if I use ivy-posframe it's considered as a second window, the mode is disabled, the text is instantly flushed to the left and as soon as the posframe is closed the mode is enabled again and the text centered)


texts: I want to get rid of invalid recentf entries, that is buffers that no longer exist on disk, because I renamed or just plain deleted them ; I just did a M-x recentf-cleanup and apparently lost all my history :/ what would be a sure and safe way to clean this list up?


texts: How to get fill-paragraph in a scala multi-line comment to wrap?

texts:
Emacs is my weapon of choice for documenting code, not least because of its great support for formatting comments. However, there is one thing that is slowing me down in scala-mode2. When I have a line that starts with an @param annotation the fill-paragraph function does not wrap the line. If I remove the @ from the @param then the fill-paragraph works. So I find myself writing some docs about a parameter, removing the @ from @param, running fill-paragraph, and then adding the @ back in.

Here's an example:

/**
 * param without the leading @ character fill-paragraph is happy to
 * wrap this line.
 *
 * @param with the leading @ character fill-paragraph is refuses to wrap this line.
 */
class BlahBlah

The only Scala customization variable I have set is (scala-indent:use-javadoc-style t). The issue persists when set to nil.

I'm using emacs 24.5.1 with the latest scala-mode2 from the public repos (20150617.2350) -- just upgraded from a 201407 version that had the same problem.


texts: Do not automatically sign emails directed to mailing lists and such

texts:
I configured emacs to automatically sign emails:

(add-hook 'mu4e-compose-mode-hook 'mml-secure-message-sign)

However, mailing lists often add a footer to the message and that breaks the signature.  Also some people are consistently confused by the attached signatures, and in these cases I'd prefer if the message wasn't signed.  (These people are not going to check the signature anyway.)

What's the best way to implement a blacklist of email addresses such that emails to addresses on that list are not automatically signed?


texts: Org clock quarterly report doesn't work anymore

texts:
In order to summarise my work for certain projects I use Org's clock tables:

 #+BEGIN: clocktable :maxlevel 2 :scope agenda-with-archives :block 2015-Q1 :tags "ProjectA"  :fileskip0
 #+END:

This summarises the time spent in the first quarter of 2015. However, today I tried to do this for Q3 and it seems to (partially) fail. as you can see below it Org lists the entries of Q4:

#+BEGIN: clocktable :maxlevel 2 :scope agenda-with-archives :block 2015-Q3 :tags "ProjectA"  :fileskip0
#+CAPTION: Clock summary at [2015-10-13 di 10:51], for 4th quarter of 2015.
| File               | Headline             |   Time |      |
|--------------------+----------------------+--------+------|
|                    | ALL *Total time*     | *2:08* |      |
|--------------------+----------------------+--------+------|
| todo.org           | *File time*          | *1:34* |      |
|                    | Programming          |   0:36 |      |
|                    | \_  support forum    |        | 0:36 |
|                    | Courses              |   0:58 |      |
|                    | \_  school 2016      |        | 0:58 |
|--------------------+----------------------+--------+------|
| todo_ProjectA.org  | *File time*          | *0:34* |      |
|                    | Financial            |   0:21 |      |
|                    | \_  Progress reports |        | 0:21 |
|                    | WP4                  |   0:13 |      |
|                    | \_  User support     |        | 0:13 |
#+END:

Changing Q3 to Q2 or Q1 gives the same result. It looks like the calculation of quarters is broken.
I guess this may have to do with my upgrading Org-mode to 8.3 about a month ago.

Did anyone experience this too or is it something with my setup?

[edit] I upgraded to org 20151005 from the package repo and the problem persists.

[edit 2] Using Org 8.2.10 I get the correct result, so this indeed seems to be a bug.


texts:
I want to change keywords colors of the AUCTeX package. I found the variable font-latex-built-in-keyword-classes that could help me.

If me assume I want to display the keyword "newpage" with the face new-face, I've (unsuccessfully) tried that :

(setq font-latex-built-in-keyword-classes
  '(("warning"
     ("newpage")
     'new-face 1 noarg)))

But it doesn't change nothing. How can I do that ?


texts: Why are some Chinese characters not displayed using the specified font?

texts:
I specified the font using:

(set-face-attribute 'default nil :font "Inziu Iosevka SC")

The expected result is (in notepad.exe):

But the result in Emacs is actually:

Only 举, 头 and 乡 are displayed as specified.

The result of describe-char on the correctly rendered char 举 is:

             position: 374 of 386 (97%), column: 0
            character: 举 (displayed as 举) (codepoint 20030, #o47076, #x4e3e)
    preferred charset: chinese-gbk (GBK Chinese simplified.)
code point in charset: 0xBED9
               script: han
               syntax: w    which means: word
             category: .:Base, C:2-byte han, L:Left-to-right (strong), c:Chinese, |:line breakable
             to input: type "C-x 8 RET HEX-CODEPOINT" or "C-x 8 RET NAME"
          buffer code: #xE4 #xB8 #xBE
            file code: #xBE #xD9 (encoded by coding system chinese-gbk-dos)
              display: by this font (glyph code)
    uniscribe:-outline-Inziu Iosevka SC-normal-normal-normal-mono-19-*-*-*-c-*-iso10646-1 (#x2493)

Character code properties: customize what to show
  name: CJK IDEOGRAPH-4E3E
  general-category: Lo (Letter, Other)
  decomposition: (20030) ('举')

There are text properties here:
  fontified            t

The result of descirbe-char on wrongly rendered char 床 is:

             position: 360 of 386 (93%), column: 0
            character: 床 (displayed as 床) (codepoint 24202, #o57212, #x5e8a)
    preferred charset: chinese-gbk (GBK Chinese simplified.)
code point in charset: 0xB4B2
               script: han
               syntax: w    which means: word
             category: .:Base, C:2-byte han, L:Left-to-right (strong), c:Chinese, h:Korean, j:Japanese, |:line breakable
             to input: type "C-x 8 RET HEX-CODEPOINT" or "C-x 8 RET NAME"
          buffer code: #xE5 #xBA #x8A
            file code: #xB4 #xB2 (encoded by coding system chinese-gbk-dos)
              display: by this font (glyph code)
    uniscribe:-outline-BatangChe-normal-normal-normal-mono-19-*-*-*-c-*-gb2312.1980-0 (#x82AA)

Character code properties: customize what to show
  name: CJK IDEOGRAPH-5E8A
  general-category: Lo (Letter, Other)
  decomposition: (24202) ('床')

There are text properties here:
  fontified            t

So, how to solve this problem?


texts:
I have a basic C file open in c-mode:

#include <stdio.h>
#include <stdlib.h>

int main()
{
  return 0;
};

I'm trying to compile it.  I type M-x compile expecting to be asked to set my compile command and then run it, but I don't have an M-x compile at all.  Instead the minibuffer tries to autocomplete with:

Click on a completion to select it.
In this buffer, type RET to select the completion near point.

Possible completions are:
compile-defun
compile-goto-error
compile-mouse-goto-error

What mode do I need to be in for M-x compile to exist?

Update

I am running GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)

And in my init.el contains:

(require 'compile)


texts: org mode - export shell results with if condition like [[ fails on Unable to resolve link

texts:
I want to archive a config file in my org document:

#+BEGIN_SRC sh :dir /ssh:jetpac@server:  :var CONFIG="efile" :exports
both :eval query :results output scalar raw
cat /builds/$CONFIG
#+END_SRC

#+RESULTS:
if [[ -z $BUILD ]]; then BUILD=0; fi

This works nicely, code gets evaluated, config file brought over into the results block. However, when trying to export, the RESULTS block is being evaluated by org and the '[[' condition tricks it to evaluate it as an invalid ORG link.
Is there a way how to disable this behaviour for the results block? I have spent good deal of time reading docs and googling, no luck so far.

Thanks!


texts: How do I disable key-chord-mode in the minibuffer?

texts: key-chord-mode is useful, but I don't need it to work in the minibuffer. How do I disable it in the minibuffer?


texts: How to change setting for all modes except one?

texts:
How can I chance an Emacs config setting (let's say "highlighting of current line") that I set in .emacs as (global-hl-line-mode +1), to work for all modes except one.

For example, I want highlighting of current line to be on for all modes except org-mode.

A great solution would be one that would also be applicable to customizing theme to be different by major mode (though file type could work fine for this too).


texts: Why is this custom spacemacs major mode keybinding not working?

texts:
In .spacemacs I am trying to define a few custom, major mode mappings, that can be accesed using SPC m. This is working fine for org-mode:

  (evil-leader/set-key-for-mode 'org-mode "l" 'org-insert-link)

but when I define it for a different mode it doesn't work:

  (evil-leader/set-key-for-mode 'sclang-mode "sl" 'sclang-eval-line)

Using SPC m  just returns SPC m is undefined

UPDATE:

The mode is part of a package that I used following these instructions. In my .spacemacs file I have added these lines to make it work:

(add-to-list 'load-path "~/.emacs.d/sc/el")
(require 'sclang)
(setenv "PATH" (concat (getenv "PATH") ":/Applications/SuperCollider/SuperCollider.app/Contents/Resources"))
(setq exec-path (append exec-path '("/Applications/SuperCollider"  "/Applications/SuperCollider/SuperCollider.app/Contents/Resources" )))

It also required to move a folder in the .emacs.d folder (and I need to remove it temporarily before every spacemacs update...) so yes, definitely not even close to an official layer.


texts: Confused by what Paul Graham says about locality in his book "On Lisp"

texts:
https://sep.yimg.com/ty/cdn/paulgraham/onlisp.pdf On page 36 Paul writes the following:

The conditions above do not guarantee the perfect locality you get
with purely functional code, though they do improve things somewhat.
For example, suppose that f calls g as below:
(defun f (x)
  (let ((val (g x)))
    ; safe to modify val here?
    ))

Is it safe for f to nconc something onto val? Not if g is identity:
then we would be modifying something originally passed as an argument
to f itself.  So even in programs which do follow the convention, we
may have to look beyond f if we want to modify something there.
However, we don’t have to look as far: instead of worrying about the
whole program, we now only have to consider the subtree beginning with
f.

I don't understand what he means by saying that it is not safe for f to nonc if g is identity. Or I suppose I don't understand the idea that he's trying to convey in this paragraph in general.


texts: How to regexp-search for a word surrounded by spaces

texts:
I'm looking at this

  One use of regexp-quote is to combine an exact string match with
  context described as a regular expression. For example, this searches
  for the string that is the value of string, surrounded by whitespace:

(re-search-forward  (concat "\\s-" (regexp-quote string) "\\s-"))

and wondering how to adapt it to do simply go through the file and search for a word that is surrounded by one or more spaces, i.e., whitespace. I'd like to do it as a regex search in the minibuffer. Tried Search/Regex Forward from the menu, also M-x : to type it as a command in the minibuffer -- all to no avail. Once again, I'm lost in a "guess-and-test" loop.


texts:
I've been looking around for a solution to get company-mode to auto-complete R library names in ess-mode. The R libraries are stored in folders with the same name, wouldn't it be just the case of picking candidates from a directory tree? Does anyone know how to make ess-mode auto-compelte library names?

Thanks.


texts: When I start Emacs: Symbol's value as variable is void: shell-mode-map

texts:
System: Windows 10, Emacs 26.1, Helm 3.0

In my init.el:

;; Shell commands history
(define-key shell-mode-map (kbd "C-c C-l") 'helm-comint-input-ring)

When I start Emacs I get the following error:

  Warning (initialization): An error occurred while loading ‘d:/Programs/emacs/.emacs.d/init.el’:
  Symbol's value as variable is void: shell-mode-map
  To ensure normal operation, you should investigate and remove the
  cause of the error in your initialization file.  Start Emacs with
  the ‘--debug-init’ option to view a complete error backtrace.

What is at fault?


texts:
I want to set PAGER to cat in shell-mode. For eshell I just add a hook with setenv. Unfortunately it doesn't seem to work for shell-mode, setenv doesn't set env variable. Is there other way to redefine shell-defined variables (which may be set in ~/.zshrc, so it needs to be redefined after shell is launched and rc file is sourced).
I'm using following code:

(defun my--shell-mode-hook ()
  (setenv "PAGER" "cat")
  (setenv "EDITOR" "emacsclient")
  (setenv "BAR" "bar")
  (message "%s" (getenv "BAR"))
  )

(add-hook 'shell-mode-hook 'my--shell-mode-hook)

When I run M-x shell string "bar" is displayed in the messages buffer, so var is being set in emacs. But in shell itself it is not set, neither existing variables are reset:

ineu@rei ~ $ env | grep -i -e pager -e editor -e bar
env | grep -i -e pager -e editor -e bar
EDITOR=subl3 -w
PAGER=less
GIT_EDITOR=emacsclient
ineu@rei ~ $


texts: Library that converts a Python output string to an Elisp data structure?

texts:
Say that I evaluate the following Python code:

import inspect
import scipy.ndimage.filters

list (inspect.getargspec (scipy.ndimage.filters.gaussian_filter1d))
# => [['input', 'sigma', 'axis', 'order', 'output', 'mode', 'cval'],
#      None, None, (-1, 0, None, 'reflect', 0.0)]

I'd like to transform the output string, which is simply Python's
print output, to an Elisp data structure. So I need a function foo
that does this:

(foo "[['input', 'sigma', 'axis', 'order', 'output', 'mode', 'cval'], None, None, (-1, 0, None, 'reflect', 0.0)]")
;; =>
;; (("input"
;;   "sigma"
;;   "axis"
;;   "order"
;;   "output"
;;   "mode"
;;   "cval")
;;  nil
;;  nil
;;  (-1 0 nil "reflect" 0.0))

While it's not hard to write a version of foo that works for this
specific instance, I wonder if there's a library that does this in a
generic way, i.e. it is able to handle any complex Python structure.


texts: jedi:goto-definition overjumping the import section

texts:
I am using jedi:goto-definition to jump to function definitions.
If the function has a definiton under import it first jumps into that and I have to do second jump to the module again. Can it directly jump to the module by over passing the import jump?

Here: cursor is on top of my_function. When I do jedi:goto-definition it first jumps to my_function, under import at the top of the file. Than when I do jedi:goto-definition it jump to its definition.
from utils import (                      |
    my_function, <-----| --------------> |  def my_function(arg):
    _log               |                 |      ....
)                      |                 |
                       |                 |
my_function("hello") --| # cursor is here

wanted behavior:
my_function("hello") --| # cursor is here ----> | def my_function(arg):

setup:
(defun my/python-mode-hook ()
  (add-to-list 'company-backends 'company-jedi))

(add-hook 'python-mode-hook 'my/python-mode-hook)
(company-jedi 1)

(setq elpy-rpc-backend "jedi")
(add-hook 'python-mode-hook 'jedi:setup)

(global-set-key "\C-x\C-j" 'jedi:goto-definition)
(global-set-key "\C-x\C-k" 'jedi:goto-definition-pop-marker)


texts: This is my first day on Emacs, and I am really liking it so far, but I cannot seem to be able to work correctly with buffers. I am trying to kill specific buffers with C-x k, however upon checking the buffer list with C-x C-b all of my original buffers still seem to exist. I know this must be user error, but I can't seem to find anyone with this problem.


texts: Is there a way to calculate rows on a "rolling" basis?

texts:
Rolling formulas are very common in accounting, for example, carrying forward a monthly balance based on expenses.

So say you had a table with month, beginning balance, fixed income, expenses, and net:

| month | balance |  income | expenses |     net |
|-------+---------+---------+----------+---------|
|     6 | 1000.00 | 1500.00 |   500.00 | 1000.00 |
|     7 | 2000.00 | 1500.00 |   500.00 | 1000.00 |
|     8 | 3000.00 | 1500.00 |   500.00 | 1000.00 |
|     9 | 4000.00 | 1500.00 |   500.00 | 1000.00 |

I know how to calculate the net column since that's just #+TBLFM: $5=$3-$4, but how about the balance column? The starting balance would be something you would have to manually enter based on when you started accounting, and expenses might change from month to month, but the goal would be to make it possible for the balance column to be calculated based on the previous row. Writing @2$2=@1$2 + @1$4::@3$2=@2$2 + @2$4 and so on for each row is tiring.

Is there a way to do this in org-mode?


texts: Previously when I selected text and type something or insert from buffer, the selected text would get overwritten. Now it gets appended, apparently I've change some setting. What is it?


texts:
Every tutorial for org-mode says that when you mark a TODO item DONE, it should add a line like

CLOSED:[2017-08-06 Sun 12:00]

When I mark something DONE, no such line appears. I first observed this with my heavily configured emacs, and then I went and loaded up emacs with -no-init-file and went straight into org-mode, and the behavior is the same (I still don't get the CLOSED line). Is there some option to enable to disable this somewhere? The guides online seem to suggest it should happen by default without my doing anything.

I'm using org 8.2.10 on emacs 25.2.


texts: How to use font-lock to highlight end-of-line comments?

texts:
I am trying to add a comment feature to json-mode. A comment starts with
a hash sign and ends at the end of the line. However, if the hash sign is inside a string it should not count as the start of the comment. For example:

I am using Emacs 24.4, and installed json-mode from the package manager in Emacs.

Here is a minimal example:

$ emacs -Q -l init.el test.json

where init.el is:

(setq package-load-list '((json-mode t) (json-reformat t) (json-snatcher t)))
(require 'package)
(package-initialize)
(setq package-enable-at-startup nil)

(defun my-json-mode-comment-highlighter (limit)
  "When this function is called, it receives one argument `limit', the limit
of the search; it should begin searching at point, and not search beyond the limit.
It should return non-nil if it succeeds, and set the match data to describe
the match that was found. Returning nil indicates failure of the search.

Fontification will call function repeatedly with the same limit,
and with point where the previous invocation left it, until function fails.
On failure, this function need not reset point in any particular way."
  (let ((repeat 1)
        (noerror t))
    (re-search-forward "\\(#.*\\)$" limit noerror repeat)))

(defun my-json-mode-hook ()
  (let* ( ;; `sub-expression', specifies which subexpression of matcher should
         ;; be highlighted (instead of the entire text that matcher matched)
         (sub-expression 1)
         ;; If `override' is t, override existing fontification made by previous
         ;; elements of `font-lock-keywords'
         (override t)
         ;; If `mode' is nil, adds keywords to `font-lock-keywords' in the current buffer.
         (mode nil)
         (keywords
          `((my-json-mode-comment-highlighter
             ,sub-expression
             font-lock-comment-face
             ,override))))
    (font-lock-add-keywords mode keywords)))

(add-hook 'json-mode-hook #'my-json-mode-hook)

This will highlight comments correctly, but also incorrectly assume that a hash sign inside a string starts a comment.
How can I extend the function my-json-mode-comment-highlighter so it works as desired?

Update:

I also tried to replace my-json-mode-hook with:

(defun my-json-mode-hook ()
  (modify-syntax-entry ?# "< b")
  (modify-syntax-entry ?\n "> b"))

But then nothing is highlighted.


texts: Interactive: region beginning/end as markers

texts:
When I need a function to operate on a region I do, for example:

(defun myfunction (B E)
 (interactive "r")
 (let ((b (make-marker))
       (e (make-marker)))
   (set-marker b B)
   (set-marker e E)

   ;; DO SOMETHING THAT CHANGES THE BUFFER, THEN

   (comment-region b e)))

Is there a simpler way to have B and E as markers?


texts: Small database-like org files that can be accessed in other org files?

texts:
I am using org-mode as a labbook and it is working pretty nicely.

I often have the situation where I need to state which material/reagents were used in an experiment and those are an ever growing pool that are used in multiple experiments.

Is there a way to collect all the used material/reagents in one file and be able to link to them using the mini-buffer?

I have org-ref in mind and the way it accesses bibtex files.

The idea would be to run a command that shows me a list of all the reagents/materials in a table and me being able to search the table and insert the names and other information of the reagents/materials.

Is there a way to do it already? If not, what do I need to look into to make it possible?

Thank you in advance

Edit:

Example table that would sit in a file called materials.org

| Name      | Manufacturer  | Catalog Number | Molecular Weight | Stock conc. |
|-----------+---------------+----------------+------------------+-------------|
| TWEEN® 20 | Sigma-Aldrich | P9416 SIGMA    |             1228 |        100% |

And it would be nice to access this via a search in the minibuffer and insert that line of the table into the new file.


texts: Org agenda does not show markdown formatted text

texts:
Running Doom Emacs 2.0.9 on Emacs 27.1.
Some of my TODO items have markdown commands in them (for bold, italics, etc.).
The org files display these TODOs properly formatted.
But the agenda shows the formatting marks, instead.
How do I get the agenda also to show the markdown text properly formatted?


texts: How to Change the font for org-date face in org-table context?

texts:
I like to have a variable font everywhere I can, but some things like tables in org-mode or the org-agenda itself look a little wonky that way, and I get around it by configuring specific fixed width fonts in these areas.

I’ve already set a fixed width font for the org-table face, but dates inside the table still showed up with a variable width font. I changed this too by adding this configuration to my init.el:

(custom-theme-set-faces
 'user
  '(org-date ((t (:family "Source Code Pro" :height 120)))))

I really prefer variable width fonts and think that dates also look and read better that way if they are outside of a table, but I don’t know how to set the font used by a face depending on its context.

How can I change my config so that my custom org-date face only triggers when the date is inside an org-table?


texts: undo-tree: How to map through all nodes programmatically

texts:
I am working on my own new feature request for undo-tree linear undo/redo:  How to make undo-tree linear -- undo-tree-undo/redo

I have successfully added two additional gizmos (?) to cl-defstruct ... undo-tree-node at the bottom and very end of the definition -- connect-dots and linear-history.  The new functions are called like this:  (undo-tree-node-connect-dots (undo-tree-current buffer-undo-tree)) or (undo-tree-node-history (undo-tree-current buffer-undo-tree)).

I am adding a list of time-stamps to each node when they are imported from the buffer-undo-list with undo-list-transfer-to-tree, and also to the final current node when using undo-tree-undo and undo-tree-redo.  The result should be that every node has a list of one or more time-stamps that never change -- i.e., I just keep pushing new time-stamps onto whichever node is current.

undo-tree creates the visualizer buffer by starting from the root and following the branch until a branch-point is reached, at which time it branches into 2 or more, etc.  In a nutshell, the parent knows who it siblings are, and the siblings know who the parent is.  I can create a function that does not use a visualizer buffer, which follows the above tree-structure until the very end, but that seems like an inefficient manner to map through all of the nodes.  [I envision this linear undo/redo new feature as being usable irrespective of whether the visualizer buffer has been generated.]

Q:  Absent following the tree structure programmatically, is there a more efficient manner to map through each node of the buffer-undo-tree?  [E.g., (dolist (node buffer-undo-tree) (when node ...))

In case anyone was wondering about connect-dots, at this time it is just an interesting way of seeing each branch with a different letter and each node is consecutively numbered between root and branch-point, and between each branch-point and leaf.  I may consolidate that feature with the linear visualization, but each node may have more than one time-stamp, so I'll need to think about how to visually represent that.

Thanks to the helpful answer by @Tobias below, I came up with the following function that generates a list of all nodes.  undo-tree-mapc is designed to apply a function to each node, which is also useful.

(defun undo-tree-node-list (&optional transfer-to-tree)
"See also `undo-tree-mapc'."
  (when transfer-to-tree
    (undo-list-transfer-to-tree))
  (let* ((beginning-node (undo-tree-root buffer-undo-tree))
         (stack (list beginning-node))
         n res)
    (while stack
      (setq n (pop stack))
      (push n res)
      (setq stack (append (undo-tree-node-next n) stack)))
    res))


texts: How to approximate pre-self-insert-hook (which doesn't exist)?

texts:
Q: how does one approximate the functionality of the non-existent pre-self-insert-hook?

This question is inspired by the curiosity that is the combination of abbrev-mode and self-insert-command.  The docstring for the latter:

  Insert the character you type.

  Whichever character you type to run this command is inserted.
  Before insertion, expand-abbrev is executed if the inserted character does
  not have word syntax and the previous character in the buffer does.
  After insertion, the value of auto-fill-function is called if the
  auto-fill-chars table has a non-nil value for the inserted character.
  At the end, it runs post-self-insert-hook.

It looks to be the case that the call to expand-abbrev is baked directly into self-insert-command -- I assume for efficiency reasons, because it is ancient, or both (feel free to comment if you happen to know why).  Ordinarily, I would have expected such a function to run via a hook.  However, although there is a post-self-insert-hook, there is no pre-self-insert-hook.

In the absence of such a hook, how does one approximate that functionality, and, more importantly, do so with a minimum of fuss?

None of the options I can think of are ideal:

advice: self-insert-command is a primitive defined in C and therefore ignores advice
pre-command-hook: simple, but it's overkill because it runs before every command, and not just self-insert-command, and one may only want to run the command as part of self-insert-command
define a wrapper around self-insert-command: this appears to be what org-mode and smartparens do (with org-self-insert-command and sp--self-insert-command), but seems complicated by the fact that a) you'd need to rebind an awful lot of keys to use it, b) if one uses multiple major or minor modes that use their own wrapper functions, one needs to keep track of fallback functions so that one does not lose the functionality of other wrappers when rebinding keys (at least I think so; I'm not so sure I understand this part).


texts: Emacs evil-mode: how to make visual selection to include diacritics?

texts:
For a text "naïve", for example, and the cursor is at "n", if I press vll, "naï" is highlighted, but if I press y, the yanked text is "nai", not "naï".

How to make visual selection to include all diacritics/combining characters at the selection ending?


texts: Retooling fill-paragraph to append trailing spaces

texts:
I'm using emacs as an external editor for mutt, and am hoping to get format=flowed messages to compose properly. The default behavior for fill-paragraph is to end lines without any whitespace, but the format=flowed style as detailed in RFC 2646 and 3676 requires trailing spaces before "soft" newlines. Is there an easy modification to append a space before every newline added by fill-paragraph? My elisp skill is quite limited.

To elaborate on specifically what kind of text is wanted, RFC 3676 establishes the  "format=flowed" parameter to MIME type text/plain to describe text that flows well both on devices that automatically line-wrap and those that don't. The salient idea is that a newline immediately following a space is considered a "soft" newline, one provided for line-wrapping for display on devices which don't automatically line-wrap, and that other devices are free to remove this newline and to wrap text according to their own preferences. A newline without a preceding space is a "hard" newline, one meant to be rendered as a newline regardless of the line-width or wrap capabilities of the display.

So from a text processing point of view, what I'd like for format=flowed text is for fill-paragraph to precede every intra-paragraph line break with at least one whitespace, while leaving the end-of-paragraph line break with no whitespace preceding it. All of this of course could be done with post-processing search-and-replace on all my messages, but it seems like it should be possible to dothis with some appropriate modification of fill-paragraph.


texts: How can I provide the first-error and next-error initial positions as region selection in order to save to the kill-ring?

texts:
I am running a make command. I'd like to capture the first error and output it to a file.
How can I select as a region from the beginning of first-error position to the position right before the next-error automatically such that it can be passed as an input to the write-region command to write it to a known file?
I am using the following function as a starting point, but I don't know how to select the region based on errors in the make output.
(defun copybuffer()
  "function takes current region, and writes it to specified file"
  (interactive)
  (kill-ring-save (region-beginning) (region-end))
  (write-region (region-beginning) (region-end) "~/copybuffer.txt"))


texts:
I have bound TeX-command to a key f7 to compile my document with latexmk. When I press it, and it needs to be compiled, it compiles it without asking. If not, views it, without asking (that's because of the -1 option):

(global-set-key (kbd "<f7>") 'my-run-latex)

(defun my-run-latex ()
  (interactive)
  (if (equal current-buffer-hash
         (setq current-buffer-hash (secure-hash 'md5 (current-buffer))))
      (TeX-view)
    (setq TeX-save-query nil)
    (TeX-save-document (TeX-master-file))
    (TeX-command "Latexmk" 'TeX-master-file -1)))

Now this applies to the tex master file. How can I make it apply to the file in the current buffer?

Note that I also want to have this command bound to another key for compiling the master file. So it wouldn't be a solution to set the current buffer as master file.

I tried to replace (TeX-command "Latexmk" 'TeX-master-file -1) by (TeX-command-buffer "Latexmk") which works but doesn't compile without asking. Then I tried to replace it with (TeX-command "Latexmk" 'TeX-master-file -1) with returns an error message "Wrong number of arguments buffer-file-name, 2".


texts:
I'm trying to install the smartparens package, but I'm having trouble. When I go to M-x list-packages, mark smartparens for installation, and hit x (execute) y (yes), I get the error message:

  Required package 'dash' is disabled

This is not just for smartparens, but for anything that depends on dash.

By removing almost all of my packages except helm-projectile and its dependencies, I was able to install dash from either Melpa or GNU; nevertheless, every time I try to install smartparens it complains that dash is disabled.

My essential question is what is going wrong, or what am I missing; and how can I enable dash so that I can install things that depend on it?

Supplementary info:

The value of package-load-list is ((helm-core t) (helm t) (async t) (popup t))


texts: `profiler-report` output is truncated horizontally?

texts:
I'm having some performance problems with the latest version of magit, which I'm trying to profile to find the reason. I'm doing the following:

M-x profiler-start
M-x magit-status
M-x profiler-report

Unfortunately the report is truncated horizontally, so that I'm still at over 80% of CPU time when the function names are just replaced with ....

How should I work around this?


texts:
I'm missing some visual indication of the push / pull progress. After executing the appropriate command, magit prints

  Pushing to domain.tld:repo.git

however, no further indication of the progress is given. On a slow network connection or if the data to be transmitted is large, the process can take quite some time, hence, it would be nice if magit could give some indication of progress.

Naturally the *magit-process* buffer contains git's own progress indication but how do you tell magit to pass the relevant part through to the echo area?

Even better would be if the progress indicator is added to the mode line, thus allowing the user to close the magit-status buffer and continue working while git is doing the heavy lifting.

Edit: I'm not looking for indication that magit is pushing / pulling, I know that because I just hit P/F. I want to see at which stage of pushing / pulling it is (i.e. (un)packing, transmitting) and how much of that action it already did.

Remember, if you run git through the terminal it'll print something like

  Pushing to domain.tld:repo.git
  Counting objects: 29, done.
  Writing objects: 100% (15/15), 249.80 KiB | 28.00 KiB/s, done.
  Total 15 (delta 10), reused 0 (delta 0)
  To domain.tld:repo.git
     5436bd0..d9ec32a  master -> master
  updating local tracking ref 'refs/remotes/origin/master'

[obviously this is a snapshot of the dynamic output]. I would like that progress to be displayed from within emacs.

Edit2: Opened feature request on github


texts: What's the best way to use local packages in spacemacs?

texts:
I'm a developer for a package (ycmd) used by spacemacs, and I'd like to try using spacemacs as well. I'd like spacemacs to use the "development version" of my package, i.e. the one I'm hacking on locally. What's the best/proper way to tell spacemacs to use that version of the package rather than the one from melpa?

Right now I'm using the :load-path argument to use-package, but this seems to go against the grain a bit. Does spacemacs let me specify a load directory for specific packages in the layer configuration somewhere?


texts: org folding: show tags after the "...", not before?

texts:
When parental level node, which contains both child items and tags, is folded by tab, the ... indication for folded child items is associated with the tags rather than the node text.

for instance, it displays like:

*1st level node            :@tag1...

while I would like it to be:

*1st level node...      :@tag1

Is it possible?


texts: AUCTeX pairing large parenthesis for `\left(`

texts:
I'd like to automatically close \left( with \right) in LaTeX via AUCTeX in Emacs 27. The following should work:
(add-hook 'LaTeX-mode-hook
            (lambda () (set (make-local-variable 'TeX-electric-math)
                            (cons "\\left(" "\\right)"))))

But it doesn't. Any clues as to why it doesn't and how I could make it work?
PS: the solution here
adds an extra parenthesis, so in the end you have \left(\right)).


texts:
I am trying to install dired+ from MELPA but it seems that it no longer is listed.
I also checked here: https://melpa.org/

Is this normal?


texts: Toggle between relative and absolute line numbers: Lisp Syntax

texts:
I need to define a function that toggles between value of display-line-numbers but can't figure out what's the correct lisp syntax to do so.
Here's what I want to do:

Check if value of display-line-numbers set to t (absolute line numbers), change it to relative
Else (it will be set to relative) change it to absolute (t).

Here's what I tried which is full of errors. Not having a very good hand at lisp
(defun cc/toggle-line-numbering ()
  "Toggle line numbering between absolute and relative."
  (interactive)
  (if (= (describe-variable display-line-numbers) "relative")
      (setq display-line-numbers t)
    (setq display-line-numbers 'relative)))