text:
use-package, way to execute :custom or :config block?
:custom block is not executable format such as
  (org-babel-confirm-evaluate nil).
whereas (setq org-babel-confirm-evalulate nil) can be excuted via C-x C-e.
Is there a way to execute a :custom block somehow?
Also, it would be convenient to execute :config block manually to see the code I write works as intended without reloading the module from scratch

Although it is not exactly equivalent, you could try using M-x pp-macroexpand-last-sexp, and then only evaluate the parts that more or less correspond to the :custom: and :config values (I think they are forms starting with custom-theme-set-variables and progn).

It seems, just rerunning the whole use-package block reruns the :config as well

Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review


text:
A file I was using for org-capture has been renamed (*filename*.org -> *filename* (1).org, is this normal?
I wanted to rule out this being a feature of org-capture, maybe a result of manually editing the file or something?
If anyone has any other suggestions as to what else could have caused it I would be very appreciative.
The org-capture template was just an empty todo bullet under a heading, I added some bullets which were not TODO's to the end of the file recently. I don't know when exactly the file rename occured.
Edit:
I should clarify that upon creating a new capture it created a new file filename.org. No new captures are stored in filename (1).org

Welcome to Emacs.SE! I don't believe emacs creates backups that look like this (see also option version-control) – at least not out-of-the-box. Are you sure this isn't your operating system attempting to be 'helpful'? (FWIW, no, I've never seen this behavior in 10+ years of Org use.)

source: Stack Exchange

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

sort: votes


text:
Copying nvmap-defined keybindings to emacs-state using a different prefix key
I use general.el to define keybindings. For evil-mode, I've use nvmap, using something like the following:
(nvmap :keymaps 'override :prefix "SPC" :global-prefix "M-SPC"
       "SPC"    '(counsel-M-x :which-key "M-x")
       "."      '(counsel-find-file :which-key "find-file")
       "u"      'universal-argument
        .
        .
        .

I would like to have these same keybindings when I'm in emacs-state, except using the M-SPC prefix. Is there a way to do this without simply copying and pasting all of these bindings?

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


text:
Function with two completing-read
I want a function designed to accept two completing-read calls, one to set nstruc that holds either "Glyph" or "Command", and actm that holds either "alpha α" or "beta β".
The two variables are then intended to be used inside the body of the function, within the pcase construct shown.
(defun greek (actm)
  "TODO"

  (interactive
   (list
    (let ( nstruc
           (csel '("Glyph" "Command") )
           (cseq '("alpha α" "beta β")) )
      (setq nstruc (completing-read "Instruc: " csel nil t nil))
      (completing-read "Letter: " cseq nil t nil) )))

  (pcase actm
    ("alpha α" (insert "\\alpha"))
    ("beta β"  (insert "\\beta")) )

Perhaps I do not need to put the completing-read calls in the interactive clause, but in the body of the function.
(defun my-custom-function ()
  (interactive)
  (let ((first-choice (completing-read "Enter your first choice: "))
        (second-choice (completing-read "Enter your second choice: ")))
    (message "First choice: %s, Second choice: %s" first-choice second-choice)))

When you use this function, Emacs will prompt you to enter two choices, and it will display the entered choices in the message area.

Is your question how to design a function that fits your description? Or is your question something specific about the code you show? The latter would bit this Q&A site, but the specific question is missing. The former would be too abstract. Either way, missing detail.

Why is it important to enter either \alpha or α ? What problem will this code solve for you? There may be packages out there that already solve your problem.  For instance, see this answer: https://tex.stackexchange.com/a/688137/1299

@Trevoke Because that is what I want the function to do.  Do you have an elisp solution to my function that works, or do you not ?

I guess OP wants to ask what is the difference between (interactive ... completing-read ...) and (interactive) ... (completing-read ...).

@Mahavir "because that is what I want the function to do" is a non-answer. We're here to solve people's problems, not to do people's homework. Real-world problems have context, homework problems do not.

I cleared up obsolete comments and edited the question to remove a tack-on question that was added after the fact. For "how the interactive bit of code in elisp works", the best source of information is the manual: https://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Commands.html

The question is on how to make the variable nstruc available for use in the pcase part.

You can't. nstruc only exists within the scope of your interactive form.
If your function needs a value from interactive it should be a part of the list of function arguments being returned by interactive, so that you can get it from there.
Change your function to accept two arguments and you could make this trivial adjustment:
(interactive
 (let (nstruc
       (csel '("Glyph" "Command"))
       (cseq '("alpha α" "beta β")))
   (list
    (setq nstruc (completing-read "Instruc: " csel nil t nil))
    (completing-read "Letter: " cseq nil t nil))))

Or without the nstruc redundancy:
(interactive
 (let ((csel '("Glyph" "Command"))
       (cseq '("alpha α" "beta β")))
   (list
    (completing-read "Instruc: " csel nil t nil)
    (completing-read "Letter: " cseq nil t nil))))


text:
hydra, let all keys work but not allow insert (self-insert-command)
I am setting up hydra + dap.
Although dap-hydra is provided, it messes up keybinding often times.
Often, I forget the hydra window is open and type something and messes up typing.
Furthermore, when hydra window is not visible, it sometimes seems to catches input away. (maybe a bug)
I think it'd be better if I make the source code buffer read-only while the hydra window is open.
It would be worth considering to make it togglable, so that I keep the hydra window open but interchange between source-edit mode and debug mode (hydra key is used)
I was wondering if there is an available library I could use, (it looks like vim and evil mode does similar thing where you toggle between edit / control mode, but I don't want vim key binding)
Evil seems has the notion of states.
I guess I want two states,

regular emacs states (for source editing and moving)

it seems like Emacs + Insert state combined in evil

debug states (for stepping through, and no source editing)

this seems to be Emacs state (where you can only navagiate

So I need to bind two keys..

regular emacs state: to get out of evil mode, or turn off read-only mode
debug states: to enter into evil Emacs state, or turn on read-only mode

I wonder if there's a better way..


text:
spacemacs|use-package-add-hook for :hook and :bind?
spacemacs provides spacemacs|use-package-add-hook for extending :init and :config but not :hook or other keywords.
Are there way to preserve the use-package syntax when writing spacemacs layers that uses preowned packages?


text:
Writing a conditional in a compact way
Could I write the if condition on the same line.  Is there any other way to include the equivalent of the if conditional in a more compact way ?
 (pcase grapheme
    ("dinkus"
       (if (equal var "this")
           (insert "this")
         (insert "that"))))

Welcome!  Have you tried it to see what happens?

(insert (if (equal var "this") "this" "that"))
or
(insert (or (and (equal var "this") "this") "that")) Sometimes one uses the and-or-construct when the expression returns something.

Based on the last question, I'm guessing you're using a pcase statement with dozens of possible choices to insert either a latex character or a greek UTF-8 character. If I'm right about this, then this is the wrong question to ask. Help us by telling us the real problem you're trying to solve.

@Trevoke: "If I'm right about this, then this is the wrong question to ask." -- IMHO, we could answer the question even if it's wrong. Following this principle, we don't need to worry about whether the question is wrong or not -- If it's not wrong, that's good; if it's wrong, we can still answer it, and OP (and perhaps other readers) can still learn something, which is also good.

Yes. Just make these things functions and call the functions. That's how all programming works. You put multiple lines of code in one line of code by wrapping the multiple lines of code into a function.

Only to show that this could be a XY-problem (TLDR: If we knew better what you want to do we could give you better help.):
If you are testing var in each of the pcase cases you could include that variable in the pcase-conditions:
(pcase (list grapheme var)
    ('("dinkus" "this")
     "this value")
    (`("dinkus" ,_)
     "that value"))

Disclaimer: I actually wanted to write this text as a comment. But, that comment turned out to be unreadable because of the missing newlines in the code. So I ended up writing an answer. But, maybe it is even acceptable as one of the possible answers.


text:
Can a noweb block be directed to a specific output block?
I know you can give a block the property :noweb-ref give it a reference name like foo and then in another noweb block you can refer to the reference block with <<foo>>. However this means that for every block tagged with :noweb-ref I then need to add a line to the target block. Is there anyway of of telling the reference block its target instead? For example, it might look something like:
#+begin_src :noweb yes :noweb-ref target-block
Check out this awesome list:
#+end_src

#+begin_src :noweb-target target-block
- one
#+end_src

#+begin_src :noweb-target target-block
- awesome
#+end_src

#+begin_src :noweb-target target-block
- list
#+end_src

And this would tangle to:
Check out this awesome list:
- one
- awesome
- list


text:
smartparens face for enclosing parenthesis?
sp-show-pair-matching-face is the current matching face.
I think smartparens also has a face to the enclosing open parenthesis.
I can't find its name
related question is, can I find out the face of text which I can't place my cursor to? (so I can use C-u C-x = to find the face)

grep 'sp-.*-face' smartparens.el?


text:
Doom(?) Emacs: whitespace-mode uses incorrect style in c-mode?
I'd like emacs to display tab-marks nicely in c mode: here's an example of how it displays tabs in my config.el, which is how I want it to display tabs everywhere.

You can see the nice > characters in the middle few lines.
Doom's not configured to display tab marks in c-mode, weirdly. That can be fixed with the following snippet.
(use-package whitespace
  :custom
  (whitespace-style '(face indentation tab-mark))

  ;; Turn on global-whitespace-mode, otherwise doom-highlight-non-default-indentation-h sets its own
  ;; whitespace configuration for some reason.
  :config (global-whitespace-mode +1))

Even with that though, it's kind of ugly.

It looks like the faces are messed up for some reason? Is this how tab marks look for everyone in c-mode or is doom messing some faces up? Is there some variable that I can M-x debug-on-variable-change to see if it's getting messed up?

This looks like a face issue. whitespace uses a couple different faces to render its text, place your cursor on the problematic character and invoke describe-face to see what face is used.


text:
Mixed display-line-numbers-type for evil users?
I want something like:
(setq display-line-numbers-type 'mixed)
Which count wrapped line as "relative", and count folded line as "visual"
Is there any way to achieve this?

Say I have a file with contents:
first line
second line is so long that need to be wrapped
* third line is a title
cat is cat
* fifth line is a title
dog is dog

When (setq display-line-numbers-type t)

1 first line
2 second line is so long that need to be
  wrapped
3 * third line is a title
5 * fifth line is a title

When (setq display-line-numbers-type 'relative)

0 first line
1 second line is so long that need to be
  wrapped
2 * third line is a title
4 * fifth line is a title

When (setq display-line-numbers-type 'visual)

0 first line
1 second line is so long that need to be
2 wrapped
3 * third line is a title
4 * fifth line is a title

However, I want this behavior:

0 first line
1 second line is so long that need to be
  wrapped
2 * third line is a title
3 * fifth line is a title

The question is maybe understandable, but a little more detail might help...


text:
helm M-x is executing command twice?
I execute a command M-x pyvenv-workon
It is called twice as below, wonder why
The first call stack trace shows the correct path to the virtualenv
  spacemacs//python-setup-shell("/Users/littlehome/virtualenvs/can")
  funcall(spacemacs//python-setup-shell "/Users/littlehome/virtualenvs/can")
  spacemacs/python-setup-everything("/Users/littlehome/virtualenvs/can")
  apply(spacemacs/python-setup-everything "/Users/littlehome/virtualenvs/can")
  pyvenv-activate("/Users/littlehome/virtualenvs/can")
  apply(#f(compiled-function (name) "Activate a virtual environment from $WORKON_HOME.\n\nIf the virtual environment NAME is already active, this function\ndoes not try to reactivate the environment." (interactive #f(compiled-function () #<bytecode -0x12a7cc692c045eca>)) #<bytecode 0xdc7dd672f6e05f>) "can")
  pyvenv-workon("can")
  funcall-interactively(pyvenv-workon "can")
  call-interactively(pyvenv-workon record nil)
  command-execute(pyvenv-workon record)
  helm-M-x-execute-command(pyvenv-workon)
  helm-execute-selection-action-1()
  helm-execute-selection-action()
  helm-internal
  apply
  helm
  apply
  helm
  helm-M-x-read-extended-command
  helm-M-x(nil)
  funcall-interactively(helm-M-x nil)
  call-interactively(helm-M-x)
  (let ((completion-styles completion-styles)) (add-to-list 'completion-styles 'flex t) (call-interactively 'helm-M-x))
  spacemacs/helm-M-x-fuzzy-matching()
  funcall-interactively(spacemacs/helm-M-x-fuzzy-matching)
  call-interactively(spacemacs/helm-M-x-fuzzy-matching nil nil)
  command-execute(spacemacs/helm-M-x-fuzzy-matching)

Whereas 2nd call (which is called automatically, and I don't know why it's getting called) doesn't have the correct path
  spacemacs//python-setup-shell("can")
  funcall(spacemacs//python-setup-shell "can")
  spacemacs/python-setup-everything("can")
  apply(spacemacs/python-setup-everything "can")
  pyvenv-workon("can")
  funcall-interactively(pyvenv-workon "can")
  call-interactively(pyvenv-workon record nil)
  command-execute(pyvenv-workon record)
  helm-M-x-execute-command(pyvenv-workon)
  helm-execute-selection-action-1()
  helm-execute-selection-action()
  helm-internal
  apply
  helm
  apply
  helm
  helm-M-x-read-extended-command
  helm-M-x(nil)
  funcall-interactively(helm-M-x nil)
  call-interactively(helm-M-x)
  (let ((completion-styles completion-styles)) (add-to-list 'completion-styles 'flex t) (call-interactively 'helm-M-x))
  spacemacs/helm-M-x-fuzzy-matching()
  funcall-interactively(spacemacs/helm-M-x-fuzzy-matching)
  call-interactively(spacemacs/helm-M-x-fuzzy-matching nil nil)
  command-execute(spacemacs/helm-M-x-fuzzy-matching)

--

edit

Turns out pyvenv-workon has 2 same defadvice attached to it.


text:
How can I select and call a tempo template inside a tempo template?
I am writing a set of tempo templates in order to help me writing Nixpkgs boilerplate code.
Here is my code, and I will refer to it henceforth.
The workflow I intent is similar to this:

Call tempo-template-nixpkgs-mkderivation;
When the template asks about the fetcher (it can be nixpkgs-fetchurl or nixpkgs-fetchfromgithub), save it;
At the time of insert the saved fetcher, call the corresponding tempo-template as in a recursive behaviour;
When finished the inner template insertion, continue to the outer.

Question: how can I implement this workflow?
(As an extra, I would like to do the same but with skeletons.)


text:
How to use connection-local-set-profiles to set inferior-ess-r-program when on using ESS over TRAMP?
This is a similar question to this other that remains unanswered.
I am doing some work in the R language with the ess package on emacs on a remote computer to which I connect via tramp/ssh. The remote computer is on my .ssh/config named dev_node. ESS is supposed to be able to attach to a running R process. To launch this R process, it uses the variable inferior-ess-r-program.
I would like emacs to know that, when I am on ssh over TRAMP, the value of the variable inferior-ess-r-program should be  /mnt/opt/Centos/path/to/bin/R.
I thought that using connection-local-variables would do the trick, so I tried:
(connection-local-set-profile-variables
 'remote-R
 '((inferior-ess-r-program . "/mnt/opt/Centos/path/to/bin/R")))

(connection-local-set-profiles
 '(:application tramp :protocol "ssh" :machine "dev_node")
 'remote-R)

But it did not work. Ess is incapable of launching R. Also, if on eshell I do echo $inferior-ess-r-program I only receive R.
On the other hand, if I run
(setq inferior-ess-r-program "/mnt/opt/Centos/path/to/bin/R")

ESS is able to launch a process and echo $inferior-ess-r-program on the eshell returns the expected value. But then this setting is not connection-specific.
Am I using connection-local-variables wrong? Is this not its intended purpose? What should I be doing instead?

Connection-local variables require, that they are set in a recent buffer. Since I don't use R and ess, it might require to understand more details of your setup. The Tramp ML tramp-devel@gnu.org might be a place to discuss this.


text:
Need help using a custom tcblistings environment for src blocks
I'm trying to advise the function org-latex-src-block--listings to use a tcblistings environment that I like. In LaTeX the environment is used like...
\begin{code}[title=TITLE, language=LANGUAGE, file={ICON \ \raisebox{0.1\height}{FILE}}]
<code here>
\end{code}

So far I have done...
(cl-defun my/org-latex-src-block--listings
    (&key src-block info lang caption caption-above-p label num-start retain-labels attributes float &allow-other-keys)
  "Transcode a SRC-BLOCK element from Org to LaTeX, using listings.
LANG, CAPTION, CAPTION-ABOVE-P, LABEL, NUM-START, RETAIN-LABELS, ATTRIBUTES
and FLOAT are extracted from SRC-BLOCK and INFO in `org-latex-src-block'."
  (let ((lst-lang
         (or (cadr (assq (intern lang)
                         (plist-get info :latex-listings-langs)))
             lang))
        (caption-str
         (when caption
           (let ((main (org-export-get-caption src-block))
                 (secondary (org-export-get-caption src-block t)))
             (if (not secondary)
                 (format "{%s}" (org-export-data main info))
               (format "{[%s]%s}"
                       (org-export-data secondary info)
                       (org-export-data main info))))))
        (lst-opt (plist-get info :latex-listings-options)))
    (concat
     (format
      "\\begin{code}[%s]\n%s\\end{code}"
      ;; Options.
      (concat
       (org-latex--make-option-string
        (append
         lst-opt
         (cond
          ((and (not float) (plist-member attributes :float)) nil)
          ((string= "multicolumn" float) '(("float" "*")))
          ((and float (not (assoc "float" lst-opt)))
           `(("float" ,(plist-get info :latex-default-figure-position)))))
         (unless (plist-get info :latex-listings-src-omit-language)
           `(("language" ,lst-lang)))
         (when label
           `(("label" ,(org-latex--label src-block info))))
         (when caption-str
           `(("title" ,caption-str)))
       (let ((local-options (plist-get attributes :options)))
         (and local-options (concat "," local-options))))
      ;; Source code.
      (let* ((code-info (org-export-unravel-code src-block))
             (max-width
              (apply 'max
                     (mapcar 'string-width
                             (org-split-string (car code-info) "\n")))))
        (org-export-format-code
         (car code-info)
         (lambda (loc _num ref)
           (concat
            loc
            (when ref
              ;; Ensure references are flushed to the right,
              ;; separated with 6 spaces from the widest line of
              ;; code
              (concat (make-string (+ (- max-width (length loc)) 6) ?\s)
                      (format "(%s)" ref)))))
         nil (and retain-labels (cdr code-info))))))))
(advice-add 'org-latex-src-block--listings :override #'my/org-latex-src-block--listings)

The last part involves the file portion of the tcblisting. I'd like to use the file in the :tangle header argument as the FILE argument, and I'd like to add an icon based on the language. Below is an example table of the icons I'd like transcoded into the ICON portion of the tcblisting:

language
icon

latex
\LateX

python
\faPython

bash, shell
\faLinux

js
\faJs

css
\faCss3

R
\faRProject

sql, sqlite
\faDatabase

markdown
\faMarkdown

ELSE
\faFileCode

How can I accomplish this?


text:
spacemacs override keybinding for Edebug mode
(define-key evil-evilified-state-map (kbd "C-b") 'evil-scroll-page-up)

is picked up by edebug-mode in spacemacs
I want to override it
  (evilified-state-evilify-map edebug-mode-map
    :eval-after-load edebug
    :bindings
    "C-f" #'forward-char
    "C-b" #'backward-char
    "C-d" #'delete-char

    )

it has no effect, (I tried removing "eval-after-load") as well,
How can I overload evilified key binding (I don't want to turn it off by
 (evil-set-initial-state 'edebug-mode 'emacs)


text:
Save LaTeX/AucTeX generated auxiliary files to a separate directory EXCEPT for the PDF file
I am using AucTex in Emacs to compile my LaTeX files. Is there a way to keep just the PDF file in the current directory and send all the other auxiliary files to a separate folder? I have set TeX-output-dir to ./tmp. However, this saves the pdf file to the tmp folder as well. I would like to have the pdf file in the current directory. Thanks a lot for your time! :)


text:
color org-agenda entries by level
My org agenda (I use it as a todo-list without dates with the alltodo type, generating a list of all todo entries for each file) has many entries with many subheadings (which can again have multiple subsubheadings). While indentation helps to some extent make it not like a big wall of text, I recently realized it would be nice to have coloring based on the level of the entry. Ideally I would like to apply the org-level faces, i.e. org-level-1 to top-level entries, org-level-2 to subheadings and so on. I searched a bit but couldn't find anything. Is this possible?


text:
Org mode keyword completion with pcomplete showing uppercase and lowercase duplicates
Invoking complete-symbol after #+ in an Org buffer uses pcomplete to display the following completion candidates list:
ORG:
org:
BIND:
bind:
DATE:
date:
etc.

I would like to remove the duplication of uppercase and lowercase candidates (preferably keeping the lowercase candidates). I have tried (setq completion-ignore-case t), but this doesn't change it.
My guess is that there is a variable containing this list of candidates for org export keywords, and I need to find it and remove the uppercase elements.


text:
How to see if a keybinding is used in any mode?
For example, I once set <C-j> as <C-x>, only to find out <C-j> is used for org-forward-heading-same-level in org-mode.
I know <C-h> k shows a keybinding's usage in current mode. However, how could I know if a keybinding is used in any mode, so that I can safely set it to whatever I like without accidentally breaking anything?


text:
Syntax highlighting for source blocks inside special blocks
Syntax highlighting doesn't work for source blocks that are nested inside special blocks:
#+BEGIN_test
#+begin_src js
return 14
#+end_src

#+RESULTS:
: 14
#+END_test

#+begin_src js
return 14
#+end_src

#+RESULTS:
: 14

Above the cursor, I have a source block inside a special whose syntax is not highlighted. The same block below the cursor is highlighted correctly.
Is there a way to get the syntax highlighting inside nested source blocks?
I found an answer on how syntax highlighting works in EMACS. It is fine with me if there is a way to manually do this process to get syntax highlighting inside nested source blocks.


text:
desktop-save mode prevents Emacs from refreshing
I'm using Emacs 29.1 on Windows.
I've found desktop-save is problematic. My configuration is:
(use-package desktop
  :init
  (setq desktop-dirname             "~/.emacs.d/desktop/"
        desktop-base-file-name      "emacs.desktop"
        desktop-base-lock-name      "lock"
        desktop-path                (list desktop-dirname)
        desktop-save                t
        desktop-load-locked-desktop nil
        desktop-auto-save-timeout   30
        desktop-restore-eager       t
        )
  :config
)

(desktop-save-mode 1)

When I remove these everything works fine, except the session is not saved and restored (obviously). When I enable desktop-save, my Emacs can no longer properly redraw itself.
For example, when I activate magit with desktop-save enabled, it doesn't show up in the other window until I press another key. Which key is doesn't matter: I just have to press something otherwise Emacs doesn't redraw and magit doesnt show up.
Does anyone know how to solve this, or is there an alternative to desktop-save? (I tried disabling desktop-restore-eager, but once it loads up the buffers the problem comes back.)

M-x report-emacs-bug


text:
Texinfo produces "see" for @ref commands in Info-mode
I'm trying to produce a manual in Info format and I'm getting  a little confused about @ref and the *note/see markers.
I thought that for HTML output, @ref would behave like @xref and produce the 'see' marker, as described here:

Why do I have ‘see’ appearing in front of all of my links?
By default, Emacs Info mode either changes the marker ‘*note’ for cross-references to ‘see’, or hides it completely. Command-line info does the same if hide-note-references is set. Unfortunately, there is no way to do this reliably, as both the @pxref and @ref commands in Texinfo output this marker in the Info output, and the ‘see’ text is only appropriate for @pxref.
Yes, but how do I get a plain link, with no extra markup?
You can’t. Info is a plain text format that is displayed mostly as-is in the viewers, and without the ‘*note’ text there would be nothing to mark text as a link. Additionally, in printed output there is no such thing as a plain link, as the page number of the target would have to be printed somewhere.

But I find that this also happens when I'm browsing a manual in Info-mode as well, albeit inconsistently.
As an example, if I look at the .texi source for the AucTeX manual, I find a few @ref commands:
If the last process you started was
on the region, the commands described in @ref{Debugging} and
@ref{Control} will work on that process, otherwise they will work on the
process associated with the current document.

This is translated into
   If the last process you started was on the region, the commands
described in *note Debugging:: and *note Control:: will work on that
process, otherwise they will work on the process associated with the
current document.

and when viewed in Emacs, looks like this:

So the first @ref command has the 'see' hidden, while the second displays it.
In general, I find that the AucTeX manual manages to keep the appearances of 'see' to a minimum – is there some strategy that allows one to do this? E.g. no more than one @ref per line/node? Or is this just something we have to live with (until maybe someone comes up with a *note-no-see marker)?
And yes, I've also read about Info-hide-note-references (which has been set to t in my Emacs), including in this post, which suggests some kind of file-local variable setting as a solution – though I'm not sure how to implement it.


text:
mu4e crashing when drag-and-dropping file attachment in mu4e:compose mode
I am running Emacs 29.1 (9.0) on Mac OS Ventura 13.5 and have recently upgraded to mu4e 1.10.7.
Since after the upgrade, Emacs crashes whenever I try to drag-and-drop a file into mu4e:compose mode in order to attach it to an e-mail.
Actually, the behavior is slightly more weird. I can attach text files without Emacs crashing, if I have drag-and-dropped the file before to Emacs and opened it (e.g., in the scratch buffer), and then drag-and-drop it into the mu4e:compose buffer. In this case, I get the expected
<#part filename="/file.txt" disposition=attachment>
<#/part>
in the mu4e:compose buffer.
Also, if I drag-and-drop a file that I have opened before in another mu4e buffer (such as the headers view), then Emacs crashes.
Upon crashing, I get the error message "Emacs quit unexpectedly."
All this worked fine before the upgrade to mu4e 1.10.7.
Does anyone have similar problems, or any ideas where this could come from and how it could be fixed?


text:
Weird behaviour on emacs with running django server in terminal
something weird is going on in my 'emacs-IDE'. I am editing some javascript files in a django project using spacemacs. Some tools I use are treemacs and lsp-mode.
In order to test my code I call up a shell using spacemacs/default-pop-shell and start the django server from there python manage.py runserver.
Now here comes the catch: when I edit some javascript code, e.g. uncomment a console.log() statement, the old code gets loaded even when I kill the server and restart it (which should not be required anyways). Is there some bug that makes emacs somehow cache and load the 'old' files? Seems like a stupid question, but I cannot think of another explanation why my edits do not get applied immediately.
document.addEventListener('DOMContentLoaded', function() {

    // Use buttons to toggle between views
    document.querySelector('#inbox').addEventListener('click', () => load_mailbox('inbox'));
    document.querySelector('#sent').addEventListener('click', () => load_mailbox('sent'));
    document.querySelector('#archived').addEventListener('click', () => load_mailbox('archive'));
    document.querySelector('#compose').addEventListener('click', compose_email);

    // Disable submit button unless recipients field and subject has some content
    document.onkeyup = () => {
        //console.log('buttonpressed');
        const recipientsValue = document.querySelector('#compose-recipients').value;
        const subjectValue = document.querySelector('#compose-subject').value;
        // console.log('Recipients:', recipientsValue);
        if (recipientsValue.length > 0 && subjectValue.length >0) {
            document.querySelector('#compose-submit').disabled = false;
            // console.log('enabled');
        } else {
            document.querySelector('#compose-submit').disabled = true;
            // console.log('disabled');
        }
    };
    // By default, load the inbox
    load_mailbox('inbox');
});

function compose_email() {

    // Show compose view and hide other views
    document.querySelector('#emails-view').style.display = 'none';
    document.querySelector('#compose-view').style.display = 'block';

    // Clear out composition fields
    document.querySelector('#compose-recipients').value = '';
    document.querySelector('#compose-subject').value = '';
    document.querySelector('#compose-body').value = '';
}

function load_mailbox(mailbox) {
    // Show the mailbox and hide other views
    document.querySelector('#emails-view').style.display = 'block';
    document.querySelector('#compose-view').style.display = 'none';

    // Show the mailbox name
    document.querySelector('#emails-view').innerHTML = `<h3>${mailbox.charAt(0).toUpperCase() + mailbox.slice(1)}</h3>`;
}

Above is the existing code in my /static/mail folder.
However, the line I last commented out is line 15: // console.log('Recipients" ...)
In the Inspector/Debugger in the browser the line shows as uncommented. I have since then reloaded the emacs instance. Same result...
Am I missing something here?


text:
How to install common lisp with emacs and SLIME when the slime-helper.el is not automatically generated?
I want to get started with Common Lisp and I follow this guide to install it on my arch linux machine. However, this call fails:
(load (expand-file-name "~/.quicklisp/slime-helper.el"))

...because there is actually no such slime-helper.el file in my ~/.quicklisp-folder. How do I proceed with normal installation?

This doesn’t seem to be an emacs question at all.
Did you successfully install the :quicklisp-slime-helper package in the previous step? Carefully examine the output in your shell; it should have a message telling you to add the helper to your Emacs init, something like this:
slime-helper.el installed in "/home/db48x/.quicklisp/slime-helper.el"

To use, add this to your ~/.emacs:

  (load (expand-file-name "~/.quicklisp/slime-helper.el"))
  ;; Replace "sbcl" with the path to your implementation
  (setq inferior-lisp-program "sbcl")

If you don’t see this message, and you see an error message instead, then  you should fix the error indicated in the error message.

Using quicklisp to install SLIME is not the easiest way. The easy way is to just use-package the emacs slime package : when you run slime inside Emacs, slime will automatically install the common lisp part (called SLYNK) into your common lisp implementation.
Here is my configuration :
(use-package slime
  :init
  (progn
    (require 'slime-autoloads)
    (add-hook 'slime-mode-hook
              (lambda ()
                (unless (slime-connected-p)
                  (save-excursion (slime))))))
  :config
  (progn
    (use-package slime-company)
    (setf inferior-lisp-program "sbcl")
    (slime-setup '(slime-fancy slime-company))
    (setq slime-net-coding-system 'utf-8-unix)
    (define-key lisp-mode-map (kbd "C-c C-q") 'slime-close-all-parens-in-sexp)
    (define-key slime-mode-indirect-map (kbd "M-_") 'paredit-convolute-sexp)
    (define-key slime-repl-mode-map (kbd "C-c C-z") #'quit-window)
    (define-key slime-repl-mode-map (read-kbd-macro paredit-backward-delete-key) nil)))


text:
treemacs cannot open function in another window
I'm getting file-name-extension: Wrong type argument: stringp, nil when opening a function in Treemacs.
If I open the variable defined in that function, then it works fine. The line of the variable gets opened in the window but when I do the same for the function, it errors out:
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-name-nondirectory(nil)
  file-name-extension(nil)
  treemacs--visit-or-expand/collapse-tag-node(#<marker (moves after insertion) at 636 in  *Treemacs-Scoped-Buffer-No Tab*> nil nil)
  treemacs-visit-node-no-split(nil)
  funcall-interactively(treemacs-visit-node-no-split nil)
  call-interactively(treemacs-visit-node-no-split)
  treemacs-rightclick-menu((mouse-3 (#<window 161 on  *Treemacs-Scoped-Buffer-No Tab*> 647 (228 . 665) 48575959 nil 647 (26 . 30) nil (6 . 5) (8 . 17))))
  funcall-interactively(treemacs-rightclick-menu (mouse-3 (#<window 161 on  *Treemacs-Scoped-Buffer-No Tab*> 647 (228 . 665) 48575959 nil 647 (26 . 30) nil (6 . 5) (8 . 17))))
  call-interactively(treemacs-rightclick-menu nil nil)
  command-execute(treemacs-rightclick-menu)

Does anyone know what I can do I fix this problem?
Furthermore, when I click "enter" on the function instead of using the mouse, treemacs duplicates the contents of the file. By this I mean, if the function looked like this:
    | --f
        |-- var1
        |-- var2

After pressing enter, treemacs looks like this:
    | --f
        |-- var1
        |-- var2
        |-- var1
        |-- var2

If I press enter again, it'll add var1, var2 for the third time and so on.
It very strange. How do I fix this?
Here is the debugger when I press o-o on a function or class in Treemacs:
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-name-nondirectory(nil)
  file-name-extension(nil)
  treemacs--visit-or-expand/collapse-tag-node(#<marker (moves after insertion) at 469 in  *Treemacs-Scoped-Buffer-No Tab*> nil nil)
  treemacs-visit-node-no-split(nil)
  funcall-interactively(treemacs-visit-node-no-split nil)
  call-interactively(treemacs-visit-node-no-split nil nil)
  command-execute(treemacs-visit-node-no-split)


text:
Org-mode: Adding Attributes and Captions to Babel Table Results
Given the following org-mode file:
#+TITLE: Tests

#+LATEX_HEADER: \usepackage[outputdir=build]{minted}

* Export Configuration

#+name: Configuration
#+begin_src emacs-lisp :results silent :exports both
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((emacs-lisp . t)
     (shell . t)
     (python . t)
     (org . t)
     (latex . t)))
#+end_src

#+NAME: attr_wrap
#+BEGIN_SRC shell :var data="" tex="1.0\\textwidth" html="50%" caption="" :results output
  echo "#+ATTR_LATEX: :width $tex"
  echo "#+ATTR_HTML: :style $html"
  if [ -n "$caption" ]; then echo "#+CAPTION: $caption" ; fi
  echo "$data"
#+END_SRC

#+name: read-csv
#+begin_src python :results value table silent :var csvfile="" header="" :exports none :eval yes :colnames yes :rownames yes
  import csv
  with open(csvfile, 'r') as f:
       data = [row for row in csv.reader(f)]
       if header and len(data) >= 2:
          # Inserts an empty line to create a hline.
          data.insert(1, None)
       return data
#+end_src

* Tests

#+CALL: read-csv("build/test.csv", "yes") :post attr_wrap(data=*this*, tex="0.4\\textwidth", html="width:50%", caption="Result figure\\nbsp{}[[fig:link]")

My intent behind this is:
During org-mode export, import a dynamically generated CSV file as an org-mode
table, possibly operating slightly on it and then adding captions and
latex-width / html-styling to it.
According to the post-processing section in
https://orgmode.org/manual/Results-of-Evaluation.html, it seems like something
like this should be possible, but I cannot get it to work. The :post header
argument only inserts the read Python "table" in-verbatim. Is there some way of
converting these arguments before passing them into the post-processing
function?
Additionally, is there some way of actually importing CSV files directly with
Elisp or org? I figured the org-table-import would do this, but that only
inserts into the org-mode buffer rather than creates a table.
Lastly, is there some way of breaking up the really long #+CALL: lines? Even
in this small example, the line quickly gets too long for comfort.


text:
Upgraded emacs and now there's extra whitespace around latex equations using org-latex-preview
This is inside a docstring in a python script, using org-preview-latex:

After rendering:

The whitespace goes away if I run convert -trim ltximg/org-ltximg_60b58ddb1d181ad22bd828dd88e5039cf2e80a89.png ltximg/org-ltximg_60b58ddb1d181ad22bd828dd88e5039cf2e80a89.png manually:

This problem did not happen before the system upgrade - it used to trim correctly. Any hints on how to go about debugging this?


text:
Parse elfeed's entry cl-struct
I'm trying to display notifications using elfeed's hook and alert. This works:
(add-hook 'elfeed-new-entry-hook
          (lambda (entry)
            (alert (prin1-to-string (elfeed-entry-content entry))
                   :severity 'high)))

But it only displays a "raw" cl-struct. I can't figure out how to parse it properly. This stops working:
(add-hook 'elfeed-new-entry-hook
          (lambda (entry)
            (alert (prin1-to-string (elfeed-deref (elfeed-entry-content entry)))
                   :title (prin1-to-string (elfeed-entry-feed-id entry))
                   :severity 'high)))


text:
How to define a new org-babel-execute function for a new major mode?
I want to be able to run code in org mode using the major mode defined in the nand2tetris package. How can I write an org-babel-execute function to do this?

It is explained here. I would recommend you to also look at ob-shell for example usage, and to use edebug for figuring out what is happening.


text:
flycheck thinks functions defined in a macro are not defined
i use a define-request macro to make it easier to define lots of requests to a REST API. each one returns a defun, the request function.
flycheck is unable to discover the existence of these functions. so whenever i use one in my code it complains that it is not known to be defined. this is the case even if i require the file containing the definitions.
it is possible to configure flycheck to catch such definitions, can it expand the resulting code of the macros somehow?
otherwise i have to manually add a declare-function call after every define-request.
I'm using flycheck 33snapshot, on emacs 29.1 on debian. checkers: emacs-lisp, emacs-lisp-checkdoc, and emacs-lisp-package.


text:
consult.el: annotation of abbrev symbols in completion buffer not working as expected
I have created a bunch of abbreviations for long account names in beancount-mode. The abbrevs are pretty volatile in my short term memory, so I thought of using consult--read to help display the available abbrevs and quickly select the desired one.
I am using consult and marginalia.
To create a command for inserting abbrev, I wrote the following function:
(defun insert-abbrev-partiallyworking (abbr)
  "Insert an abbreviation from the local abbrev table of the current buffer"
  (interactive
   (list (consult--read
      (mapcar #'symbol-name
          (abbrev--table-symbols
           'local-abbrev-table))
      :prompt "Abbrev: "
      :annotate (lambda (abbr) (concat "\t\t\t" (abbrev-expansion abbr) "  EOS")))))
  (insert abbr))

That does not work. What shows up is this:

So after some hacking, I came up with the following tweak by capturing the local-abbrev-table and providing it to abbrev-expansion:
(defun my/insert-abbrev (abbr)
  "Insert an abbreviation from the local abbrev table of the current buffer"
  (interactive
   (let ((tbl local-abbrev-table))
     (list (consult--read
        (mapcar #'symbol-name
            (abbrev--table-symbols
             'tbl))
        :prompt "Abbrev: "
        :annotate (lambda (abbr) (concat "\t\t\t" (abbrev-expansion abbr tbl)))))))
  (insert abbr))

And then the completion buffer shows the expansion as annotation:

I would like to understand why the first one deos not work while the second one does


text:
perl-mode brace indentation
How can I get perl-mode to indent:
func({
    foo => 'bar',
     });

as
func({
    foo => 'bar',
});

without switching to cperl-mode?


text:
Question on modifying Helm's search (helm-ag or similar tools)
I'd like to do the following when I search
- find symbol in a project
- add restrictions (options)
  - to narrow to files that matches a pattern (--include)
  - to narrow to files that doesn't match a pattern (--exclude)
  - to change the base directory (it can be project root or any directory that a user wants)

I've used helm-grep and helm-ag
They allow those changes, but mostly I need to restart the search so that helm can prompt me for those options.
For example, if I start out with project-root, and I decide to narrow the search to a directory, I need to start over the search from the start and specify the directory I want to search.
I suspect the dynamic search options that I describe can be done.
Because it seems to be similar to the ability to go from helm-swoop to helm-multiswoop.
Difference is that I want to go back and forth and need to keep more states (such as include files, exclude files and such)
My guess is that, you can store a context (eg include files, search query, root directory for search) then issue an updated command with the stored context.
Since it seems to take me a while to figure out that it's indeed doable, I thought I would ask first if this is indeed doable.
Especially, I'm not sure how context should be implemented in elisp. (elisp has notion of buffer-local and such, and I am not quite familiar with the concepts)
I guess my work would be easier if I can figure out how helm's session(?) can be stored.
Of course this will be easy if helm-ag or helm-grep implementation supports this type of operation.
But even if they don't, helm itself might support it.
I wanted to ask this is doable by helm itself.


text:
Enable citation in doom emacs org-mode
I am unable to make citations work in my doom emacs installation, from the manual it is not clear which changes I need to add to the config.
What I want:
#+bibliography: notebook.bib
This is text with citation [cite:@Knuth:1984]

* References

#+print_bibliography:

To generate a bibliography
The citation never gets identified when I export to html. The only change I have on doom emacs is the addition of:
       (org +pretty +present +beamer +dragndrop +lsp +org-cite)               ; organize your plain life in plain text

and
(package! org-ref)

How to enable citations on org-mode doom emacs?


text:
List Adaptive Fill Keeps Growing for Lists in Olivetti Mode
I'm having trouble with my org lists. They seem to have an ever increasing amount of adaptive-fill as I nest them deeper and deeper.
A picture of the problem is below. These are all single lines in the source file, so this is something going on with org-indent I would think?

I'm glad to post whatever config seems relevant, though I've tweaked almost everything that seemed relevant to no use.
Any hunches as to what variables I could tweak (if any) to fix it?
All ideas would be very much appreciated!

Does it happen with emacs -q? If not, then bisect your init file. See https://emacs.stackexchange.com/questions/28429/how-do-i-troubleshoot-emacs-problems


text:
How to SHIFT-RET to open link in a new tab while preserving RET behavior in org-mode?
In org-mode
I want to open link in a new tab when I press Shift-RET.
I'm currently using RET to open link.
I tried to use (setf (cdr (assoc 'file org-link-frame-setup)) 'find-file-other-tab).
That makes file to open in a new link. But It removes original RET behavior which opens in current tab.
I use emacs 29.1 and tab is built-in tab-bar-mode and evil mode.


text:
Getting diary-mail-entries to work with mu4e in a script
I'm trying to start using the Emacs diary to remind me of birthdays and such using emails, but I've configured mu4e as my mail client, so I wrote an Emacs script using (diary-mail-entries) that I want to execute using cron that should automatically send reminder mails using mu4e. If I execute (diary-mail-entries) manually while Emacs is running, it works if mu4e is already started up, but if it is not already running it starts up, updates the mail and does nothing further. Similarly, when the script arrives at (diary-mail-entries), it creates the list of dates, then starts up mu4e, then mu4e updates its mail database and outputs the mails it found, but then it doesn't do anything further. I tried putting another instance of (diary-mail-entries) under the first, but the script stops at the first entry and never gets to the second. I thought about whether I could configure a timed kill command for the process, but I suspect that this would end the mu4e and the next instance would have to start it anew. I also tried using (mu4e t) so mu4e starts in the background, but it still gets stuck. So is there some way I can start mu4e, then have the process continue running in the background while the script moves on, or get (diary-mail-entries) to start mu4e and send a mail in one?


text:
how do i customize font faces and sizes in neotree buffer
I am trying to find a good folder view package to work alongside projectile and magit, I tried treemacs for a while and did not find it to my liking,  I am now trying neotree.  Neotree seems to be good enough for me.  My only peeve is that i cant seem to find any documentation on how fonts can be customized in the tree view.
To begin with, it loaded with icons as i opened it up in graphical mode, i did not like that, i preferred a minimalistic look and went for a simple arrow theme which works for me.  i want to be able to do just two more things before i can finally say i have found the package that works for me

need to be able to make the font more compact so that i can fit more content as i will be working with multiple projects with nested folders.  I want to be able to use a font size on the tree thats considerably smaller than the editor font
need to be able to switch to a proportional as i feel that will be more compact and better suited for a file listing.

Anything that you can point me to would be great.  I am ok to mess around with elisp code in configuration.

This question is all over the place. Please post a specific question. This could be such a question: "How can I find documentation on how fonts can be customized in the tree view?" (once you've specified what you mean by "the tree view").


text:
How/Where do I put tags/keywords so that citar will find them?
I started using citar to manage my references.
Set up bibtex-library, folder for pdf's as well as notes.
Everything seems to work fine.
In the documentation of citar is says that the UI will show tags/keyswords if there are any for this entry and also the template for the display includes them as:
 (suffix . "          ${=key= id:15}    ${=type=:12}    ${tags keywords:*}")
I tried to put a key in the org-notes file, as well as in the bibtex entries but no matter where I put them, they dont seeem to show up.
Can somebody tell me the right way to add tags?

Adding them to the bibtex file as keywords={...} works but having the tags in the notes file would be nicer.


text:
Use an org-mode code block to execute other code blocks
I want to use a code block to execute other code blocks with a given language. For example, in my document I want to validate every HTML block using the W3 validator. Currently I do it as follows.
First a code block to validate.
#+name: mininal-html-5
#+begin_src html
<!DOCTYPE html>

<title>Minimal HTML 5</title>

Is it valid at all?

#+end_src

Next a shell script that validates, getting it's input as a variable. Here together with the result
#+name: validate
#+begin_src shell :results output code :wrap src json :var content=mininal-html-5[]
http --form --multipart --ignore-stdin POST https://validator.w3.org/nu/ out='json' content=${content} | jq
#+end_src

#+RESULTS: validate
#+begin_src json
{
  "messages": [
    {
      "type": "info",
      "lastLine": 3,
      "firstLine": 1,
      "lastColumn": 7,
      "firstColumn": 16,
      "subType": "warning",
      "message": "Consider adding a “lang” attribute to the “html” start tag to declare the language of this document.",
      "extract": "TYPE html>\n\n<title>Hello?",
      "hiliteStart": 10,
      "hiliteLength": 9
    }
  ],
  "source": {
    "type": "text/html",
    "encoding": "utf-8",
    "code": "<!DOCTYPE html>\n\n<title>Hello?</title>\n\n
Is it valid at all?
"
  }
}
#+end_src

The I can reuse it to validate another HTML block:
#+name: html-with-root
#+begin_src html
<!DOCTYPE html>

  <title>Rooted HTML 5</title>

Is it more valid?

#+end_src

#+call: validate(content=html-with-root[])

#+RESULTS:
#+begin_src json
{
  "messages": [],
  "source": {
    "type": "text/html",
    "encoding": "utf-8",
    "code": "<!DOCTYPE html>\n\n  <title>Rooted HTML 5</title>\n\n
Is it more valid?
\n"
  }
}
#+end_src

It's quite good, but every time I need to give each block a unique name and then call the validator, referring to that name with square brackets. What I would really like, is to just evaluate the HTML code block and get the validation as a result. I think the way is to do something like:
(defun org-babel-execute:html (body params)
  "Validate given HTML using W3C Validator"
  (some-magic-function validate body))

The closest to "some-magic-function" I found so far is the org-sbe macro, but it's designed for table formulas, and in any case I couldn't get it to work.


text:
How can I enable shell-command in Termux build of Emacs?
Installation of emacs on termux (from f-droid) does not support shell-command. Does this require a port of shell access code to termux, or is it some sort of option that I would be able to activate?

I have Emacs28.1 in f-droid termux and M-x shell-command is running just fine.


text:
don't show images in html or local links in pdf-latex
I want to transfer folders with documents with Syncthing to the Android tablet, the documentation is made in orgmode and I export to PDF or HTML. But they don't resolve local addresses in the tablet; neither the images in html nor the links in PDF.
I use relative paths. external links like www works and all works in the desktop.
Some type of links i try

[[file:./Imagenes/Fuentes-Aduanero.jpeg]]
[file:./imagen.png]
file:./Imagenes/Fuentes-Aduanero.jpg

some idea?


text:
How to set a buffer local variable (e.g. fill-column) for one specific .org file?
I use fill-column 80 for the majority of my files. Howover, I have a .org with a table that is slightly wider than 80 columns. I'd like to automatically set (setq fill-column 100) for that file only, without manually call it everytime I open the said file. Is it possible?


text:
Gnus: show original article when replying
When I hit r (or f/F/R) in a gnus summary, I get a fullscreen view of the unsent Message. Is there some builtin way to put the new Message buffer in the window that had the Summary buffer, so I can look at the Article while replying?


text:
smartparens, to match only parens
In my Emacs, smartparens tries to match square bracket with parenthesis,
indicating a mismatch, as in the following expression:
 (modify-syntax-entry ?[ ". 23" table)
                       ^             ^

That's quite confusing. How to configure it to strictly match only parenthesis together?


text:
How can I continuously check semantic error with rust-analyser instead of upon saving only?
I'm using eglot with flymake and rust-analyzer.
However, it seems to only check errors when I save the file:

d() is a non-existing function. It doesn't show any error, until I save the file:

Ideally it should continuously checks errors and report them in as soon as possible. Is there a way to configure it this way?
I've set my flymake-no-change-timeout:
(setq flymake-no-changes-timeout 0.2)

But it doesn't make a difference.
It does shows errors correctly upon saving, so I assume eglot is connected to the language server.


text:
OSX: shaking the mouse during compiler output makes it go faster. Why?
I frequently run a Maven job in compilation mode. Maven is very verbose and spews all sorts of stuff to the screen. The build as you might imagine runs for a while.
Randomly, while bored and waiting for this job to complete, I happened to notice that if I shake the mouse over the (focused) window the speed with which the output is written increases significantly.  What could be the reason for this? (I'm prepared for something awful.)
Emacs 28.1 aarch64-apple-darwin21.1.0; OSX 13.5.1

I'll hazard a total guess that maybe it's to do with testing for pending user inputs and finding something immediately rather than waiting a moment to see if anything turns up?


text:
install pdf-tools without sudo
I have installed (a working version of (doom)) Emacs on a remote linux cluster (via conda) for which I do not have sudo access, my question is:
how can I install pdf-tools?
Thanks
Assume I can install the backend poppler (I think I can). Do I need to install other supporting programs as well?

Did you follow these installation instructions?


text:
emacs jupyter gives *invalid read syntax* error in org mode
am trying to execute a simple code block in org mode
* a simple trial
#+begin_src jupyter :session py :async no
x = 'foo'
y = 'xbar'
x + ' ' + y
#+end_src

I get the following error
Code block evaluation complete.
executing Jupyter code block...
error in process sentinel: async-when-done: Invalid read syntax: "#", 17, 1304
error in process sentinel: Invalid read syntax: "#", 17, 1304

Changing jupyter to python and the block evaluates correctly. I have already run jupyter-connect-repl as well.
If it's any help, the emacs buffer shows this possible error:
(fn EVENT)"] (error) nil jupyter-ioloop-stop signal] 6] #[0 "..." [(#s(jupyter-session (:shell_port 47853 :iopub_port 55985 :stdin_port 54941 :control_port 33237 :hb_port 39821 :ip "127.0.0.1" :key "044944fa-4923-48c5-9a39-274d9524ed4b" :transport "tcp" :signature_scheme "hmac-sha256" :kernel_name "python3") "a8558df6-3bbd-4897-a7e1-7a3a945177b0" "044944fa-4923-48c5-9a39-274d9524ed4b")) #s(jupyter-kernel-process #s(jupyter-kernelspec "python3" (:argv ["python" "-m" "ipykernel_launcher" "-f" "{connection_file}"] :env nil :display_name "Python 3 (ipykernel)" :language "python" :interrupt_mode "signal" :metadata (:debugger t)) "/home/roy/.virtualenvs/karpathy/share/jupyter/kernels/python3") #s(jupyter-session (:shell_port 47853 :iopub_port 55985 :stdin_port 54941 :control_port 33237 :hb_port 39821 :ip "127.0.0.1" :key "044944fa-4923-48c5-9a39-274d9524ed4b" :transport "tcp" :signature_scheme "hmac-sha256" :kernel_name "python3") "a8558df6-3bbd-4897-a7e1-7a3a945177b0" "044944fa-4923-48c5-9a39-274d9524ed4b") nil) cl-struct-jupyter-kernel-tags type-of signal wrong-type-argument jupyter-kernel 2 error "A session is needed to connect to a kernel's I/O"] 5] ((:shell (:endpoint "tcp://127.0.0.1:47853" :alive-p t) :iopub (:endpoint "tcp://127.0.0.1:55985" :alive-p t) :stdin (:endpoint "tcp://127.0.0.1:54941" :alive-p t))) (:shell :iopub :stdin) jupyter-session-endpoints nil :endpoint plist-get :alive-p] 9] (nil) #s(jupyter-kernel-process #s(jupyter-kernelspec "python3" (:argv ["python" "-m" "ipykernel_launcher" "-f" "{connection_file}"] :env nil :display_name "Python 3 (ipykernel)" :language "python" :interrupt_mode "signal" :metadata (:debugger t)) "/home/roy/.virtualenvs/karpathy/share/jupyter/kernels/python3") #s(jupyter-session (:shell_port 47853 :iopub_port 55985 :stdin_port 54941 :control_port 33237 :hb_port 39821 :ip "127.0.0.1" :key "044944fa-4923-48c5-9a39-274d9524ed4b" :transport "tcp" :signature_scheme "hmac-sha256" :kernel_name "python3") "a8558df6-3bbd-4897-a7e1-7a3a945177b0" "044944fa-4923-48c5-9a39-274d9524ed4b") nil) #s(hash-table size 3 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (interrupt 6 shutdown 10 restart 21)) jupyter-interrupt jupyter-shutdown t nil jupyter-restart action] 7 "


text:
How do I trim spaces and indentations after traversing a DOM tree?
The following traverse the dom tree and provide an iterative custom formatting. However during the formatting, there are empty spaces and indentations which I needed to trim.
;;; This is where the formatting takes place.
(defun org-tag (x depth)
  (let* ((node (dom-node x)) (stars (make-string depth ?*)))
    (pcase (dom-tag node)
      ((and (pred stringp) str) str)
      ('comment '())
      (tag (format "%s %s %s {%s} \n"
                   stars
                   tag
                   (pcase (assq-delete-all 'data-field
                                           (dom-attributes node))
                     ('() "")
                     (attributes
                      (concat "("
                              (mapconcat #'format-attribute attributes
                                         ", ")
                              ")")))
                   ;; (mapconcat #'test-tag (dom-children node) "")
                   (mapconcat (lambda (child)
                               (org-tag child (1+ depth)))
                    (dom-children node)
                    ""))))))

(defun macro-orgify (tag-entries)
  "returns the formatted dom tree"
  (with-temp-buffer
    (insert tag-entries)
    (let* ((mytags (libxml-parse-html-region (point-min) (point-max))))
      (org-tag (car (dom-by-tag mytags 'body))))))

(defun format-attribute (attribute)
  "Format a single attribute."
  (format "%s=\"%s\"" (car attribute) (cdr attribute)))

;;; a test
(let ((myskel "

        <title>Demo: Gradient Slide</title>

    <link href=\"https://fonts.googleapis.com/css?family=Nunito+Sans\" rel=\"stylesheet\">
    <link rel=\"stylesheet\" href=\"dist/build.css\">

Skeleton Screen

Skeleton Screen

 Sample Text
Welcome to this page

Text

"))
  (macro-orgify myskel))

After parsing, I have the following results
"* body  {
        ** header (data-table=\"testtable\") {*** h1  {Skeleton Screen}

            *** h1  {Skeleton Screen}

        }
** div (class=\"wrap\") { Sample Text *** p (class=\"format\", data-attribute=\"somethingsomething\") {Welcome to this page}

            *** div (class=\"flex-grid generic-card\") {

                **** div (class=\"card loading\") {Text }

               **** div (class=\"card loading\") {}

            }

        }

    }
"

How do i trim the spaces and indentations?

Trim the string returned in the first (p)case as follows (string-trim-right str " *"). (And don't forget to pass 2 args to org-tag ;)


text:
resize font in ivy-posframe
i'm tryinng to set the font in ivy-posframe and no result. i have try code adapt to another cases, like:
(defun text-scale-twice ()(interactive)(progn(text-scale-adjust 0)(text-scale-decrease 2)))
(add-hook 'neo-after-create-hook (lambda (_)(call-interactively 'text-scale-twice)))

or
(add-hook 'minibuffer-setup-hook 'my-minibuffer-setup)
(defun my-minibuffer-setup ()
       (set (make-local-variable 'face-remapping-alist)
          '((default :height 0.8))))

in the last resizing the minibuffer is not enough,
any idea?


text:
How can I manage my passwords in org-mode?
I've found two projects which deals with managing passwords in org-mode, but they seem abandoned.
I'm also using UNIX PASS with Emacs, but I want rather to manage my passwords in org-mode and then sync one way to UNIX PASS regularly;)
Something like this exists?;)


text:
display documentation and available methods for java
Is there a way to configure emacs so that it displays available methods and documentation when typing "." on an object. Something similar to company-racer for rust as described In this post
My java config used to work, but it broke recently. I have not been able to make it work.
The code for it is as follows
;;; package --- Summary
;;; Commentary:
;;; simple utilities and configuration for java mode.
;;; Code:
(add-to-list 'auto-mode-alist '("\\.java\\'" . java-mode-utils) 'APPEND )

(require 'subr-x)
(require 'java-imports)

(add-hook 'java-mode-hook
                    (lambda ()
            (define-key java-mode-map (kbd "C-c l") 'java-doc-string-field)
            (define-key java-mode-map (kbd "C-c y") 'java-imports-add-import-dwim)
            ))

(add-hook 'java-mode-hook #'lsp)

(use-package projectile)
(use-package flycheck)
(use-package yasnippet :config (yas-global-mode))
(use-package lsp-mode :hook ((lsp-mode-deferred . lsp-enable-which-key-integration)))
(use-package hydra)
(use-package company)
(company-mode 1)

(use-package lsp-java
  :config
  (add-hook 'java-mode-hook 'lsp)
  (setq projectile-indexing-method 'hybrid)
  (setq projectile-globally-ignored-directories
        (append '("build" ".idea" ".gradle" "target") projectile-globally-ignored-directories))
  (setq projectile-completion-system 'ivy))

(use-package dap-mode :after lsp-mode :config (dap-auto-configure-mode))
(use-package lsp-treemacs)

(use-package meghanada
  :init
  (add-hook 'java-mode-hook
            (lambda ()
              (meghanada-mode t)
              (setq-local company-backends '((company-capf :with company-yasnippet))))))

;; See customization below for where to put java imports
(setq java-imports-find-block-function 'java-imports-find-place-sorted-block)

(message "Java Mode Utils is loaded")
(provide 'java-mode-utils)
;;; java-mode-utils.el ends here


text:
Emacs Evil: Invalid function: evil-ensure-column
I am using evil in Emacs, and I get an error when I use the motions G or gg: Invalid function: evil-ensure-column. My Emacs version is 29.1, and the evil version is 20230919.2206. The motion G calls evil-goto-line:
(evil-define-motion evil-goto-line (count)
  "Go to line COUNT. By default the last line."
  :jump t
  :type line
  (evil-ensure-column
    (if (null count)
        (goto-char (point-max))
      (goto-char (point-min))
      (forward-line (1- count)))))

The function that Emacs is complaining about is evil-ensure-column:
(defmacro evil-ensure-column (&rest body)
  "Execute BODY so that column after execution is correct.
If `evil-start-of-line' is nil, treat BODY as if it were a `next-line' command.
This mostly copies the approach of Emacs' `line-move-1', but is modified
so it is more compatible with Evil's notion of EOL tracking."
  (declare (indent defun) (debug t))
  `(progn
     (unless evil-start-of-line
       (setq this-command 'next-line
             temporary-goal-column
             (cond ((memq last-command '(next-line previous-line))
                    temporary-goal-column)
                   ((and track-eol (eolp) (not (bolp))) most-positive-fixnum)
                   (t (current-column)))))
     ,@body
     (if evil-start-of-line
         (evil-first-non-blank)
       (line-move-to-column
        (or goal-column
            (if (consp temporary-goal-column)
                ;; Guard against a negative value as `temporary-goal-column'
                ;; may have a negative component when both `whitespace-mode'
                ;; and `display-line-numbers-mode' are enabled (#1297).
                (max 0 (+ (truncate (car temporary-goal-column))
                          (cdr temporary-goal-column)))
              temporary-goal-column))))))

Running (evil-goto-line) gives the trace:
Debugger entered--Lisp error: (invalid-function evil-ensure-column)
  evil-ensure-column(202876)
  evil-goto-line()
  eval((evil-goto-line) t)
  eval-expression((evil-goto-line) nil nil 127)
  funcall-interactively(eval-expression (evil-goto-line) nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression

What could be causing this error? I have another system with almost the exact same setup and the keybinds are working fine there.

Do not post functions content; instead, more helpful, show your configuration. Do you set some variables before calling evil package?


text:
Inline title with beamer block environment
I'd like to create a block environment that has the title bolded and in with a background color but also in line with the body text.
For my uses having a separate title section wastes too much space.
Is this possible?

Are you talking about beamer export through Org mode? If so, say so and tag the question with org-export. If not, what does the question have to do with Emacs? In an case, providing an input file and specifying what you do to produce the output you get and then pointing out what in that output you would like changed, would go a long way towards making your question more attractive to potential helpers..


text:
Select font for buffer via [Gtk] GUI font selection tool
From the menu-bar selecting:  Option -> Set Default Font...
pops up a (Gtk?) font selection tool:

Is there a nice way to select font for the current (or specific) buffer
without configuration saving, via similar tool ?


text:
How can I get a complete backtrace?
I've gotten some code that was supposed to give me a complete backtrace
(setq debug-ignored-errors (remove 'args-out-of-range debug-ignored-errors))

, but I still see it shortened with three dots
Debugger entered--Lisp error: (error "The connected server(s) does not support method te...")
  error("The connected server(s) does not support method %s..." "textDocument/references")

Does this answer your question? What is the meaning of the ellipsis at the end of some output?


text:
How to exclude emacs from updating in addition to pacman.conf
I'm ignoring emacs in /etc/pacman.conf and emacs --version indeed reports the same version (28.2) after system update. Yet I get a rather unpopular error Error in spacemacs/user-config: void-function defvar-1.
What else must I do in order to isolate emacs from upates?
Alas I'm unable to properly init debug


text:
How to interact with fzf on remote machine with tramp mode
Suppose, we work on a remote server with project files. The project files are located in directory:
/ssh:server:/home/user/onetouch/lib

I created the following bash script:
#!/bin/bash

find /home/user/onetouch/lib -type f \                    # search files in project directory
      -name '*.pm' ! -name '*~' \                         # only .pm files, no backup
      -not -path ".git/*" \                               # no .git directory
      -not -path "*/Modules/*" -not -path "*/Base/*" \    # no /Modules and /Base --- these are submodules
      | fzf                                               # we don't need them

How can I interact with remote fzf in Emacs, so I could quickly open the files?
I checked fzf-mode and counsel-fzf, but couldn't make them work via tramp?

Did you try using fzf from within Emacs with bling/fzf.el (from GitHub)?   I'm not sure if it works within tramp but it might.


text:
How can emacs preview java jmod file like jar file from dired?
They are both zip file actually. I can preview jar file directly from dired, but not for jmod files.
I tried

adding jmod to dired-compress-file-suffixes, not working.

(add-to-list 'dired-compress-file-suffixes '("\\.jmod\\'" "" "unzip -o -d %o %i"))

by the way, jar is not in dired-compress-file-suffixes too.

tried jka-compr-compression-info-list, got error message File mode specification error: (error Buffer format not recognized)

(add-to-list 'auto-mode-alist '("\\.jmod\\'" . archive-mode))
(add-to-list 'jka-compr-compression-info-list
             ["\\.jmod\\'"
              nil
              nil
              nil
              nil
              "unzip"
              ("-q" "-c")
              nil
              nil
              "JM"
              ])

Also asked at SO.


text:
How to change SIGTERM behavior?
I run emacs in konsole terminals in KDE. If I accidentally alt-F4 such a window, it dies with emacs and I lose unsaved data.
I believe it is emacs responding to A SIGTERM sent by the Alt-F4, as opposed to konsole.
Is there any way to change how emacs responds to a SIGTERM?


text:
How to Filter and Copy Org Mode Entries Matching a Specific Expression in Emacs?
I am trying to efficiently filter and copy entries with specific headings in an Org mode file using Emacs. I want to extract all entries whose headings match a particular regular expression. However, I am relatively new to Emacs and Org mode, and I am not sure about the most effective way to achieve this.
I have attempted to use the org-match-sparse-tree command, but I'm unsure how to copy the filtered entries after this step. Are there any built-in functions or packages that can facilitate this process? Can someone provide a step-by-step guide or a code snippet to accomplish this task? I would greatly appreciate any insights or recommendations on how to effectively filter and copy Org mode entries matching a specified expression in Emacs.
Thank you in advance for any assistance or guidance!

Copy them where? To a list in memory? To another file? I guess what's missing is: what are you planning to do with the filtered entries after you have got them?


text:
Parsing output of org-element-parse-buffer replaces each node's :parent value with modified copy of parent node
As the title says, parsing the output of org-element-parse-buffer replaces each node's :parent value with modified copy of parent node.
Steps to Reproduce
Here is my Org file:
* Milk - 2% :food:
:PROPERTIES:
:QUANTITY_CACHE: 1
:END:
* Milk - 1% :food:
* Chicken :food:
* Broccoli :food:

When I run (org-element-parse-buffer 'headline) on this file (in Org Mode, I get a reasonable AST result (comments added after):
(org-data
 (:standard-properties
  [1 1 1 75 75 0 nil org-data headline nil nil 3 75 nil #<buffer Foods.org> nil nil nil]
  :path "/file/path/Foods.org" :CATEGORY "Foods")
;; Headline 1: Milk - 2%
 (headline
  (;; Headline 1 standard properties
   :standard-properties
   [1 1 20 58 58 0 (:title) first-section headline nil nil nil nil 1 #<buffer Foods.org> nil nil #0] ;; NOTE: #0
   ;; Headline 1 properties
   :pre-blank 0 :raw-value "Milk - 2%" :title "Milk - 2%" :level 1 :priority nil :tags ("food")
   :todo-keyword nil :todo-type nil :footnote-section-p nil :archivedp nil :commentedp nil :QUANTITY_CACHE "1"))
;; Headline 1: Chicken
 (headline
  (;; Headline 2 standard properties
   :standard-properties
   [58 58 nil nil 75 0 (:title) nil headline nil nil nil nil 1 #<buffer Foods.org> nil nil #0] ;; NOTE: #0
   ;; Headline 2 properties
   :pre-blank 0 :raw-value "Chicken" :title "Chicken" :level 1 :priority nil :tags ("food")
   :todo-keyword nil :todo-type nil :footnote-section-p nil :archivedp nil :commentedp nil)))

Goal: I eventually would like to extract, for a given (unique) title, the (headline ...) with that title. At the moment, I am trying to get the headline nodes into their own list so I can loop through them and search each title.
Parsing output: I figured I could just do (cddr (org-element-parse-buffer 'headline) to get a list of the headline nodes (i.e. pop the org-data and (:standard-properties [...] :path "..." :CATEGORY "...") nodes).
However, when I eval (cddr (org-element-parse-buffer 'headline), I get the following:
((headline
  ;; Standard properties of Headline 1
  (:standard-properties
   [ 1 1 20 58 58 0 (:title) first-section headline nil nil nil nil 1 #<buffer Foods.org> nil nil
       ;; NOTE: #0 replaced by the following list:
       (org-data
        (:standard-properties ;; NOTE: Standard properties of org-data (i.e. parent node)
         [1 1 1 75 75 0 nil org-data headline nil nil 3 75 nil #<buffer Foods.org> nil nil nil]
         :path "/file/path/Foods.org" :CATEGORY "Foods")
        #1
        (headline
         (:standard-properties ;; NOTE: Standard properties of Headline 2
          [58 58 nil nil 75 0 (:title) nil headline nil nil nil nil 1 #<buffer Foods.org> nil nil #4]
          :pre-blank 0 :raw-value "Chicken" :title "Chicken" :level 1 :priority nil :tags ("food")
          :todo-keyword nil :todo-type nil :footnote-section-p nil :archivedp nil :commentedp nil)))
   ]
   ;; Properties of Headline 1
   :pre-blank 0 :raw-value "Milk - 2%" :title "Milk - 2%" :level 1 :priority nil :tags ("food")
   :todo-keyword nil :todo-type nil :footnote-section-p nil :archivedp nil :commentedp nil :QUANTITY_CACHE "1"))
 (headline
  ;; Standard properties of Headline 2
  (:standard-properties
   [58 58 nil nil 75 0 (:title) nil headline nil nil nil nil 1 #<buffer Foods.org> nil nil
       ;; NOTE: #0 replaced by the following list:
       (org-data
        (:standard-properties ;; NOTE: Standard properties of org-data (i.e. parent node)
         [1 1 1 75 75 0 nil org-data headline nil nil 3 75 nil #<buffer Foods.org> nil nil nil]
         :path "/home/user/nextcloud-sync.bak/projects/degOrge/Foods.org" :CATEGORY "Foods")
        (headline
         (:standard-properties ;; NOTE: Standard properties of Headline 1
          [1 1 20 58 58 0 (:title) first-section headline nil nil nil nil 1 #<buffer Foods.org> nil nil #4]
          :pre-blank 0 :raw-value "Milk - 2%" :title "Milk - 2%" :level 1 :priority nil :tags ("food")
          :todo-keyword nil :todo-type nil :footnote-section-p nil :archivedp nil :commentedp nil :QUANTITY_CACHE "1"))
        #1)
   ]
   ;; Properties of Headline 2
   :pre-blank 0 :raw-value "Chicken" :title "Chicken" :level 1 :priority nil :tags ("food")
   :todo-keyword nil :todo-type nil :footnote-section-p nil :archivedp nil :commentedp nil)))

The "Replacement" Problem
As indicated by the comments, running (cddr ...) seems to have resulted in a replacement the #0 value of the :parent property of :standard-properties by the org-data node, i.e. the parent node, i.e. the entire AST. In the inserted copy of the AST, however, the node of the current headline is replaced by #1.
Obviously, cddr is not causing this replacement. So what is causing this replacement?
Org Version 9.7 has new AST parser?
Running the command in emacs -Q results in an expected AST, though its structure is different; running cddr on that AST results in the expected output. Indeed, emacs -Q uses Org version 9.6.6, while my private Org version is 9.7 (9.7-??-e90a8a69a @ /home/user/.emacs.d/.local/straight/build-29.1/org/) (Doom Emacs).
Checking the Org Mode News at https://elpa.gnu.org/devel/org.html reveals that

**** Internal structure of Org parse tree has been changed
The code relying upon the previously used =(TYPE PROPERTIES-PLIST CONTENTS-LIST)=
structure may no longer work.  Please use ~org-element-create~,
~org-element-property~, and other Org element API functions to work
with Org syntax trees.
Some syntax node properties are no longer stored as property list elements.
Instead, they are kept in a special vector value of a new
=:standard-properties= property.  This is done to improve performance.
If there is a need to traverse all the node properties, a new API
function ~org-element-properties-map~ can be used.

Logical question: how could a change to the AST structure cause the replacement problem described above? Shouldn't the output of (org-element-parse-buffer) be static data? Shouldn't cddr operate on it without causing some changing in the underlying data structure?
The Org Mode News snippet quoted above states that "code relying upon the previously used =(TYPE PROPERTIES-PLIST CONTENTS-LIST)= structure may no longer work". However, I'm not aware that org-element-parse-buffer in any way depends on this structure. Also, there is no new parser, e.g. org-element-parse-buffer-with-standard-properties, included in the Org Mode 9.7 version of org-element-ast.el.

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


text:
Header arguments for emacs-jupyter
The following example uses emacs-jupyter. I'm happy with the result (i.e. display inside emacs, and export to LaTeX), but I'm unhappy that the second and the third code block use different header arguments.
The second code block (a math equation) results in 1) a png, if displayed inside emacs, and 2) LaTeX code, if exported to LaTeX, which is great. Unfortunately these header arguments do not work for the third code block (a simple plot). Hence I use different header arguments for the third code block, as you can see below.
It feels cumbersome to use different header arguments depending on whether the result of the code block is a math equation or a plot. Is it possible to rewrite the header arguments such that they can be used for both the second and the third code block?
#+begin_src jupyter-python :results none :exports none
import sympy as sp
sp.init_printing(latex_mode='equation*')
x = sp.Symbol('x')
#+end_src

#+begin_src jupyter-python :results value :exports both :display (if (eq org-export-current-backend 'latex) "text/latex" "image/png")
sp.Integral(x**2, x)
#+end_src

#+begin_src jupyter-python :results output :exports both :display image/png
sp.plot(x**2)
#+end_src


text:
why is "org-highlight-latex-and-related" messing with org-hyperlink description?
Basically, to highlight latex equation I need to include native in org-highlight-latex-and-related.
But that messes up links with _ ([[file:asdfk_jkfke_erj224jk.txt][a link]] for the example below).
(Perhaps emacs mistakes the links as a latex related stuff.)
Question:

how to highlight equations without messing with links?
Is this a bug? or Am I doing something wrong.

To reproduce you can use following org file.
The image above is the screen of emacs -Q of file below (my version is 29.1)
* Latex equations, and links
\begin{equation}
    A := \int \frac{1}{x ( \log x ) ^2} dx
\end{equation}

[[file:asdfk_jkfke_erj224jk.txt][a link]]

\[
\alpha+ \beta
\]

* Hightlight Configuration
** without ~native~
#+begin_src emacs-lisp :results none
(setq org-highlight-latex-and-related     '(latex script entities ))
(org-mode-restart)
#+end_src

** with ~native~ conflicts link
#+begin_src emacs-lisp :results none
(setq org-highlight-latex-and-related     '(latex script entities native))
(org-mode-restart)
#+end_src


text:
define a special org-link face inside of org-table, different from outside?
I'd like to define a special org-link face inside of org tables, such as to set link to fixed fonts within a table, and to variable fonts outside. I tried to play with custom-theme-set-faces in various ways without any success.
I've the feeling the answer should define somehow a conditional rule checking whether or not a face (here a link) is within a table or outside. But this is maybe incompatible with the way custom-theme-set-faces works?
Also, I'd like to not rely on another package such as valign (nothing against it, it's just that my wish is to get something simple).
I found a couple of older related posts on emacs.stackexchange but none seem to provide a definitive answer, or maybe I missed them.
Any clues on this matter would help. Thank you.


text:
Vertico command similar to ido-fallback-command

In there a vertico command command that causes vertico-find-file
(not sure of the name, I mean the behavior of file finding during vertico's take over of find-file)
to drop back to the normal emacs find-file command?
This question was asked about ido here ido fallback

Is there a vertico command that keep vertigo completion active, but lets the user paste in a path, then vertico begins file name completion using new path?


text:
How to invoke ivy-immediate-done in emacs prelude
I recently installed the prelude distribution of emacs, with minimal customizations. I want to invoke ivy-immediate-done

C-M-j (ivy-immediate-done) - exit with the current action, calling it on the current input instead of the current candidate. This is useful especially when creating new files or directories - often the input will match an existing file, which you don’t want to select.

but in my config C-M-j is set to default-indent-new-line

C-M-j runs the command default-indent-new-line (found in global-map),
which is an interactive compiled Lisp function in ‘simple.el’.

So far I've tried running
(define-key minibuffer-local-map [ivy-immediate-done] "C-M-j")

to rebind C-M-j in the minibuffer. That didn't work.


text:
How to save a new buffer to a new file with helm?
(It's likely a dumb question as I'm new to emacs buffer saving commands.)
After creating and editing a new buffer (with a temp name "untitled"), I would like to save it to a new file (not overwriting existing file) by a single command.
I tried to call save-buffer and write-file, both triggered helm-mode-basic-save-buffer (as i installed helm). But after typing the new file name, it returned Lisp error: (cl-assertion-failed (sel "Trying to exit with no candidates"))
I found that I can do it using 2 commands (rename-buffer and then write-file), but is there an easier way to do it by just a single command?
Thanks.


text:
Fully case insensitive org property search
I would like to be able to perform fully case insensitive searches of properties and their values in my org files, and have the results presented in a sparse tree.
For example, if I have sections where the property name is FOO and the property value is bar, I would like to be able to produce a sparse tree consisting of all sections having a property named foo (case insensitive) and the value is bar (again, regardless of case).
I have tried org-sparse-tree m and doing a search like my_prop="my_val". This seems to work for the property name (which can be MY_PROP or my_prop in the results) but searching for my_val will not return sections where the value is MY_VAL.
I have also tried org-ql-sparse-tree using property:MY_PROP,my_val but this only returns results where the property name and value match case-wise.


text:
Are alphabetic cell references in org-table spreadsheet valid?
I have this formula in one of my org-tables:
#+TBLFM: A&='(concat "(vhtd/filegroups-init-group" " " (rc-dq C&) " " (rc-dq B&) " " (rc-dq D&) ")")
and for some reason it doesn't work, but it seemed to work in the past.
After converting it to
#+TBLFM: $1='(concat "(vhtd/filegroups-init-group" " " (rc-dq $3) " " (rc-dq $2) " " (rc-dq $4) ")")
it works fine.
It seems strange to me, because the alphabetic references have been there as far as I can remember, unless some special mode is required to activate them, or some other text transformation change them accidentally.

The doc says you may reference fields with a letter/number combination like ‘B3’, meaning the second field in the third row. So the letter is the column and the number is the row. But you seem to be using ampersands (&) instead of numbers. I've always used the @n$m notation, so I'm just going by what the documentation says.


text:
Agenda view with TODO items sorted by deadline and then by scheduled
I would like to have my TODO items sorted first by deadline and then by scheduled date, while for all the other ones, I honestly don't care. So, let's assume I have the following org file content and assuming it is Thu Nov. 2nd, 2023:
 * TODO Deadline in 1d, expected #1
DEADLINE: <2023-11-03 Fri>
 * TODO Deadline in 10d, scheduled in 5d, expected #3
SCHEDULED: <2023-11-07 Tue> DEADLINE: <2023-11-12 Sun>
 * TODO Nothing, expected #4 or #5
 * TODO Deadline in 10d, scheduled in 2d, expected #2
SCHEDULED: <2023-11-04 Sat> DEADLINE: <2023-11-12 Sun>
 * TODO Nothing again, expected #4 or #5

I wish I have:
 * TODO Deadline in 1d, expected #1
 * TODO Deadline in 10d, scheduled in 2d, expected #2
 * TODO Deadline in 10d, scheduled in 5d, expected #3
 * TODO Nothing, expected #4 or #5
 * TODO Nothing again, expected #4 or #5

I tried to implement this custom agenda view
(setq org-agenda-custom-commands
      '(("b" "Backlog"
        ((todo "TODO"
                ((org-agenda-overriding-header "My to-do list")
                 (org-agenda-block-separator nil)
                 (org-agenda-sorting-strategy
                  '(deadline-up scheduled-up))))))))

but I get this:
My to-do list
  todo:       TODO Deadline in 10d, scheduled in 2d, expected #2
  todo:       TODO TODO Deadline in 10d, schedule in 5d, expected #3
  todo:       TODO Deadline in 1d, expected #1
  todo:       TODO TODO Nothing, expected #4 or #5
  todo:       TODO TODO Nothing again, expected #4 or #5

What am I getting wrong?
Thanks in advance!


text:
How to select buffers for deletion
How can I delete multiple buffers from a buffer list?
I can select the ones I want to delete using C-s, but can't figure if I can mark them for subsequent deletion.
Is there a way?

See Operating on several buffers in the Emacs manual. You can do it with either with buffer-menu or with ibuffer - see e.g. this question for these (and some other) possibilities.


text:
Disable spellchecking a specific orthography without turning off flycheck
I frequently have buffers (Org-Mode, but that should be irrelevant) where I have a mix of Koine Greek, Ancient Hebrew, and English. I have spellchecking set up for Koine and English, but I have not found a hunspell dictionary for ancient Hebrew. As such flycheck thinks all Hebrew words are misspelled English words. The red squiggly underline makes most vowels impossible to see in pointed Hebrew. As such I end up turning of flycheck in these buffers, and misspelling my English and Greek words. If I could limit the blast radius by registering the Hebrew orthography with flycheck the way that I have registered the Greek, albeit not to spellcheck it but to ignore it, this would significantly improve the situation. Is there a tractable way to accomplish this?
In case it is relevant, here is what I have for the Greek:
  (add-to-list 'ispell-local-dictionary-alist
               '("ancient-greek"
                 "[θωερτψυιοπασδφγηςκλζξχβνμΘΩΕΡΤΨΥΙΟΟΠΑΣΔΦΓΗΚΛΖΞΧΒΝΜ]"
                 "[^θωερτψυιοπασδφγηςκλζξχβνμΘΩΕΡΤΨΥΙΟΟΠΑΣΔΦΓΗΚΛΖΞΧΒΝΜ]"
                 "᾿"
                 nil
                 ("-d" "grc_GR"); Dictionary file name
                 nil
                 utf-8))


text:
multicolumn pandoc slide with ox-pandoc export
I was wondering if it would be possible to have a multiple column beamer slide using ox-pandoc in emacs orgmode. Below is the typical syntax for multiple columns, this however does not work if pandoc-export-to-beamer is used.
#+TITLE: Title
#+SUBTITLE: Meetings presentation
#+AUTHOR: Me [fn:NAME: a definition]
#+PANDOC_OPTIONS: number-sections:nil
#+PANDOC_VARIABLES: classoption:"aspectratio=169"
#+PANDOC_VARIABLES: suppress-bibliography:true
#+PANDOC_VARIABLES: lang:en
#+PANDOC_VARIABLES: mainfont:Roboto

* Title

- Hi!

* Two columns

** A block                                           :BMCOL:
    :PROPERTIES:
    :BEAMER_env: ignoreheading
    :BEAMER_col: 0.4
    :END:
    - this slide consists of two columns
    - the first (left) column has no heading and consists of text
    - the second (right) column has an image and is enclosed in an
      @example@ block

** A screenshot :BMCOL:
    :PROPERTIES:
    :BEAMER_col: 0.6
    :BEAMER_env: example
    :END:

This does not work, any other syntax that I am unaware that I can use to try getting multiple columns in a slide?

Have you tried the LaTeX/Beamer/PDF exporter? Does it work with that? If so, then presumably there is a bug with ox-pandoc and you need to report it there.


text:
*Flycheck error messages* comes up with weird ShellCheck syntax errors
First of all, many thanks for Flycheck. I am using it with Bash scripts, and it works pretty well.
However, every now and then, a buffer named *Flycheck error messages* comes up with a weird error like this:
syntax error near unexpected token `)'
`  "$ZENITY_TOOL" --no-markup  --entry  --title "$TITLE"  --text "$HEADLINE_IP_ADDR"  --entry-text="$PREVIOUS_IP_ADDRESS")"'

Another example:
syntax error near unexpected token `)'
`          )'

My guess is that the following is happening: while I type, Flycheck is taking a snapshot of the current Bash source on the fly, and this version fails the syntax check so badly that ShellCheck does not generate the normal output format with source warnings which Flycheck expects and tries to parse.
Before using Flycheck, I checked with "bash -n" (noexec) first, and only called ShellCheck if Bash reported no syntax errors.
I am no expert, but if my guess is right, then maybe Flycheck could take another approach: it could convert the unparsable error from ShellCheck into a normal source code warning in the first line of the script. This way, the user can still inspect the error message, but the annoying *Flycheck error messages* buffer would not randomly come up.


text:
How can I find references to symbols in a project?
I've generated a TAGS file, which holds all my symbols.
I'm not sure I understand how xref-find-references is supposed to work, but I only get results on symbols that exists in the current buffer.
Is that how it's supposed to work? I really want results for the entire project.
I found this command:
M-x tags-search

, but it's cumbersome to use, as I have to hit
M-x file-loop-continue

.. everytime it gets a hit. It's not like a get a list view.

xref-find-references should show results for the whole project, but it all depends on what Xref backend is active. Perhaps you have a package installed that makes it use something local to the current file.


text:
How to reliably use run-python with venv in buffer-env?
I have a python project using venv under PROJECT_FOLDER/.venv. I wrote an .envrc file there to activate the environment. buffer-env-describe seems to know about it. However, when I am in a python script in my project I cannot start a python interpretter (run-python). It says it can't find python3:
start-process: Searching for program: No such file or directory, python3

Nevertheless, when looking at (getenv "PATH") in that buffer I see the venv path at the front.
What is the disconnect happening here? I remember in the past this was working. Although, I didn't understand why. I'm not really sure what changed. All I know is that I have had it configured through an .envrc file:
#!/bin/bash

# Activate the python environment
. .venv/bin/activate

Then in my custom.el I see that .envrc file declared safe to execute. What step am I missing?

mekeor on the #emacs IRC channel informed me of the inheritenv package. Installing that and requiring it made run-python discover the python3 executable.


text:
Warn before changing buffer coding system
Imagine I'm currently editing a file with iso-latin1-unix as the
coding system.  I yank some text from another buffer, not noticing its
coding system is utf-8-unix.  If the yanked text includes one or
more chars not representable in latin1, emacs will silently change
the buffer-file-coding-system to utf-8-unix the next time I save
the file.
I understand this makes sense, since all latin chars can be
represented in utf-8, but I'd like emacs to ask me permission to do
so, or at least warn me about that, since if I don't notice it, lots of
confusion may later occur.  For example, this happened to me in a
LaTeX file: the next time I run LaTeX (several minutes after having
yanked the utf-8 text) I got very confused by the unexpected errors it
spat out.
Ideally, this permission/information would be given as soon as the
'culprit' characters are inserted in the buffer, but at the time of
saving could be ok (I suspect it to be simpler).


text:
Haskell Interactive mode - incorrect parsing of crammed code
When using list comprehension without white spaces, all text after vertical bar turns grey.  [x| is treated like header of here-document - grey color spans for the rest of the buffer, unless sequence |] is present, which AFAIK is meaningless in Haskell. Also, I'm still on Debian Buster with vanilla Emacs 26.1, so this issue might be not present in newer versions. I know I could just use spaces, but is there any other fix?
For example, code snippet:
ls = [a| a<-[0..10]] ++ [1, 2, 3, 4]
ls1 = "xyz" ++ [b | b<-"string"] ++ [c | c <- "string" ]
-- comm|]ent highlighted as Code
-- properly coloured comment

Is rendered as:


text:
Prevent `vc-dir` from showing untracked directories recursively
Is there a setting to prevent vc-dir from showing untracked directories recursively and instead only show the directory as untracked? The former alternative is way to slow and should IMO be the default.


text:
Cannot make vc-style wrapping of git commit to work
None of these functions currently perform works as I except:
(defun vc-git-commit ()
  "Commit (via git)."
  (interactive)
  (vc-git--run-command-string nil "commit")
  (vc-dir-refresh))
(let ((map vc-dir-mode-map))
  (define-key map "c" 'vc-git-commit))

(defun vc-git-commit-amend ()
  "Commit amended (via git)."
  (interactive)
  (vc-git--run-command-string nil "commit" "--amend")
  (vc-dir-refresh))
(let ((map vc-dir-mode-map))
  (define-key map "," 'vc-git-commit-amend))

(defun vc-git-commit-amend-no-edit ()
  "Commit amended --no-edit (via git)."
  (interactive)
  (vc-git--run-command-string nil "commit" "--amend" "--no-edit")
  (vc-dir-refresh))
(let ((map vc-dir-mode-map))
  (define-key map ";" 'vc-git-commit-amend-no-edit))

. vc-git-commit has no effect, vc-git-commit-amend hangs, and vc-git-commit-amend-no-edit has not effect.
How should I modify these so that they work as vc-next-action does?


text:
change location of straight.el lockfile
I'm using straight.el as a package manager in emacs and would like to make my settings and packages portable and identical over several machines
That's why I like to put the default.el file under version control. I already have a git repository that manages dotfiles and would like to put it there. I generate symbolic links with gnu stow out of this dotfile repo to make the process convenient when I move to a new machine.
To avoid littering of this repository I set
(setq user-emacs-directory "~/.cache/emacs/")

Otherwise straight.el would put the downloaded repos inside my dotfile repo and I would get a dirty repo by just installing packages.
If I execute M-x straight-freeze-versions I now get the following lock file
~/.cache/emacs/git/straight/versions/default.el

which would be the file to put under version control.
If I would go back to my stow/dotfile approach I now would have the .cache folder/package littered by stuff that gets stored in the .cache folder.
Is there a way to only change the lock file location of straight.el or is there another approach to putting default.el under version control.
I found this but as I understand that does something similar to the user-emacs-directory but specifically for straight.el stuff, which has the same implications as before.

Thx, that stuff somehow got lost. :(


text:
Minibuffer and ido keybindings with ergoemacs-mode
I'm struggling to get the same hotkeys in the latest ergoemacs-mode (as they were in ergoemacs 5.3.7):

In the M-x (execute-extended-command) command prompt I want M-i to act as previous-line-or-history-element, and M-k as next-line-or-history-element
In the C-o (ergoemacs-find-file) I want M-j to act as ido-prev-match, and M-l as ido-next-match

Tried various things but no success so far.


text:
Emacs (maybe helm?) prefers buffers that aren't visible - how to change this?
When switching buffers, emacs seems to prefer buffers that aren't already visible.
For example, normally when I'm editing and switch to another file, when I C-x b, the buffer I was last in is at the top of the list in helm-mini, which often is what I want. However, if that file (the original one that I switched from, that I often want to switch back to) happens to be open in another window, it'll be at the bottom of the list. It seems to assume I'll most likely want to switch to a buffer that isn't already open, but that's not really the case for me.
How can I stop this, so emacs behaves the same whether or not it's already visible?