text:
User defined outline-minor-mode-highlight
I want to give the user the ability to change the outline highlighting setting.  After taking the user option I call the intern function to use the appropriate symbol required by outline-minor-mode-highlight.  Is this the correct way to do it ?
(defun taxocask-outl-focus (actm)
  "Setting for outline-minor-mode-highlight."

  (interactive
   (let ( (completion-ignore-case  t)
      (cseq '("t" "append" "override")) )
     (list (completing-read "Outline-Highlight: " cseq nil t))))

  (setq outline-minor-mode-highlight (intern actm)))


text:
Changing colour typeface for outline-minor-mode-highlight
I am using outline-minor-mode-highlight but want to set different colours to the typeface according to same contrast levels not provided by the default settings of outline-minor-mode.  What can I do?

Please don't post the same question in emacs.SE and StackOverflow. Pick one to keep and delete the other. Thx.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Emacs Mode for Reddit, (void-variable hierarchy--make)
Trying to add md4rd, using this:
(use-package md4rd :ensure t
  :config
  (add-hook 'md4rd-mode-hook 'md4rd-indent-all-the-lines)
  (setq md4rd-subs-active '(emacs lisp+Common_Lisp prolog clojure))

  (run-with-timer 0 3540 'md4rd-refresh-login))

, but I get this:
Debugger entered--Lisp error: (void-variable hierarchy--make)
  byte-code("\302\303!\210\302\304!\210\302\305!\210\306\307\310\10!\311\11!\"\312\313!\314\315\316\317\"!\320\315\316\317\"!\321\315\316\317\"!%\207" [hierarchy--make hierarchy-- require seq map subr-x cl-defstruct hierarchy :constructor :conc-name roots nil parents make-hash-table :test equal children seen-items] 9)
  require(hierarchy)
  byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\210\300\307!\210\300\310!\207" [require hierarchy cl-lib cl-extra dash request json s tree-mode] 2)
  require(md4rd nil t)
  (not (require 'md4rd nil t))
  (if (not (require 'md4rd nil t)) (display-warning 'use-package (format "Cannot load %s" 'md4rd) :error) (let ((now (current-time))) (message "%s..." "Configuring package md4rd") (prog1 (condition-case err (progn (add-hook 'md4rd-mode-hook 'md4rd-indent-all-the-lines) (setq md4rd-subs-active '(emacs lisp+Common_Lisp prolog clojure)) (run-with-timer 0 3540 'md4rd-refresh-login) t) ((debug error) (funcall use-package--warning132 :config err))) (let ((elapsed (float-time (time-subtract ... now)))) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Configuring package md4rd" elapsed) (message "%s...done" "Configuring package md4rd"))))))
  (prog1 (if (not (require 'md4rd nil t)) (display-warning 'use-package (format "Cannot load %s" 'md4rd) :error) (let ((now (current-time))) (message "%s..." "Configuring package md4rd") (prog1 (condition-case err (progn (add-hook 'md4rd-mode-hook 'md4rd-indent-all-the-lines) (setq md4rd-subs-active '...) (run-with-timer 0 3540 'md4rd-refresh-login) t) ((debug error) (funcall use-package--warning132 :config err))) (let ((elapsed (float-time ...))) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Configuring package md4rd" elapsed) (message "%s...done" "Configuring package md4rd")))))) (let ((elapsed (float-time (time-subtract (current-time) now)))) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Loading package md4rd" elapsed) (message "%s...done" "Loading package md4rd"))))
  (let ((now (current-time))) (message "%s..." "Loading package md4rd") (prog1 (if (not (require 'md4rd nil t)) (display-warning 'use-package (format "Cannot load %s" 'md4rd) :error) (let ((now (current-time))) (message "%s..." "Configuring package md4rd") (prog1 (condition-case err (progn (add-hook ... ...) (setq md4rd-subs-active ...) (run-with-timer 0 3540 ...) t) ((debug error) (funcall use-package--warning132 :config err))) (let ((elapsed ...)) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Configuring package md4rd" elapsed) (message "%s...done" "Configuring package md4rd")))))) (let ((elapsed (float-time (time-subtract (current-time) now)))) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Loading package md4rd" elapsed) (message "%s...done" "Loading package md4rd")))))
  (condition-case err (let ((now (current-time))) (message "%s..." "Loading package md4rd") (prog1 (if (not (require 'md4rd nil t)) (display-warning 'use-package (format "Cannot load %s" 'md4rd) :error) (let ((now (current-time))) (message "%s..." "Configuring package md4rd") (prog1 (condition-case err (progn ... ... ... t) (... ...)) (let (...) (if ... ... ...))))) (let ((elapsed (float-time (time-subtract ... now)))) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Loading package md4rd" elapsed) (message "%s...done" "Loading package md4rd"))))) ((debug error) (funcall use-package--warning132 :catch err)))
  eval-buffer(#<buffer  *load*> nil "/home/b0ef/.emacs.d/init.el" nil t)  ; Reading at buffer position 232936
  load-with-code-conversion("/home/b0ef/.emacs.d/init.el" "/home/b0ef/.emacs.d/init.el" t t)
  load("/home/b0ef/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode -0xde439016bde6cc4>) #f(compiled-function () #<bytecode -0x1f3c61addc0b4d35>) t)
  command-line()
  normal-top-level()

Search for void-variable to find duplicate questions. When you find one, please delete this one. Thx.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Accessing yassnippet from other editors (namely jupyter lab)
I spend most of my time working in emacs, but some of the time I use jupyter lab (I've played with an emacs extension to talk to jupyter from emacs but have been bitten by bugs - and I also do pairing).
It'd be cool if I could get at the collections of snippets that I built up over time in yassnippet. Is there a way to access snippets from other editors, or even just put them on the clipboard?


text:
Edebug conditional breakpoint when a value that contains a certain string appears?
Is it possible to set a conditional breakpoint in edebug such that it gets hit only when a symbol that contains a string "download:" gets hit?
I've tried running edebug-set-conditional-breakpoint and when asked for pattern just typed "download:". It set a breakpoint on the line where the cursor was currently positioned, I tried running the function again and nothing happened.


text:
macos, terminal emacs overwrite ui emacs' buffer history (and probably other things)
I am a macos & spacemacs user and installed my emacs through https://emacsformacosx.com/. For UI based emacs I just click on the emacs icon. For terminal I run this command: alias emacs='$(/Applications/Emacs.app/Contents/MacOS/Emacs "$@" -nw)'.
I want to run emacs both in the terminal and by UI. However, It seems to be every time I run both, one emacs overwrite the other's buffer history. Is there some configuration I should tweak to allow them sharing the history?
By buffer history I mean the SPACE-b-b command in spacemacs as shown below:


text:
lsp-org, lsp-format-buffer
In a csharp org-babel block, is lsp-format-buffer supposed to work?
#+begin_src csharp :tangle "11dde4eb-97fe-c7a0-78b7-b38c1b4a1e02.cs"
System.Console.WriteLine("Hello World...");
#+end_src

Debugger entered--Lisp error: (lsp-capability-not-supported "documentFormattingProvider")
  signal(lsp-capability-not-supported ("documentFormattingProvider"))
  lsp-format-buffer()
  funcall-interactively(lsp-format-buffer)
  call-interactively(lsp-format-buffer nil nil)
  command-execute(lsp-format-buffer)


text:
How do I create a new file when there is already a similarly named one in the directory?
I want to create a file in Emacs called article.html.pm but I already have a file called article.html.pmd in the directory. Since I have Ivy it automatically finds the article.html.pmd and helpfully opens it since it's "close enough". But in this case, I do actually want to create a new file. Is there a good way to force emacs to create the file instead of fuzzy opening the old one? This is similar to cant' create file with the same name in different directory in dired but I'm not using ido-mode so this solution doesn't work for me.

See: https://emacs.stackexchange.com/questions/34244/create-a-directory-when-a-file-has-a-similar-name


text:
How to get LSP like formatting in Org Mode?
Here is a scenario I use constantly in Rust development:
LSP is always on.
I call the LSP feature "format current buffer" (or whatever it's called).
The LSP returns the buffer formatted (internally, the LSP uses `rustfmt`).

I know there is no LSP implementation for Org Mode, but maybe it is still possible to achieve this? E.g., I wanna press some button and have the Org Mode syntax formatted. For example: add an empty line after each heading, remove redundant spaces between heading stars and the text, underline in red if there is a syntax error in a header of a block, etc.
P.S. Emacs newbie here, transitioning from Neovim.


text:
Can't show inline image and html export
I am losing my mind with this one, since I feel I am not completely new to emacs. Or so I thought.
I usually need to print a html report, together with having inline images activated. However, some configuration in my header seems to make both incompatible. I tried to remove configurations from the header as much as I could. In the simple example below the resulting image is not being shown in emacs, nor the image is being  loaded in the html when running org-html-export-html:
#+TITLE: Simulate ACE data (latent / obs phenotype)
#+DATA: 2023
#+STARTUP: latexpreview
#+PROPERTY: cache yes
#+PROPERTY: tangle yes
#+OPTIONS: broken-links:t
#+ATTR_HTML: :width 300px
#+PROPERTY: results graphics

#+BEGIN_SRC R :session r-session :dir "." :results output graphics file :file mtcars.png
plot(mtcars)
#+END_SRC

#+RESULTS:
[[file:mtcars.png]]

[![enter image description here][1]][1]

What am I doing wrong
[1]: https://i.stack.imgur.com/eH5Ni.png

For the export, you need a :exports results header in the code block. I'm not sure why you cannot display the image inline: M-x org-display-inline-images works for me.


text:
Show all the error inline in Emacs lsp-mode
I am an Emacs newbie transitioning from Neovim.
In Neovim's built-in LSP client, I am able to see all the errors inline.
Please notice how every error is displayed on the problematic line immediately at the end of the line.
Here is a screenshot:

And now here is how it looks in Emacs:

Please notice that:

Only one error is visible, where the cursor is currently on.
By default, the error shown on the right side of the screen instead of immediately at the end of the line like in Vim.
The error is shown also below the line, in addition to the right side of the screen. This was achieved by this: https://github.com/flycheck/flycheck-inline.

How can I make Emacs behave like Neovim?


text:
Org Mode syntax checker
The correct syntax is this:
#+PROPERTY: header-args :tangle "~/.config/emacs/init.el"

But once, I had, instead of header-args, header-aegs.
Notice the e instead of r.
I was getting the dreaded tangled 0 code blocks thingy.
It took a lot of time to find the error.
My question is:

How to avoid this in the future?
Maybe there is some kind of syntax checker? Maybe flycheck? Maybe there is an Org Mode LSP implementation?

header-aegs is a legal property name, so syntax checkers are not going to help. You need a heuristic checker of some sort: perhaps one that checks property names to see if they are "one step away" from one in a predefined set. If something like that exists (and I don't know either way), org-lint might be a good place to add it.


text:
Trouble with Bullets in Emacs Org Mode Code Block when Creating a Draft Wikipedia Page
How can I overcome the issue of asterisks being interpreted as bullets in an Emacs Org Mode code block when creating a draft Wikipedia page?
* Draft wikipedia page

#+begin_src Wikipedia

* foo
* bar

#+end_src

When I try to use a Wikipedia source-code block and try to enter the editing buffer with C-c ' I get an error: No such language mode: Wikipedia-mode. According to the list of supported languages (here) there is no wikipedia option.
When I use org code blocks however, and enter the editing buffer with C-c ',  type some headings and then close it after editing with C-c ', asterisks are prefixed with a comma, like so:
* top
  #+begin_src org
    ,* first
    ,** second
  #+end_src

So org-mode does not interpret the asterisks as headlines. Prefixing them with a comma will probably work for your (custom?) Wikipedia source code blocks as well. Or just use org code blocks, edit them with C-c ' and rename them to Wikipedia after your editing is done.

More information here:

https://emacs.stackexchange.com/questions/17427/is-it-possible-to-include-babel-header-line-when-publishing-org-mode-files-to-ht/17429#17429
https://orgmode.org/manual/Literal-Examples.html


text:
Org-Mode links opening in new splits?
I'm a bit stuck. I want to open new splits (windows within a frame to be precise) with each link I'm visiting. A bit like going down the rabbit hole.
What I have is 1 | 2 and it bounces back between the two.
What I want is 1 | 2 | 3 | n so each time I hit enter on a link, it visits the link in a new split. Vertical splits in my case.
The recommended setup from the Org-Roam GitHub.
(setq org-link-frame-setup '((file . find-file-other-window)))

What I've tried so far
(add-hook 'org-follow-link-hook #'+evil/window-vsplit-and-follow)
(setq org-link-frame-setup '((file . find-file-other-window)))

Result: Opens 3 splits with the same buffer. One larger, two half that size each.

(setq org-link-frame-setup '((file . (lambda (file) (select-window (split-window-right)) (find-file file)))))

Result: No influence on behaviour at all.

Emacs Version
Emacs 27.2 (Emacs-Plus) with Doom Emacs 3.0.0-pre
I'm hoping someone here has a better idea to achieve this than I had.

https://emacs.stackexchange.com/tags/elisp/info


text:
Setting outline-%d foreground according to dark or light theme
I want to adapt this so that the colours used depend upon whether a dark theme (use pigment-darkbg) or light theme (use pigment-lightbg) is being used.  What can I do ?
Would the following be proper ?
(defun outl-tyface ()
  (interactive)
  (let* ( (pigment-darkbg  '("#ff62d4" "#9f80ff" "#fe6060" "#fba849"
                             "#4fe42f" "#4fafff" "#f0dd60" "#FFFFFF"))
          (pigment-lightbg '("#1f1fce" "#006800" "#b60000" "#605b00"
                             "#a8007f" "#005f88" "#904200" "#7f10d0"))
         (pigment
           (if (eq (frame-parameter nil 'background-mode) 'dark)
               pigment-darkbg
             pigment-lightbg)) )

    (dotimes (i 8)
      (let ((outl-name (intern (format "outline-%d" (1+ i))))
            (outl-colr (nth i pigment)))
        (set-face-foreground outl-name outl-colr)))))

You said "adapt this" but there is no code to adapt, there is only the code that you offer as possibly being proper. In addition, there are two questions here. Please only keep one of them, preferably the second one, and please edit the question so that we know what you have tried and what the result was.


text:
Corfu autocompletion popups are not working with eglot-grammarly
I am unable to get autocompletion with corfu when I enable eglot-grammarly. Here is a MWE.
(setq straight-build-dir (format "build/%d%s%d"
                                 emacs-major-version
                                 version-separator
                                 emacs-minor-version)
      straight-use-package-by-default t)

(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 6))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(setq use-package-hook-name-suffix nil)
(straight-use-package 'use-package)

(use-package corfu
  :custom
  (corfu-auto t "Enable auto completion")
  :config
  (global-corfu-mode 1))

(use-package cape
  :after corfu
  :config
  (add-hook
    'text-mode-hook
    (lambda ()
      (remove-hook 'completion-at-point-functions #'eglot-completion-at-point t)
      (setq-local completion-at-point-functions
        (list #'cape-file #'cape-dabbrev #'cape-dict)))))

(use-package eglot-grammarly
  :straight (:host github :repo "emacs-grammarly/eglot-grammarly")
  :hook
  (text-mode-hook . (lambda ()
      (require 'eglot-grammarly)
      (eglot-ensure))))

The value of completion-at-point-functions for a text file is as follows.
Its value is
(eglot-completion-at-point cape-file cape-dabbrev cape-dict)
Local in buffer email.txt; global value is
(tags-completion-at-point-function)

Please suggest what is wrong in the setup. Thanks.


text:
how to limit header level for org column view
I'd like to have a column view for the top level headers only and exclude other children levels. For example, in the screenshot below, I want column view only for * grit not for its children. Is there any way to customize it?


text:
Polymode markdown: export to revealjs
I want to export a markdown document to revealjs slides. When I open the markdown file, poymode markdown major mode is activated. When I choose "export" from the menu, I can specify "pandoc's markdown" as input file format, but I don't get any "revealjs" option for the output format. Is it possible to add this option? The corresponding command should be something like pandoc myfile.md -s -t revealjs -o myfile.html.
I have tried as a workaround to save the file as quarto markdown. Quarto mode has the option to export to revealjs, but I get an error: "The specified directory ('.') is not a Quarto project". It looks like the problem is in the command issued, that is quarto render --to=revealjs --output=myfile.html, it looks like the input file is missing. Is there a way to customize the command to add the input file (I guess it is just matter of adding a %s, but I do not know where and how to do it!).

Customize markdown-command


text:
emacs-lisp-mode overriding outline-level
I am changing the heading pattern for outline-minor-mode and have noticed that one needs to have the following
(setq-local outline-level 'outline-level)

because emacs-lisp-mode overrides the default value with own lisp-outline-level.
Can someone help me understand this?
For a custom heading one uses outline-heading-alist but for emacs-lisp-mode and others, it does not seem to be the case.

It's not clear what you don't understand but want to understand. Please pose a specific question.


text:
Opam switch not working: "error Buffer *OCaml* has no process"
I am on macOS 13.4, I set up my Ocaml environment with emacs but I'm still new at it so I got trouble solving some of my problems:
For the project I am working on I had to clone my working repository twice. The first repository works fine: merlin recognises the modules, I can C-c C-l to access the definition of objects, and the execution of the code C-x C-e works fine.
Dependencies:

merlin toolkit v4.5-412
opam v2.1.4
dune v3.8.0
ocaml toplevel v4.12.1

Merlin doesn't seem to work in my second repository: the libraries installed, such as Irmin or Lwt aren't recognized, they are Not in environment when I try C-c C-l. Every call to the libraries shows the error Unbound module ....
Then I can't manage to execute the code with the opam switch of my second repository:
opam exec --switch=/Users/Louis/git/temp/learn-ocaml -- ocaml

in emacs returns the error
error "Buffer *OCaml* has no process"

When I try to save a file I also get the error message:
The current Merlin configuration has been generated by another, incompatible, version of Dune. Please rebuild the project. (Using the same version of Dune as the one running the `ocaml-merlin` server.)

I tried to solve the problem:
eval $(opam env)

and then M-x merlin-stop-server RET in emacs but I have the error
No config found for irmin-test.ml. Try calling `dune build`.

The dependencies used for compilation should be alright, and I made sure all the opam packages were installed.
I also tried to set the switch manually:
eval $(opam env --switch=/Users/Louis/git/temp/learn-ocaml --set-switch)

but it tells me
[ERROR] The selected switch /Users/Louis/git/temp/learn-ocaml is not installed.


text:
Move point from a hook in EMMS playlist doesn't work
I want to move point with the current played song in an EMMS playlist. I tried it with this code:
(defun tvd-emms-follow-playing-song()
  (interactive)
  (message (format "%s" emms-playlist-selected-marker))
  (when emms-playlist-selected-marker
    (goto-char emms-playlist-selected-marker)))

(add-hook 'emms-playlist-selection-changed-hook 'tvd-emms-follow-playing-song 1)

Now when I press n inside a playlist (or any other command skipping a song), the function gets executed and it prints the new position.
However, it doesn't move point.
I also tried another variant:
  (defun tvd-emms-follow-playing-song()
    (interactive)
    (let ((track (emms-track-get (emms-playlist-current-selected-track) 'name))
          (oldpos (point))
          (pos 0))
      (save-excursion
        (beginning-of-buffer)
        (search-forward track)
        (setq pos (point)))
      (message (format "old: %d, new: %d" oldpos pos))
      (goto-char pos)))

When I go to the next song, it prints the correct old and new point, but doesn't move point as well.


text:
Unable to use org-roam on Windows 10
The problem is quite simple :
I want to use org-roam on my Emacs on my Windows 10 laptop, and for a mysterious reason, it just won't work.
What I have done :

I have installed org-roam by adding those lines in my .emacs.d/init.el file :

(use-package org-roam
  :ensure t
  :custom
(org-roam-directory "~/RoamNotes")
  :bind (("C-c n l" . org-roam-buffer-toggle)
         ("C-c n f" . org-roam-node-find)
         ("C-c n i" . org-roam-node-insert)))

I have emacsql and emacsql-sqlite installed by adding those lines in my .emacs.d/init.el file :

(use-package emacsql
      :ensure t)
    (use-package emacsql-sqlite
      :ensure t)

I have sqlite3 installed :

λ sqlite3.exe
SQLite version 3.41.2 2023-03-22 11:56:21
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite>

The path to sqlite3.exe is in my PATH environment variable and in exec-path emacs' variable.

What does it do :
When opening a file ~/Documents/RoamNotes/test.org and hitting C-c n i (org-roam-node-insert) or C-c n f (org-roam-node-find) to insert or find a node, I get the message Process emacsql-sqlite not running


text:
How can I prevent org-paste-special from merging kill-ring heading and heading on the current line?
I find that org-paste-special more often than not, combines the two headings, like
** one ** two

, instead of
*** one
*** two

, so I always have to correct it, after a paste.
Is there any way to modify this command, so that it doesn't merge the kill-buffer and the heading on the current line?;)

I cannot reproduce this: can you describe the initial state, what subtree you have in your kill-ring and where exactly you do C-c C-x C-y? Also, what version of Org mode you are running? I tested with recent upstream with no problem, but your version may be buggy.


text:
`shell-command` repeats my input characters multiple times
whenever I run this command (shell-command "chatgpt install &")  my input characters gets repeated like this:

1> hi hi
Hello! How can I assist you today?
2> hi again  hhii  aaggaaiinn
Hello! Welcome back. How can I help you today?
3> hi again again  hhhiii   aaagggaaaiiinnn   aaagggaaaiiinnn
Hello once again! I'm here to assist you. What can I do for you this
time?
4> hi again again again  hhhhiiii    aaaaggggaaaaiiiinnnn
aaaaggggaaaaiiiinnnn    aaaaggggaaaaiiiinnnn

when I run the same command from vterm the input does not get repeated at all.
I tried:
run async-shell-command directly instead of shell-command
giving parameters to shell-command for output-buffer and error-buffer
setting comint-process-echoes to t
non of those worked.
emacs version: GNU Emacs 29.0.92 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2023-06-25


text:
How to run flycheck synchronously and programmatically
As part of some automated tests I'd like to include flycheck. However, I haven't found a way to invoke the checker programmatically and synchronously.
I've tried something like:
(progn
  (with-current-buffer (find-file "my-file.el")
    (flycheck-mode)
    (flycheck-list-errors)
    (sleep-for 5))
  (with-current-buffer "*Flycheck errors*"
    (when (string-match "\n" (buffer-string))
      (kill-emacs 1))))

But this doesn't seem reliable and doesn't result in any warnings even when my-file.el does trigger flycheck warnings.
Is there a recommended way to invoke flycheck synchronously?

I'd start with flycheck-buffer and An overview of Flycheck internals.


text:
Printed in named buffer with text matching pattern getting coloured
I have the following function that prints some text in the *Messages* buffer.  I want to change this so the text gets printed to a named buffer instead.
(defconst tika-outlshow-details
  "
Show-Entry
  Show the body directly following this heading.

Show-Heading
  Show the current heading and move to its end.\n")

(defun tika-outl-navaid (actm)
  "TODO"

  (interactive
   (list
    (let ( (cseq '("Show" "Hide")) )
      (completing-read "Vista: " cseq nil t "Hide"))))

  (cond
   ((equal actm "Hide")
      (message "%s" tika-outlhide-details))
   ((equal actm "Show")
      (message "%s" tika-outlshow-details))) )

One question per question please.


text:
python source code with using realgud:gdb and pdb
Following invokes pdb in shell. I have to type list to look at the python source. Instead is there a way to open the python source file, just like how the c++ source file is opened when a gdb breakpoint is hit? It maybe because pdb is invoked instead realgud:pdb?
/auto/sw/gdb -ex 'add-auto-load-safe-path /users/ap/project1' --args env
/auto/sw/python/bin/pytest -s -vvvs --pdb --trace test/python/test1.py

/auto/sw/python/bin/pytest is a python binary which triggers test/python/test1.py

What does "to open the python source file, just like how the c++ source file is opened when a gdb breakpoint is hit" mean?  Python is written in C, not C++. For me, pytest is an executable bash shell script in ASCII, not a binary.  At least for me, there is too much clairvoyance around what it is that you are trying to do, and what you'd like to see. Maybe giving a full sequence of what you run and what you see and what you expect to see would clarify?


text:
how to create variable-length fields yasnippet snippet
I'm trying to create a snippet that generate a python docstring.
I have a function that parses the current python function for arguments. now I want to use this function in the snippet to generate the list of fields for arguments.
for example if I have a function like this:
def test_func (arg1, arg2, arg3 ):
    pass

using the snippet in this function should prompt me for something like this:
"""
...
Arguments:
  arg1: # {$1} prompt for the first argument
  arg2: # {$2} prompt for second argument
  arg3: # {$3} prompt for third argument
"""


text:
How to make agenda bulk tag actions respect exclusive tag groups?
For example, suppose I have the following tags in an exclusive group:
(setq org-tag-alist '((:startgroup)
                      ("work" . ?w)
                      ("home" . ?h)
                      ("away" . ?a)
                      (:endgroup)))

In Agenda View, I mark items having the "work" tag, then bulk edit them and add the tag "home".
The result is that the "home" tag is simply added, so the resulting tags are :home:work:.
Since those tags are in an exclusive group, I expected the :work: group tag to be removed, when the group tag :home: was added.
This is how it works in regular org buffers. From what I can see, it is also the expected behaviour according to the manual.
Is this a bug, a mistake on my part, and is there any workaround for this behaviour?

I haven't tried to reproduce it but from your description, it looks like a bug to me.


text:
Need an emacs function that reformats a comment, left and right padded
Context
When writing a long text file that has some structure (program, TeX/LaTeX document, whatever programming or markup language), it can be handy to make structure visually salient into visible sections, by having section titles padded by the comment character of the programming/document language.
Starting point
A good starting point exists in this question.
With the code above, you can type some text and have it become a section title.
But what happens when you want to edit the section title? The padding length should be updated.  Code above does not do this.
Concrete example
Let's take a bash script as an example for the syntax.
Code provided by the answer above turns:
some words

into
############################# some words #############################

So far, so good.
But imagine there was a very long section title, that was in the past correctly padded with #### on both sides to the correct length. Then I just shortened the section title to this:
#### just words ####

The code above turns it into:
######################## #### just words #### ########################

I wish it would produce the same as the first example:
############################# just words #############################

In other words it would remove the comment characters left and right before padding, so that the result is always like in the first example.
I did some local research effort but failed to produce something usable.

Notice that emacs can already reformat any paragraph, including a comment paragraph, with fill-paragraph. Perhaps a good way would be to define a comment style that has comment delimiters padding on left and right and just use that already existing function?


text:
Font fallback breaks fixed-pitched grid
I'm looking for a way to achieve strict monospace alignment in Emacs, even when font fallback happens.
There are various fallback fonts available for displaying icons in terminals, for example https://github.com/sebastiencs/icons-in-terminal. They work by putting glyphs in private use areas. Regular text is displayed using the main font according to the user's choice, but glyphs from this private use area will get displayed using the fallback font, since the main font does not contain them.
The font fallback works fine in Emacs too, but the fallback glyphs have different widths from the glyphs of the main font and Emacs respects their widths, which breaks the alignment/grid of the main monospace font. Here is a screenshot to illustrate the problem:

Each line contains exactly 4 characters. The glyph for the folder icon is wider than the glyphs of the main fixed-width font (Inconsolata LGC). Gnome terminal keeps the grid of glyphs by sacrificing glyph width: the folder icon overlaps with the next character. To compensate, one needs to put a space after the icon. Emacs, on the other hand, respects the glyph width, sacrificing the monospace character grid.
Is there a way to achieve strict monospace alignment in Emacs, similar to how terminals behave?
How can I prevent large characters from breaking alignment? is a very similar question, except that the poster wants wide glyphs to occupy exactly two spaces (or more, but a whole multiple), whereas I would always want them to take up a single space regardless of their width. Also that question doesn't have a satisfying answer but I hope that in the 8 years that has passed since then the situation has improved.

If no-ones answers here, I suggest you to send this question to help-gnu-emacs. Actually, have you looked up the topic at emacs-devel and bug-gnu-emacs ?


text:
helm-bibtex actions: copy to separate file and delete entry + associated pdf
I am having difficulty creating specific helm-bibtex actions, and I think that more examples of existent actions in the docs would help.
Namely, I would like to develop actions that:

copy/move several selected entries from one bib file to another. The name of the destination bib file could be entered via a prompt.
Remove selected entries and the associated pdf (if available) from a bib file.

I think that this type of operations are quite standard and useful, specially when dealing with large bibliographies. I'm actually surprised that they are not included by default in helm-bibtex. Thanks.


text:
Polymode in org-edit-special
I use (add-hook 'python-mode-hook 'poly-python-sql-mode) where poly-python-sql-mode is a special polymode that correctly highlights SQL queries that are used within strings in a Python file.
When this is used, and I use org-edit-special on a Python block there is no host-mode syntax highlighting in the Python buffer. Only the inner-modes have syntax highlighting. So the SQL is highlighted, but the Python is not.


text:
How do I get the proper amount of nodes in my org-roam?
I came across two ways of getting the number of nodes in my org-roam system/database.

querrying the sqlite database directly:

#+begin_src sqlite :db (eval org-roam-db-location)
select count(*) from nodes ;
#+end_src

#+RESULTS:
: 183

using the function from org-roam

The documentation stats that org-roam-node-list "return(s) all nodes stored in the database as a list of org-roam-nodes".
#+begin_src elisp
(length (org-roam-node-list))
#+end_src

#+RESULTS:
: 215

I am wondering why I have different results and which one is the "right" one?

Take a look at the source code of org-roam-node-list: the query it runs is much more complicated than the one above. That probably explains the diffferent number, although you might want to run that query by hand to verify. Which is "right", I'll leave for you to decide :-)


text:
Can't create new frame in the text mode
Run Emacs in the text mode:
emacs -nw

M-x make-frame

But new frame is not created


text:
How can i remove a single space or tab in the hungry mode?
I use package hungry-delete for deleting whole indentation but I don't know how can I force removing a single space or tab in that mode. Is there any way to do it or do I need to temporarily disable the hungry mode?

Select it and delete.


text:
S/MIME and Gnus/mu4e
I want to sign emails with s/mime. The emails are created in mu4e, where message composition is based on Gnus.
The variables are set as described here
https://www.emacswiki.org/emacs/GnusSMIME
in particular, I have set
 '(smime-keys
   '(("myname@mydomain.com" "/Users/username/.myemacsconfig/myCertAndKey.pem"
      ("/Users/username/.myemacsconfig/certChain.pem"))))

When I add the MML tag <#secure method=smime mode=sign> and then send, I get the message
No sign key for <myname@mydomain.com>; skip it? (y or n)
The myCertAndKey.pem file contains a certificate for myname@mydomain.com, though.
Is anyone here using Gnus or mu4e with S/MIME signatures, and has an idea what I am doing wrong? Thank you for your help!


text:
eglot + gopls (golang) , make 'find definition' work under /usr/local/src/go
Eglot + gopls works fine.
I have the following in my init.el, and it works for installed packages (mod files)
(require 'project)

(defun project-find-go-module (dir)
  (when-let ((root (locate-dominating-file dir "go.mod")))
    (cons 'go-module root)))

(cl-defmethod project-root ((project (head go-module)))
  (cdr project))

(add-hook 'project-find-functions #'project-find-go-module)

But when I end up visiting a file under /usr/local/go/src/
none of find-definition, find-references works.
Is there a way to make them work when you are outside of your project?


text:
Where is wg-revert-workgroup in Emacs for Workgroups 2?
I'm a bit confused with Emacs for Workgroups, because I have so many problems with it.
Is wg-revert-workgroup something which is not present in Emacs for Workgroups 2?

I guess https://github.com/pashinin/workgroups2/issues/108 will help.  Sounds like EFWG2 might be fairly different to EFWG1, so maybe if you want the latter you should just use that?  I know nothing about it though.


text:
Why is org-cite style not working?
I'm currently trying to manage my bibliography with org-cite and I'm checking both the documentation (1 and 2) together with the blog post to introduce the feature (3). There, they claim that you can use some basic styles within the cite notation and I'm able to use the default ([cite:@key]) and some of them for export, e.g., no-author ([cite/na:@key]) or no-cite ([cite/n:@key]) export to HTML without any problem. But whenever I try to use author ([cite/a:@key]), the export fails with:

org-cite-basic-export-citation: Wrong type argument: characterp, raw

I thought there might be a problem with the .bib file, but I can use it perfectly within a LaTeX document, so I have no clue where the mistake is. Has anybody faced the issue? Is there any solution? The org version I'm using is 9.5.5, if that is relevant.
The debug backtrace first lines:
Debugger entered--Lisp error: (wrong-type-argument characterp raw)
  mapconcat(#f(compiled-function (key) #<bytecode 0x1fc64fa916d8a0c>) ("lang1987linear") ", ")
  org-cite-basic-export-citation((citation (:style "a" :begin 525 :post-blank 1 :end 550 :contents-begin 533 :contents-end 548 :parent ...) (citation-reference ...)) ("a") #s(org-export-backend :name latex :parent nil :transcoders (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :options (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :filters (... ... ... ...) :blocks nil :menu (108 "Export to LaTeX" ...)) (:export-options nil :back-end #s(org-export-backend :name latex :parent nil :transcoders ... :options ... :filters ... :blocks nil :menu ...) :translate-alist (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :exported-data #<hash-table eq 0/4001 0x1563dcae5189> :input-buffer "product.org" :input-file "product.org" :latex-class "notes" :latex-class-options nil :latex-header nil :latex-header-extra nil ...))
  org-cite-export-citation((citation (:style "a" :begin 525 :post-blank 1 :end 550 :contents-begin 533 :contents-end 548 :parent (paragraph ... ... #1 ...)) (citation-reference (:key "lang1987linear" :begin 533 :end 548 :post-blank 0 :parent #1))) nil (:export-options nil :back-end #s(org-export-backend :name latex :parent nil :transcoders (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :options (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :filters (... ... ... ...) :blocks nil :menu (108 "Export to LaTeX" ...)) :translate-alist ((bold . org-latex-bold) (center-block . org-latex-center-block) (clock . org-latex-clock) (code . org-latex-code) (drawer . org-latex-drawer) (dynamic-block . org-latex-dynamic-block) (entity . org-latex-entity) (example-block . org-latex-example-block) (export-block . org-latex-export-block) (export-snippet . org-latex-export-snippet) (fixed-width . org-latex-fixed-width) (footnote-definition . org-latex-footnote-definition) (footnote-reference . org-latex-footnote-reference) (headline . org-latex-headline) (horizontal-rule . org-latex-horizontal-rule) (inline-src-block . org-latex-inline-src-block) (inlinetask . org-latex-inlinetask) (italic . org-latex-italic) (item . org-latex-item) (keyword . org-latex-keyword) (latex-environment . org-latex-latex-environment) (latex-fragment . org-latex-latex-fragment) (line-break . org-latex-line-break) (link . org-latex-link) (node-property . org-latex-node-property) (paragraph . org-latex-paragraph) ...) :exported-data #<hash-table eq 0/4001 0x1563dcae5189> :input-buffer "product.org" :input-file "~/product.org" :latex-class "notes" :latex-class-options nil :latex-header nil :latex-header-extra nil :description nil :keywords nil :subtitle nil ...))
  org-cite-process-citations((:export-options nil :back-end #s(org-export-backend :name latex :parent nil :transcoders (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :options (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :filters (... ... ... ...) :blocks nil :menu (108 "Export to LaTeX" ...)) :translate-alist ((bold . org-latex-bold) (center-block . org-latex-center-block) (clock . org-latex-clock) (code . org-latex-code) (drawer . org-latex-drawer) (dynamic-block . org-latex-dynamic-block) (entity . org-latex-entity) (example-block . org-latex-example-block) (export-block . org-latex-export-block) (export-snippet . org-latex-export-snippet) (fixed-width . org-latex-fixed-width) (footnote-definition . org-latex-footnote-definition) (footnote-reference . org-latex-footnote-reference) (headline . org-latex-headline) (horizontal-rule . org-latex-horizontal-rule) (inline-src-block . org-latex-inline-src-block) (inlinetask . org-latex-inlinetask) (italic . org-latex-italic) (item . org-latex-item) (keyword . org-latex-keyword) (latex-environment . org-latex-latex-environment) (latex-fragment . org-latex-latex-fragment) (line-break . org-latex-line-break) (link . org-latex-link) (node-property . org-latex-node-property) (paragraph . org-latex-paragraph) ...) :exported-data #<hash-table eq 0/4001 0x1563dcae5189> :input-buffer "product.org" :input-file "~/product.org" :latex-class "notes" :latex-class-options nil :latex-header nil :latex-header-extra nil :description nil :keywords nil :subtitle nil ...))

To debug this problem, you need to do M-x toggle-debug-on-error, redo the export and add the backtrace that you will get to your question.


text:
How to make grep buffer replace eshell buffer in current window?
When you grep in eshell, it spawns a grep buffer and displays it in a separate window. I'd like to have it simply display in the same eshell window (replacing the eshell buffer -- same as when you do something like find-file vs find-file-other-window) so it doesn't mess up one of my other windows (but I'd like to use the Lisp grep). Related: Possible to use grep in eshell without opening a *grep* buffer?
My attempts here were unsuccessful:
;; don't pop windows up without my permission
(setq pop-up-windows nil)

(setq switch-to-buffer-obey-display-actions t)
(add-to-list 'display-buffer-alist '("\\*grep\\*.*" display-buffer-reuse-window))

eshell seems to by default behave like this. I would like that whenever I open a new buffer, it always replaces the current unless I explicitly use an other-window command.


text:
export PDF annotations (PDF-Tools)
I started to use PDF-Tools for highlighting and annotations PDFs.
My question is how to extract/export these annotations and highlights to a document (org buffer for instance) from a PDF. I couldn't find a way to do this within PDF-tools.


text:
Yas-snippets not showing dropdown suggestions for python(only)

As the title says Yas snippets don't show a suggestion dropbox when in python mode.I can still tab complete the snippets(just no suggestions).
It works as expected in other modes(tried in latex,org and cpp),with a suggestion dropbox.
Any help is much appreciated.
Additional info:
I use Doom Emacs(minimally modified).


text:
Abbrevs with Skeletons no longer expanding
I've mashed together my own form of "snippets" in Emacs with Skeletons and Abbrevs. I updated the exact macro for generating both the abbrev and skeleton function, but now abbrevs never expand.
A few things to get out of the way:

abbrev-mode is defaulted to t in my config
abbrev-mode is t in the mode that I've been testing this in
The abbrev is shown in M-x list-abbrevs
Calling the exact skeleton function with M-x my-skeleton-function insert text correctly
The abbrev is shown in local-abbrev-table and in the exact mode table
Calling expand-abbrev manually does not expand the abbrev
Calling hippie-expand gives he-string-member: Wrong type argument: sequencep, my-skeleton-function
Evaluating (abbrev-insert (abbrev-symbol "abbrv" the-mode-abbrev-table)) will return abbrv
Evaluating (abbrev-expansion (abbrev-symbol "abbrv" the-mode-abbrev-table)) will return the named skeleton function
I'm using Corfu + Cape for my completion, although I'm not sure if an update to either or both of those would be causing this issue
It's possible this could be an issue with Orderless as I use a custom "style" for it (orderless:fast-dispatch), but maybe not
I'm on the development version of Emacs (major version 30)

Now, with those out of the way, let me give a rough sample of my configuration.
If you don't care to look at configurations for other packages or other things in Emacs and you just want to see what the macro is, scroll the the bottom of the following code block.
;; Abbreviations and Auto Insert
(setq-default abbrev-mode       t
              ;; 'my-local-dir` just points to "~/.emacs.d/.local"
              abbrev-file-name  (concat my-local-dir "abbrev.el")
              save-abbrevs      'silent ; Please stop.
              auto-insert-mode  t
              auto-insert-query nil)   ; Please stop asking.

;; Don't show help for completions
(setq completion-show-help nil)

;; ...
;; the standard stuff you need to install use-package
;; is in my config
;; ...

(use-package orderless
  :preface
  (defun orderless:fast-dispatch (word index total)
    "Dispatch orderless on a WORD where INDEX is 0 and TOTAL is at least 1 character.
Potentially speeds up completion a little bit."
    (and (= index 0) (= total 1) (length< word 1)
         `(orderless-regexp . ,(concat "^" (regexp-quote word)))))
  :config
  (orderless-define-completion-style orderless-fast
    (orderless-style-dispatchers '(orderless:fast-dispatch))
    (orderless-matching-styles '(orderless-literal orderless-initialism orderless-prefixes)))
  (setq orderless-component-separator #'orderless-escapable-split-on-space
        completion-styles '(orderless-fast basic)
        completion-category-defaults nil
        completion-category-overrides
        '((file (styles . (orderless-fast partial-completion)))
          (buffer (styles . (orderless-fast partial-completion)))
          (info-menu (styles . (orderless-fast partial-completion)))))
  (set-face-attribute 'completions-first-difference nil :inherit nil))

(use-package minibuffer
  :ensure nil
  :config
  (unless (package-installed-p 'orderless)
    (setq completion-styles '(basic substring flex partial-completion)))
  (file-name-shadow-mode 1)
  (minibuffer-depth-indicate-mode 1)
  (minibuffer-electric-default-mode 1)
  :custom
  (tab-always-indent 'complete)
  (completions-format 'vertical)
  (completion-cycle-threshold 3)
  (completion-flex-nospace nil)
  (completion-ignore-case t)
  (completion-pcm-complete-word-inserts-delimiters t)
  (read-buffer-completion-ignore-case t)
  (read-file-name-completion-ignore-case t)
  (resize-mini-windows 'grow-only))

(use-package abbrev
  :ensure nil
  :bind ("<C-tab>" . expand-abbrev))

(use-package dabbrev
  :ensure nil
  :bind (("C-M-/" . dabbrev-completion)
         ;;("C-M-/" . dabbrev-expand)
         )
  :custom
  (dabbrev-ignored-buffer-regexps '("\\.\\(?:pdf\\|jpe?g\\|png\\)\\'")))

(use-package hippie-exp
  :bind ("M-/" . hippie-expand)
  :custom
  (hippie-expand-try-functions-list
   '(try-expand-all-abbrevs
     try-expand-dabbrev
     try-expand-dabbrev-all-buffers
     try-expand-line
     try-complete-file-name-partially
     try-complete-file-name
     try-expand-list)))

(use-package corfu
  :hook (after-init . global-corfu-mode)
  :general (:keymaps 'corfu-map
            "TAB"       #'corfu-next
            "<tab>"     #'corfu-next
            [tab]       #'corfu-next
            "C-n"       #'corfu-next
            "S-TAB"     #'corfu-previous
            "<S-tab>"   #'corfu-previous
            "<backtab>" #'corfu-previous
            [backtab]   #'corfu-previous
            "C-p"       #'corfu-previous
            "RET"       #'corfu-insert
            "<return>"  #'corfu-insert
            [return]    #'corfu-insert
            ;; "RET"       #'ignore
            ;; "<return>"  #'ignore
            ;; [return]    #'ignore
            "M-d"       #'corfu-show-documentation
            "M-l"       #'corfu-show-location)
  :preface
  (defun corfu:in-minibuffer ()
    "Allow for Corfu in the minibuffer."
    (unless (or (bound-and-true-p mct--active)
                (bound-and-true-p vertico--input))
      (setq-local corfu-auto nil)
      (corfu-mode +1)))

  (defun corfu:send-shell (&rest _)
    "Send completion candidates when inside comint/shell."
    (cond
     ((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input))
      (eshell-send-input))
     ((and (derived-mode-p 'comint-mode)  (fboundp 'comint-send-input))
      (comint-send-input))))

  (defun corfu:insert-shell-filter (&optional _)
    "Insert completion candidate and send when inside comint/eshell."
    (when (derived-mode-p 'eshell-mode 'comint-mode)
      (lambda ()
        (interactive)
        (corfu-insert)
        (corfu:send-shell))))
  :custom
  (corfu-cycle t)
  (corfu-auto t)
  (corfu-auto-delay 0.66)
  (corfu-auto-prefix 2)
  (corfu-preselect 'prompt)
  (corfu-quit-no-match t)
  (corfu-quit-at-boundary t)
  (corfu-scroll-margin 6)
  (corfu-echo-documentation nil)
  (corfu-popupinfo-delay (cons 0.5 0.5))
  :config
  (add-hook 'minibuffer-setup-hook #'corfu:in-minibuffer 1)
  (corfu-echo-mode +1)
  (corfu-history-mode +1)
  (corfu-popupinfo-mode +1))

(use-package cape
  :after corfu
  :preface
  (defalias 'cape:elisp-capf
    (cape-super-capf
     #'elisp-completion-at-point
     #'cape-abbrev
     #'cape-keyword
     #'cape-symbol
     #'cape-dabbrev)
    "A ‘cape-super-capf’ that’s similar to most simpler Company configurations.
The defacto cape to use for Emacs Lisp.")

  (defalias 'cape:prog-capf
    (cape-super-capf
     #'cape-abbrev
     #'cape-keyword
     #'cape-dabbrev)
    "A ‘cape-super-capf’ for when a ‘prog-mode’-esque mode doesn’t utilitize ‘lsp-mode’.")

  (defalias 'cape:mega-writing-capf
    (cape-super-capf
     #'cape-dict
     #'cape-abbrev
     #'cape-ispell
     #'cape-dabbrev)
    "A ‘cape-super-capf’ for modes for writing.
The defacto cape to use for markup languages for writing.")
  :custom
  (cape-dict-file (expand-file-name "~/.local/share/dict/words"))
  (cape-dabbrev-min-length 2)
  :config
  (setq-mode-local conf-mode
                   completion-at-point-functions (list (cape-capf-buster #'cape:prog-capf)
                                                       #'cape-file)))

;; The part where the custom snippets come in

;;;###autoload
(defun abbrev::abbrev-table-add-props (abbrev-table props)
  "Add one or more PROPS to an existing ABBREV-TABLE.
PROPS should be a plist of (PROP VALUE).
Example:

(:enable-function (lambda (&rest _) (do-something)))"
  (if (cddr props)
      (cl-loop for (k v) on props by #'cddr
               unless (not (abbrev-table-p abbrev-table))
                 unless (abbrev-table-get abbrev-table k)
                  do (abbrev-table-put abbrev-table k v))
    (unless (and (not (abbrev-table-p abbrev-table))
                 (abbrev-table-get abbrev-table (car props)))
      (abbrev-table-put abbrev-table (car props) (cadr props)))))

;; The actual macro I use more mode-based "snippets"
;;;###autoload
(defmacro def-mode-snippet (name
                            mode
                            docstring
                            &rest prompt-and-or-skeleton)
  "Create a MODE specific \"snippet\" with PROMPT-AND-OR-SKELETON.
NAME must be valid in the Emacs Lisp naming convention.

MODE must be a valid major or minor mode that is known to Emacs.

Example: ‘org-mode’, ‘emacs-lisp-mode’, etc.

DOCSTRING is used in the abbrev rather than the skeleton.

PROMPT-AND-OR-SKELETON can be any of the following:
1. A valid Skeleton that uses the internal `Skeleton' langauge
2. A key/value \"pair\" that’s :prompt STRING, followed by
   a valid Skeleton that uses the internal `Skeleton' language.
The prompt given is used by the Skeleton to prompt the user for an input.

This macro makes use of `define-skeleton' and `define-abbrev' in order to
create something similar to a code/writing snippet system, like that of
`YASnippet'. Keep in mind that all abbreviations created are put in the abbrev
table of MODE you passed to this macro.

Example: passing ‘org-mode’ will add the abbrev to the ‘org-mode-abbrev-table’.

That may or may not be something you want depending on your uses.
If you're looking to only define an abbrev globally, see `def-global-snippet'."
  (declare (debug t)
           (doc-string 3)
           (indent defun))
  (let* ((snip-name (symbol-name `,name))
         (func-name (intern (concat (symbol-name mode) "-" snip-name "-skel")))
         (var-str (concat (symbol-name mode) "-abbrev-table"))
         (abbrev-table (intern-soft var-str))
         (has-prompt (keywordp (car prompt-and-or-skeleton)))
         (prompt (if has-prompt (cadr prompt-and-or-skeleton) nil))
         (skeleton (if (not has-prompt) prompt-and-or-skeleton (cddr prompt-and-or-skeleton)))
         ;; Not using this for now until the issue with abbrevs not expanding is solved.
         ;;(enable-fn (lambda (&rest _) (or (eq major-mode 'mode) (numberp (cl-position 'mode minor-mode-list)))))
         )
    (macroexp-progn
     `((define-skeleton ,func-name
         ,(format "%s %s %s %s." snip-name "skeleton. Defined in" var-str "abbreviaton table")
         ,prompt
         ,@skeleton)
       ,(if (not (abbrev-table-p abbrev-table))
            `(define-abbrev ,abbrev-table
               ,snip-name
               #',func-name
               nil
               :system t
               :case-fixed t)
          `(define-abbrev-table ',abbrev-table
             '((,snip-name #',func-name nil :system t :case-fixed t))
             ,(format "An abbrev table for %s" mode)
             :system t
             :case-fixed t)
          (abbrev::abbrev-table-add-props ,abbrev-table
                                          '(:system t
                                            :case-fixed t)))))))

;; The current snippet that I've been testing with in the Emacs Lisp mode
(def-mode-snippet defun emacs-lisp-mode
  "defun snippet for Emacs Lisp"
  > "(defun " @ - " (" @ _ ")" \n
  > -2 "\"" @ _ "\"" \n
  > -1 @ _ ")")

As of note, the use of the custom macro expands to:
(progn
  (define-skeleton emacs-lisp-mode-defun-skel "defun skeleton. Defined in emacs-lisp-mode-abbrev-table abbreviaton table." nil > "(defun " @ - " (" @ _ ")" n > -2 "\"" @ _ "\"" n > -1 @ _ ")")
  (define-abbrev emacs-lisp-mode-abbrev-table "defun" #'emacs-lisp-mode-defun-skel nil :system t :case-fixed t))

For all I know, this could be a bug in Emacs.
If you want to scrutinize my configuration more, you can view it here.
I hope this is enough information.


text:
Preventing loading of packages removed from Emacs's initialization file
Several packages continue to be available for use, even though I have removed them from init.el and restarted Emacs. However, this does not occur with emacs -Q. Previously, the persisting packages were installed using use-package. What could be the reason, and how to prevent this from happening?
Shell:
$ emacs --version
GNU Emacs 28.2
$ readlink -f ~/.emacs
/home/erwann/.emacs.d/init.el
$ cat init.el
;; init.el --- Emacs init file
;;
(provide 'init)
;;; init.el ends here

Snapshots

Your question is analogous to this one:

"I wrote a shell script which installs firefox, and I ran it, and firefox was installed.  I then edited my shell script and removed the line which installs firefox and I ran the script again, and to my surprise firefox is still installed on my system.  Why is that?"

(Or perhaps: "...and to my surprise if I type 'fire' and then TAB in my shell, it provides 'firefox' as a completion.")
The answer in any case is: It's still installed because you haven't uninstalled it.  Not installing something which is already installed has no effect on that thing.
Your init file is not a declaration of your whole Emacs config; it is a software program which is executed as a part of your config.  Your installed packages are another part of your config, and they are functional with or without an init file.
You can use the M-x list-packages menu to manage your installed packages, or use the M-x package-delete command directly.  Provided the package being deleted is not a dependency for something which is still installed, if will be removed.
I believe you'll want to read through C-hig (emacs)Package Installation -- that gives you all the information about managing packages, and controlling how they get activated, but note that:

By default package-initialize initialises all of your installed packages.  This will only load the autoloads file for each package, though -- if they are being loaded any more than that, something has requested it.
Emacs calls package-initialize before evaluating your init file (since 27.1). You can use early-init.el to tell it differently.
You can use package-enable-at-startup to prevent Emacs activating any packages.
you can use package-load-list to control which packages should be activated.

The problem is about packages that were removed from init.el, but appear to be loaded. I shouldn't have to delete them from installed packages to prevent them from loading.

package-initialize is not invoked. As shown, init.el is empty.

@phils: Maybe mention something about package-initialize in your answer, e.g., what you say in your comment.

I've updated the answer to incorporate my comments.


text:
Run a command after vc-git-log-outgoing
I'm trying to fix a problem with this project: https://github.com/domtronn/spaceline-all-the-icons.el
Specifically this code which is supposed to count the number of commits ahead of another branch the current branch is: https://github.com/domtronn/spaceline-all-the-icons.el/blob/master/spaceline-all-the-icons-segments.el#L818
The problem is that vc-git-log-outgoing is asynchronous, and the count-lines stuff ends up counting the lines before vc-git-log-outgoing completes - so it always returns 0.
I've been able to get it to "work" with hacks like (sit-for 0.1) but this feels wrong. What's the correct way to modify this code so that count-lines only happens after vc-git-log-outgoing completes?

https://emacs.stackexchange.com/tags/elisp/info


text:
Changing/removing the background color for the active window in spacemacs
I use spacemacs on Emacs 28.1. The problem I am having is that in the modeline of the
emacs window, the unique window number is displayed. But the color being used to highlight the active window is yellow, and it is impossible to see a white digit against a yellow background.

How would I remove that yell background behind the number 1? For the non-active windows, there is no background and I can see the white numbers against the black background.


text:
Why doesn't Imagemagick's import utility work when called from async-shell-command, but works as expected when called from vterm?
I'm trying to get screenshots working in EXWM. From vterm if I issue the command import png:- | xclip -selection clipboard -t image/png this turns my mouse cursor into a crosshair, prompting me for a rectangular selection to screenshot. Once the screenshot is complete I can use C-v to paste it as I would regularly.
However, if I try to do any of the following (where the second snippet uses general.el):
(setq desktop-environment-screenshot-command "import png:- | xclip -selection clipboard -t image/png")

(nvmap :keymaps 'override
  "c-<print>" '(lambda () (interactive)
         (async-shell-command "import png:- | xclip -selection clipboard -t image/png")))

Or running the initial command through async-shell-command invoked through M-&, I get the crosshair prompt, but cannot paste the results anywhere. Why does this happen, and how can I get imagemagick's import utility to take screenshots from selections in EXWM?
Thank you.


text:
counsel-org-goto to default to current heading
I often use counsel-org-goto to move around org documents, and also within other functions I write to perform an operation within a heading. It would be great if there was a way to default the value to the current heading or quickly fill this value in somehow. I cannot see a way to provide this default or make counsel-org-goto behave in this way. Is there another function which may provide this functionality or another way to achieve this?


text:
Prevent deletion of blank lines when tangling code blocks
The Python style guide asks for two blank lines surrounding class and function definitions (see PEP 8).
When those blank lines are added in Org-Mode source blocks, they are removed during tangling. How can prevent this behavior and keep my blank lines?
The setting (setq org-src-preserve-indentation t) does not do the trick (for me).
This question is related to this one: Org Mode Babel - ensure more than one empty line between tangled code blocks (for python).
In my case I would be fine with adding the blank lines myself and have them tangled as necessary part of the code unless this is bad style.


text:
ivy-rich-mode not loading automatically after Emacs restart
If after restarting Emacs I do M-x ivy-rich-mode, the minibuffer displays "ivy-rich-mode disabled." However, despite this message, the ivy-rich functionality, such as vertical completion, becomes accessible. And then it stays enabled if I do M-x ivy-rich-mode again. Why isn't vertical completion enabled from the start?
init.el:
(use-package ivy
  :ensure t
  :diminish (ivy-mode . "")
  :bind
  (:map ivy-mode-map
    ("C-'" . ivy-avy))
  :config
  (ivy-mode 1)
  ;; add ‘recentf-mode’ and bookmarks to ‘ivy-switch-buffer’.
  (setq ivy-use-virtual-buffers t)
  ;; number of result lines to display
  (setq ivy-height 10)
  ;; does not count candidates
  (setq ivy-count-format "")
  ;; no regexp by default
  (setq ivy-initial-inputs-alist nil)
  ;; configure regexp engine.
  (setq ivy-re-builders-alist
    ;; allow input not in order
    '((t . ivy--regex-ignore-order)))
  ;; Use vertical completion
  (setq ivy-format-function #'ivy-format-function-line)
  )

(use-package ivy-rich
  :after ivy
  :custom
  (ivy-virtual-abbreviate 'full)
  (ivy-rich-switch-buffer-align-virtual-buffer t)
  (ivy-rich-path-style 'abbrev)
  :config
  (ivy-set-display-transformer 'ivy-switch-buffer
                   'ivy-rich-switch-buffer-transformer)
  (setcdr (assq t ivy-format-functions-alist) #'ivy-format-function-line)
  (ivy-rich-mode 1)
  )

(provide 'init)
;;; init.el ends here

PS:
The maintainer's basic usage is :
(require 'ivy-rich)
(ivy-rich-mode 1)

PS2:
(trace-function 'ivy-rich-mode)
(use-package ivy rich
...)

$ emacs --debug-init

I don't know anything about use-package but it sounds like the ivy-rich-mode variable is being set without the function actually being called.  Try putting (ivy-rich-mode 1) at the end of your init file?

If I use your config and trace calls to ivy-rich-mode I see nothing when starting Emacs, and the following after using M-x ivy-rich-mode:
======================================================================
1 -> (ivy-rich-mode 1)
1 <- ivy-rich-mode: t
======================================================================
1 -> (ivy-rich-mode toggle)
1 <- ivy-rich-mode: nil

This tells us that the call to (ivy-rich-mode 1) in your config is happening after the ivy-rich library is being loaded, but that the library is only being loaded on account of autoloading when you call ivy-rich-mode interactively.  So the autoloading triggers the call in your config, after which the interactive toggle happens (which is now switching it off rather than on).
I know nothing about use-package but you presumably want to tell it to load the package right away, and at present you're only telling it what to do if something loads it.
https://github.com/jwiegley/use-package#notes-about-lazy-loading suggests that :demand t is the way to do that.

See C-h f trace-function

I jumped the gun saying it worked. I'll update if figure out. Perhaps this: https://emacs.stackexchange.com/questions/64849/emacs-error-cannot-load-file-counsel

FWIW, my personal opinion is that use-package complicates things for anyone who doesn't have a strong understanding of what it will expand to.  It looks useful for organisation if you know what it does, but seems to add a layer of obfuscation otherwise (and inevitably limits the pool of people who can offer help to those who use it).  My suggestion would be to firstly get this working without using use-package (I would start with the maintainer's suggestion) and then look at porting that configuration to use-package syntax.


text:
Does `get-char-property-and-overlay(nil org-image-overlay)` mean that the first argument was nil or `org-image-overlay`?
I've spent over 20 hours trying to solve an issue with org-mode loading. I've stepped through the code until it reached a function that stack trace indicates fails due to one of the arguments being nil. I'm not familiar enough with emacs debugger to understand which one of the arguments returns nil - is it the result of (org-element-property :begin el) evaluation or the `'org-image-overlay' symbol?
This is unrelated to this question, but does anyone know if it's safe to just remove this function? It's adviced as part of org-yt, but it causes a lot of problems.

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  get-char-property-and-overlay(nil org-image-overlay)
  org-display-user-inline-images(nil nil nil nil)
  apply(org-display-user-inline-images (nil nil nil nil))


text:
Repeat an hourly task in org-agenda grid
Why an hourly scheduled (repeating) task would appear only once in org-agenda grid? I assumed that this entry should appear again (at 17:09, 18:09, 19:09...).

This org-agenda is generated with:
  (setq org-agenda-custom-commands '(
                     ("o" "overview"
        ((agenda "" (
                  (org-agenda-overriding-header "")
                  (org-agenda-span '8)
                  ))
   ...
  )


text:
How to debug Rust with LLDB in Doom Emacs?
I have tried this tutorial to setup debug for rust in doom emacs, but I when I loaded my vscodium generated launch.json I get the message Have you loaded the 'lldb' specific package? and nothing more happens. Thus realized that it is for rust-gdb and not for lldb, doom emacs config is little to no helpful, and dap-mode documentation even less helpful given that their lldb instruction settings are wrong beacuse they don't install the lldb specific package given the persistence of the error message.
My currrent ~/.config/doom/config.el being
(after! dap-mode
  (setq dap-cpptools-extension-version "1.5.1")

  (require 'dap-lldb)

  (with-eval-after-load 'lsp-rust
    (require 'dap-cpptools))
    (with-eval-after-load 'dap-cpptools)

  (with-eval-after-load 'dap-mode
    (setq dap-default-terminal-kind "integrated") ;; Make sure that terminal programs open a term for I/O in an Emacs buffer
    (dap-auto-configure-mode +1)))

And my current ~/.config/doom/packages.el containing
(package! lldb-vscode)

And the error persits.
Note I have (dap-mode +lsp) in my ~/.config/doom/init.el
Note I have no vscode implementations installed in my system, and don't want to.


text:
(apply #'and '(t t t)) is throwing an error. Why?
(apply #'and '(t t t))

gives me
Debugger entered--Lisp error: (invalid-function #<subr and>)
  and(t t t)
  apply(and (t t t))

while
(and t t t)

gives me t.
What am I missing?
This is with emacs -Q on
In GNU Emacs 30.0.50 (build 11, x86_64-pc-linux-gnu, GTK+ Version
 3.24.34, cairo version 1.16.0) of 2023-07-24 built on debian
Repository revision: acebaa793f1b18ad54bccffe7ad07fef8e1cebe1
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux bookworm

Configured using:
 'configure --with-imagemagick --with-xwidgets --with-json
 --without-compress-install --with-tree-sitter
 --with-native-compilation=no'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ
IMAGEMAGICK JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2
M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2
XPM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: en_IN
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: iso-latin-1-unix

With M-x slime and sbcl I get,
; SLIME 2.28
CL-USER> (apply #'and '(t t t))

and
COMMON-LISP:AND is a macro, not a function.
   [Condition of type UNDEFINED-FUNCTION]

Restarts:
 0: [CONTINUE] Retry using AND.
 1: [USE-VALUE] Use specified function
 2: [RETRY] Retry SLIME REPL evaluation request.
 3: [*ABORT] Return to SLIME's top level.
 4: [ABORT] abort thread (#<THREAD tid=3919 "repl-thread" RUNNING {100193E373}>)

Backtrace:
  0: (SB-KERNEL:%COERCE-NAME-TO-FUN AND)
  1: (SB-INT:SIMPLE-EVAL-IN-LEXENV (FUNCTION AND) #<NULL-LEXENV>)
  2: (SB-INT:SIMPLE-EVAL-IN-LEXENV (APPLY (FUNCTION AND) (QUOTE (T T T))) #<NULL-LEXENV>)
  3: (EVAL (APPLY (FUNCTION AND) (QUOTE (T T T))))

My understanding was that macro-s are also functions which map from sexp to sexp.

sbclerror suggests that I cannot apply on a macro.  Let me see what else I find.  Looks like my "mental model" of lisp macros requires further refinement.

The docstring of and say this
and is a special form in C source code.

(and CONDITIONS...)

Eval args until one of them yields nil, then return nil.
The remaining args are not evalled at all.
If no arg yields nil, return the last arg’s value.
Probably introduced at or before Emacs version 19.20.  This function has a byte-compile property byte-compile-and and a byte-code optimizer byte-optimize-and.  See the manual for details.
And the entry to (info "(elisp) Advice and Byte Code")  (see 13.12.5 Advice and Byte Code) says
File: elisp.info, Node: Advice and Byte Code, Prev: Porting Old Advice, Up: Advising Functions
13.12.5 Advice and Byte Code
Not all functions can be reliably advised.  The byte compiler may choose to replace a call to a function with a sequence of instructions that doesn’t call the function you were interested in altering.
This usually happens due to one of the three following mechanisms:

byte-compile properties: If a function’s symbol has a byte-compile property, that property will be used instead of the symbol’s function definition.

byte-optimize properties: If a function’s symbol has a byte-optimize property, the byte compiler may rewrite the function arguments, or decide to use a different function altogether.

compiler-macro: declare forms A function can have a special compiler-macro declare form in its definition (*note Declare Form::) that defines an “expander” to call when compiling the function.  The expander could then cause the produced byte-code not to call the original function.

SBCL is very clear that and is a macro.
Elisp says and is a special form.  Saying and is a special form amounts to waving your hand, and saying "I will do whatever I please with the arguments you provide".
See (info "(elisp) Special Forms") 10.2.7 Special Forms
File: elisp.info, Node: Special Forms, Next: Autoloading, Prev: Macro Forms, Up: Forms
10.2.7 Special Forms
A “special form” is a primitive specially marked so that its arguments are not all evaluated.  Most special forms define control structures or perform variable bindings—things which functions cannot do.
Each special form has its own rules for which arguments are evaluated and which are used without evaluation.  Whether a particular argument is evaluated may depend on the results of evaluating other arguments.
If an expression’s first symbol is that of a special form, the expression should follow the rules of that special form; otherwise, Emacs’s behavior is not well-defined (though it will not crash).  For example, ((lambda (x) x . 3) 4) contains a subexpression that begins with lambda but is not a well-formed lambda expression, so Emacs may signal an error, or may return 3 or 4 or nil, or may behave in other ways.
Just adding the above notes that someone or I myself can fill in the gaps in the argument ...

I find it strange that there is no function to do a boolean and operation.  I think there should be a function for doing boolean arithmetic.  Boolean operations are used as part of control flow, but lisp's way of intermixing boolean operations with control flow is something I find strange.
For now I went with
(require 'dash)
(require 'cl-extra)
(->> (-zip-lists '(1 2)
                 '(4 1))
     (--map (->> it
                 (apply #'<)))
     (cl-every #'identity))

cl-every defined in cl-extra is a function, and it is useful to look at its implementation to see how boolean arithmetic is done.
Does anyone know if dash or some other library allows sorting of a list of list of obects.  If there is one, I will directly use it.  I know that the tabulated-list or tablist or even org-table provides sorting based on multiple columns.  It should be there somewhere ...

Just a suggestion: please remove the text following "This is with emacs -Q on". The emacs version/build-information you provided makes no sense, because this (what you do will signal an error) is defined behavior and is true for any released version. And your question is about ELisp, not Common Lisp. They are different, so it is not surprising that they behave differently. Any irrelevant text will dilute the key information of your question, and will make readers spend more unnecessary time.

I have added reason why i have added the Emacs version ...   In your answer,  I think you are missing steps in your reasoning.  Again that is my humble opinion ... and gets passed in as data to apply, and only when the runtime tries to invoke and it doesn't find it.    That is how your argument should go ... and not the way it is worded.  It is possible that I myself have to make my argument my coherent.  Any answer should explain why and function (or macro) is not available at runtime.

"I find it strange that there is no function to do a boolean and operation" -- it is certainly not strange that and is not a function, because all arguments must be evaluated before a function call, whereas it's crucial to and that only as many arguments as necessary be evaluated.  If you did want a function which performed a boolean and for all of its evaluated arguments you could certainly write one, but (not (memq nil ARGS)) is already pretty trivial.

@shynur: You should add the information from the first comment above to the answer, pointing out that the version information does not make any difference. But as a general point, we want people to record their Emacs version with the question: the OP might not know whether it makes a difference or not, but if it does, it saves a round-trip of me asking in a comment and the OP adding that version to the question. We certainly don't want gobs of irrelevant information in the question, but the version info is minimal and often useful.

@NickD: "OP might not know whether it makes a difference or not, but if it does, it saves a round-trip of me asking in a comment and the OP adding that version to the question." -- I hadn't thought of that. You're right. Thank you

The error report provided by sbcl is more palatable than what  elisp provides.  Definitely there is scope for improvement.  Or it is possible that the implementation of elisp doesn't at all provide any scope for improving on the error message that is already provided.

@phils even after re-reading your message I am not convinced that I shouldn't be surprised by there no being a runtime function for boolean and.  Whether that function is short-circuiting or is  a matter of expedience.  I believe a remark like "this is not strange", implies that there is an assumption being made on what the "norm" is.  And I am sure you agree that what passes off as "normal" depends on which world you live in mostly.

For sure, "the norm" is always going to depend on the context, and the context here is Lisp, and I wouldn't expect and to be a function in any Lisp.  Imagine (and ok-to-delete (delete-it-all)) if and was a function, for instance.  In Lisp it's necessary that the likes of and and or do not unnecessarily evaluate all of their arguments, and therefore they cannot be functions.

The point I was wanting to make was not that there shouldn't be a function (I have no real opinion on that), but rather that if there were a function it couldn't be and specifically, because the requirements for and in Lisp are in conflict with how functions work in Lisp (which I believe is more or less the answer to your question).

OP: when you quote, please trim the quote to what's relevant to the question at hand and use >  markup (or similar) to differentiate between what you write and what you quote.

@mxnt you are asking multiple questions, here. You ask "what am I missing" and then "are there libraries that do something else." Please make sure you ask one and only one question here, so that we can provide you with one and only one answer. Thanks!

OP:

why is (apply #'and '(t t t)) not equivalent to (and t t t)

Follow your logic, (apply #'print '(wryyyy)) is equivalent to
(print wryyyy) instead of (print 'wryyyy).
But this is wrong.  (You can test it yourself.)
apply doesn't work this way.

(apply #'and '(t t t)) is throwing an error. Why?

Because and is a special form (plz C-h f and yourself).
What is a special form?
(and nil (balabala ...))

won't signal an error, but
(and (balabala ...))

will.
As you can see, special form can receive arguments without evaluating them -- when and encounters a nil, it knows that there is no need to evaluate anymore because the result of (and nil ...) is definitely nil.
This is called short-circuit evaluation; it is a defined behavior and is not a bug of version 30.
But apply will always evaluate its arguments.
So what you do make and no longer use short-circuit evaluation.

As contrast, (not (memq nil ARGS)) as mentioned by @phils or
(defun another-and (&rest booleans)
  (if (null booleans)
      t
    (when (car booleans)
      (apply #'another-and (cdr booleans)))))

is what you want.

There is something in this explanation I can't quite figure out ...Note that the argument to apply is quoted.  Evaluating a quoted argument shouldn't be an issue.   And it is OK to evaluate t; it is self-evaluating.  If you look at the error it says the function and doesn't exist.  I  don't think it is even getting to the the args part.  My question is why is (apply #'and '(t t t)) not equivalent to (and t t t)

Let me put my question this way:, if i have a bunch of booleans t and nil in a list---that is a list of booleans- (list t t nil t) etc -- how do I get a logical and of them.  So, (setq x (list t t t)) and (magic magic magic  x more-magic more-magic more-magic) gives me t. What should I fill-in in magic-s and more-magic-s.

@mxnt: You proposed a good question in your first comment. And you can see my updated answer to it. |||| "how do I get a logical and of them." -- Don't see my another-and in the original answer?

Why did you edit my question and remove the emacs version ... Could you please revert it.

@mxnt: Because there is nothing to do with version

Having it wouldn't matter.  Isn't it?

@mxnt: "Having it wouldn't matter." -- Of course matters. This will dilute the useful information of the problem. See http://www.catb.org/~esr/faqs/smart-questions.html

The arguments are boolean literals, and when you evaluate literals you just get them back. The arguments to magics are always literals.

Another thing I don't understand ... why it is saying that it is not able to find and.  If the problem is with arguments, shouldn't the stack trace show error with the arguments instead of the function/macro place in the form?  I found quoting etc &rest, apply etc always  confusing ...

I have added the Emacs version ... Please don't remove it.  It is possible that Emacs is behavng along expected lines (granted that I haven't full  grasped why the observed behaviour is sensible).  The M-x slime experment suggests that there is an opportunity to improve the error report.   When you edit questons without even having a conversation first, you come across as prejudiced.  I am not sure if being prejudiced is same as acting smart  ... I am specifically alluding to your smart questions remark

@mxnt: I didn't say your question is not smart. Did you see that I said your question is good in my comment? The “smart” here is the one in “get the answer from others smartly”. Readers will be more glad to answer your question if they find your question is short enough and can be understood easily. Am I wrong?

I personally don't like people linking to that article.  "Ask smart questions" is what someone will tell  a young person, say a sophomore, and it really means "You are a student.  There is nothing much going on in your life.  Why are you annoying with me meaningless mumbo jumbo. Why don't you put some effort to digest the material at hand".  "Ask questions first", and fill in the gap as you move along is how adults and real-world works.  I have seen what Drew Adams told on help-gnu-emacs and you are merely repeating those words to me. No offense intended or taken.

@mxnt: “I personally don't like people linking to that article.” -- I am sorry. I edited the question just  because I hope others can understand your question more easily, and then you will get your answer more quickly...

@mxnt: “I personally don't like people linking to that article.”  Do you have a better one? I often link to that article because I found it useful when I read it a long time ago (and I've reread it a couple of times since then).

You seem to have a problem when I express what I like or not like.  The original objection was to @shynur deleting some information which i thought was very relevant.  There is an agreement that Emacs version was relevant, and removing it wasn't a good move.   Let us leave it at this.  I see lots of improvements being made to byte compiler code and error reporting.  Considering that the error is on a very recent Emacs, there is an opportunity to improve error reporting.

There was agreement that version information is useful in general, although it is not useful in this case: the fact that apply wants a function (not a macro or special form) is independent of version. It is documented e.g. here

"You seem to have a problem when I express what I like or not like": which "you" are you referring to? If to me, I asked for a better source so that I can read it and possibly recommend in addition to or instead of what I recommend currently. That's all I said.


text:
How to prevent org-exporter from prepending "file://" to the beginning of absolute file paths when exporting to HTML?
I use org-mode to write HTML pages for a website. When I use relative links for navigating the website's directory structure in my org-mode files and I export the org files to HTML, the links work as expected on the localhost.
On the localhost, beginning links with "/" should point to the website's root directory. However, when I use absolute links in my org files for linking to my website's other pages, the org-mode exporter automatically prepends "file://" to the beginning of all the absolute links when exporting the files to HTML. This is a problem because when I run the website on my localhost, the absolute links don't work. Nothing happens when I click on them.
Is there a way to prevent org-mode from prepending "file://" to the beginning of absolute file paths when exporting to HTML, so that all the absolute links behave the same way as relative links?


text:
When using `cl-labels` or `cl-flet` shouldn't the compiler catch signature msmatches
I was expecting a compilation error for the  snippet below... unfortunately compilation goes through without any errors, but it errors during runtime.
Run-time error is expected, so no surprise there.  The surprise is in not getting a compilation error

;;; foo.el --- foo -*- lexical-binding: t; coding: utf-8-emacs; -*-

(defun foo ()
  ;; (cl-labels ((msg (s)
  ;;        (message "%s" s)))
  ;;   (msg
  ;;    ;; "Hello World!"
  ;;    ))

  (cl-flet ((msg (s)
          (message "%s" s)))
    (msg
     ;; "Hello World!"
     )))

(foo)

Initially I went with

;;; foo.el --- foo -*- lexical-binding: t; coding: utf-8-emacs; -*-

(defun foo ()
  (let* ((msg (lambda (s)
        (message "%s" s))))
    (funcall msg
         ;; "Hello World!"
         )))

(foo)

and then switched to cl-labels and cl-flet hoping that it will produce compilation errors.
If I am not getting any compile-time errors, I could as well stay with lambda form.  This way I don't have to be mentally bothered with cl-labels or cl-flet indenting the forms too much to the right.

Elisp is not a static language.

I just added (require 'cl-macs) ---- it is cl-macs and not cl-lib---as per your suggestion.  I still don't get byte compiler errors.

Could you please layout each step in the reasoning from Elisp is not a static language to This is why you don't get compilation errors.

cl-flet expands to a let* form which binds a lambda to a symbol.  Lisp is so dynamic that it is difficult for the compiler to apply static program analysis. You of course know that it will signal an error, because you are intellectual enough, but the compiler is not.


text:
Increasing results candidates for helm-ag?
When I need to make bulk edits in my project, I use helm-ag to find my pattern recursively in all the files, run replace-regexp on the editing buffer, and then commit. One thing in particular I find very convenient about using this method is that unlike other methods, it doesn't open a buffer for each file and saves it, but applies changes directly to the file itself.
This worked very well, until my project became vast and refactoring things results because much harder because helm-ag can only match up to 9999 candidates:

I found no variable which controls the maximum amount of matches, and doing (setq helm-ag-base-command "ag --vimgrep --max-count 999999") didn't seem to change anything either.
Any way I can increase the candidate count? Alternatively, without resorting to shell commands or installing new system binaries, is there any way to achieve what I want without the use of ag? I can guarantee the existence of ag on the system, but not any alternative searches.

https://github.com/emacsorphanage/helm-ag/blob/master/helm-ag.el#L523


text:
Freezing when using gdb via TRAMP with gdb-many-windows enabled
The problem may be because I am doing this via Tramp, connecting to an Amazon ec2 instance where gdb is installed.
I had Emacs 28.2, and now I've upgraded to 29.1 and the same problem occurs. If I have gdb-many-windows on, and I start a debugging session, after a few steps, it freezes, and I observe a spike in Emacs' CPU usage. If I turn off gdb-many-windows, it works fine.
I'm on a 2021 MacBook Pro, M1 Pro Chip, 16GB, running macOS Ventura 13.4.1 (c).
When I issue M-x gdb to start, Emacs offers to run gdb with -i=mi. I tried opening with that setting and without it; without it, nothing even gets off the ground; it just fails right away.
Thanks for any help you can provide!


text:
python, open parenthesis at beginning of line inserts a space
Python code snippet
    (imin_f, jmin_f), (imax_f, jmax_f) = island_f
     non_overlap =set()

n of non_overlab is behind ( , I can't tell which mode is doing it..
c-h k ( gives.
( runs the command self-insert-command (found in global-map), which is
an interactive built-in function in ‘C source code’.

(self-insert-command N &optional C)

Insert the character you type.
Whichever character C you type to run this command is inserted.
The numeric prefix argument N says how many times to repeat the insertion.
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, ‘internal-auto-fill’ is called if
‘auto-fill-function’ is non-nil and if the ‘auto-fill-chars’ table has
a non-nil value for the inserted character.  At the end, it runs
‘post-self-insert-hook’.

  Probably introduced at or before Emacs version 22.1.


text:
Add safety checks to fastest recompile command in the west
In my .emacs file, I have my dream recompile function,
(require 'compile)
(defun jidanni-recompile ()
  (interactive)(recompile 'nil))
(global-set-key "\C-xc" 'jidanni-recompile)

It's "the fastest gun in the west" recompile function.
No ifs, ands, or buts: no questions asked if I want to save
the file (yes) or if I want to use the same command (yes).
OK, if I want to change the command I was using from the compile job I
did two seconds ago, I do M-x compile and enter the new command I want
to start using. Fine.
But the problem comes when I go to some new directory. And I forgot to
do M-x compile to enter the new command, and it switches back to the old
directory and does the old command.
Anyway, I need to make it detect that I have switched directories, and
go back to asking me what command to use in that case. Also in the case
where it's the first compile of the day, and also when I do "C-u C-x c". And in fact it should also notice that I don't seem to be in either the compilation buffer, or the buffer I was just in when I did the last recompile, and also ask me if indeed I am sure I still want to use the same compile command as last time.
(New tag idea: recompile .)


text:
Bulk rescheduling agenda items without altering time of day or DEADLINE?
I currently bulk reschedule agenda items using:
(setq org-agenda-bulk-custom-functions
  '((?D (lambda () (call-interactively 'org-agenda-date-later)))))

This command can be used without a prefix argument to reschedule any marked past items to today. Or it can be used with a prefix argument to specify how many days to change to change the timestamp by.
Another advantage is that it will preserve the time of day of each individual item if present.
The problem is that org-agenda-date-later will instead change the DEADLINE timestamp if one is present, instead of the SCHEDULED timestamp.
I've tried using org-agenda-schedule, but this command prompts for a new timestamp for each individual item, which is tedious and also prone to deleting or altering the time of day.
Is there a method of bulk rescheduling items to today or by a number of days in one action, which will not alter the deadline or require manually setting each item's timestamp?


text:
How can I disable restoring Workgroups for Windows (for Emacs) on startup?
I'm trying to figure out how I can disable the restoring of windows when I start Emacs.
I've asked the project, but it seems this project is not maintained anymore.
Workgroups for Windows (for Emacs)
I've seen some references that it can be disabled, but I can't actually find the command to do so.

If you still have the references you mention, you should add them to the question.


text:
Support for fixed-length fields
I have a file which contains several lines. Each line contains of several "fields" (about 20 - 40 ), each having a fixed length of characters. There are no gaps (field1 follows fields2 and so on) and the field definition for every line is the same.
The field definition is given as a Word table.
As an example, field1 contains characters 1-4, field 2 characters 5-6, and so on.
Reading and writing such a file is very cumbersome: I always need to count characters and when I write, I Have to careful not to spill into the next field.
Does Emacs provide any means helping to read such a file (maybe color coding the fields or representing them in a table) and writing it?

Maybe array mode?


text:
Is there a way to customize dired so that it exclusively shows the file size, as well as the month and day of creation, for each item in the listing?
I've added an image to provide visual clarity. The portion highlighted in red is the area I intend to keep.

I'm aware that there's a method to completely remove all detailed information and display only the folder names – a practice I've observed many emacs users adopting. However, I'm not interested in that approach. I would like to have all the detailed information display when pressing (, though, which is bound to dired-hide-details-mode.
I currently have these flags enabled:
(dired-listing-switches "-agho --group-directories-first"))

Any suggestion is appreciated.

(1) Likely depends on your ls command's options - M-x man ls, or on what ls-lisp.el offers, if you use that. It's not a Dired thing per se. (2) ( is a toggle in Dired; it's quick to show/hide everything. Do you really care that when "everything" is shown it shows only what you describe? I leave everything hidden till I want to see some particular info (then hide everything again).


text:
Is there a way to hide link prefixes in org-mode?
For some link types it would be nice to hide the link prefix automatically. This post does this with text properties, but I'd prefer if it was possible to do with something like prettify-symbols or compose region. The closest I got was...
(defun my/activate-link (start end path bracketp &optional icon)
  "Compose icons before links"
  (save-excursion
    (if org-descriptive-links
        (compose-region start (1+ start) (concat icon " "))
      (org-link-apply-face start end)
      )
    ))

(org-link-set-parameters "menu" :activate-func (lambda (start end path bracketp) (my/activate-link start end path bracketp "\uf0c9")))

I realize this is only fontifying the first two characters of the link. I want to add in a keyword parameter to the arguments list of the function, but that I don't know how to get compose region to find the beginning and end of that keyword.


text:
Using org-goto across multiple files
Is there a way to use org-goto with opened buffer files (and maybe agenda files), just like org-refile does through org-refile-targets?
I have configured org-refile to show the options to choose with the buffer (file) name as a prefix, and the headline levels as a path (with org-refile-use-outline-path set to file). I want to do the same for org-goto. Is this possible?

org-goto goes to a different location in the current buffer (while preserving visibillity), so if you want multiple file capabilities, you will need to build them in a layer above org-goto. You ask "Is this possible?" - the answer is "of course it's possible", but since there is nothing built-in (AFAIK), you will need to do all the programming yourself.


text:
With org-babel, how can I reference a JSON code block with noweb?
Using noweb, I'm trying to reference a JSON block
#+name: gazonk
#+begin_src json
{
  xyzzy "
}
#+end_src

#+begin_src shell :results verbatim :noweb yes
gazonk="${<<gazonk>>@Q}"
echo "$gazonk"
#+end_src

The error I'm getting is
unexpected EOF searching for «"»

I also see this with elisp
#+BEGIN_SRC elisp :noweb yes
(setq example-data "<<gazonk>>")
#+END_SRC

So, I guess the question is how to get the noweb contents into a shell variable, regardless of its contents
I've tried escaping the "<<", but I guess I'm not escaping it correctly;)

See Noweb Reference Syntax


text:
Why does org-babel hang when piping to xsel?
It doesn't hang if I open eshell;)
#+begin_src shell
echo "ehlo" |xsel -b
#+end_src

It does not hang for me, but it behaves better if I specify -i: in that case, it stores ehlo in the clipboard (although it works without the -i on the command line). I suspect that the stdin/stdout plumbing is different enough between babel and the shell to confuse xsel.


text:
Highlighting entries with specific keywords in Elfeed
To avoid missing on important news, I am trying to highlight Elfeed entries containing specific words in their titles:
(add-hook 'elfeed-new-entry-hook
      (elfeed-make-tagger :entry-title '("Blade Runner" "Daria"
                                         "Nendoroid" "Twin Peaks")
                          :add 'hearty))

(defface elfeed-face-tag-hearties
  '((t :foreground "#ff0084"))
  "Highlight my favorite things!")

(push '(hearty elfeed-face-tag-hearties)
      elfeed-search-face-alist)

All entries end up being highlighted, even though they do not contain any of the given keywords.
If I add a new hook for each keyword, however, it then works as intended:
(add-hook 'elfeed-new-entry-hook
      (elfeed-make-tagger :entry-title "Blade Runner"
                          :add 'hearty))

(add-hook 'elfeed-new-entry-hook
      (elfeed-make-tagger :entry-title "Daria"
                          :add 'hearty))

(add-hook 'elfeed-new-entry-hook
      (elfeed-make-tagger :entry-title "Nendoroid"
                          :add 'hearty))

(add-hook 'elfeed-new-entry-hook
      (elfeed-make-tagger :entry-title "Twin Peaks"
                          :add 'hearty))

(defface elfeed-face-tag-hearties
  '((t :foreground "#ff0084"))
  "Highlight my favorite things!")

(push '(hearty elfeed-face-tag-hearties)
      elfeed-search-face-alist)

Would you please tell me if there is a way to achieve this more elegantly, i.e. with a single hook or otherwise?
Your help would be much appreciated! Thank you :)

why not use a loop?


text:
shift+arrow for org-mode
https://orgmode.org/manual/Conflicts.html#index-windmove_002eel
says
;; Make windmove work in Org mode:
(add-hook 'org-shiftup-final-hook 'windmove-up)
(add-hook 'org-shiftleft-final-hook 'windmove-left)
(add-hook 'org-shiftdown-final-hook 'windmove-down)
(add-hook 'org-shiftright-final-hook 'windmove-right)

I try to add to one of (use-package org or (use-package windmove
to keep init.el organized.
How should I put them inside use-package ?

Make sure you understand the first source block here. Then, I guess you will conclude that you can put them wherever you prefer (although I am not sure if you would ever need to configure windmove via use-package, so probably put them in the 'org' one).


text:
After running bs-cycle-next, the changed value of bs-current-configuration goes back to being files
The default value of bs-current-configuration is "files". That being one of the elements in bs-configurations. I have the following configuration(s) in debug.el and run emacs -Q -l debug.el:
(global-set-key [backtab] #'bs-cycle-next)
(use-package bs
  :config
    (defun buffer-sort-key (a  b)
      (string< (buffer-name a) (buffer-name b)))
    (add-to-list 'bs-configurations '(
        "my-config"; name
        nil; bs-must-show-regexp
        nil; bs-must-show-function
        nil; bs-dont-show-regexp
        nil; bs-dont-show-function
        buffer-sort-key)); bs-buffer-sort-function
    (setq bs-current-configuration "my-config"))

Right after launch, I check C-h v bs-current-configuration and indeed it is "my-config". Then I run backtab, i. e., bs-cycle-next and again check C-h v bs-current-configuration to see that it has reverted to "files" again. Is this a bug?