text:
How to speed up ido-use-filename-at-point 'guess on large directories
I ran into an issue of C-x C-f being very slow when guessing the filename at
point if the file at point is located in a large directory (119765 entries).
My ido configuration:
(require 'ido)
(setq ido-enable-flex-matching t
      ido-enable-dot-prefix t
      ido-max-prospects 8
      ido-everywhere t
      ido-auto-merge-work-directories-length -1
      ido-create-new-buffer 'always
      ido-use-filename-at-point 'guess)
(ido-mode 1)

I did manage to find ido-big-directories variable, so I also added this:
(add-to-list 'ido-big-directories (rx "/gnu/store"))

That does seem to work, because trying to navigate into /gnu/store does tell me
[Too big].
However when I have a point over a filename inside the /gnu/store, for example
/gnu/store/a1252v3fav1fabl1qmbzyjl936prabir-foo, the ido-find-file takes a long
time (many seconds) before showing the prompt (with the file at point filled
in).
#emacs did advice me to use toggle-debug-on-quit, so I do have a backtrace:
    Debugger entered--Lisp error: (quit)
      #f(compiled-function () #<bytecode 0x1e3ca1a0816daf>)()
      ido-ignore-item-p("gi4q3azbf5akkn2lwzqwk7w9zbb23xps-pyfuse3-3.2.1.tar..."
("\\`CVS/" "\\`#" "\\`.#" "\\`\\.\\./" "\\`\\./") t)
      #f(compiled-function (name) #<bytecode
-0x1fcf4865f9f8d5f0>)("gi4q3azbf5akkn2lwzqwk7w9zbb23xps-pyfuse3-3.2.1.tar...")
      ido-make-file-list-1("/gnu/store/")
      ido-make-file-list(nil)
      ido-read-internal(file "Find file: " ido-file-history nil
confirm-after-completion "a1252v3fav1fabl1qmbzyjl936prabir-foo")
      ido-file-internal(raise-frame)
      ido-find-file()
      funcall-interactively(ido-find-file)
      command-execute(ido-find-file)

It seems to be building a list of the files, I somewhat hoped the
ido-big-directories would prevent that.
Would someone have any idea how to make this faster?


text:
Tab-completion in order to access org-roam ecosystem
I'm looking to access an .org note at a specific heading, in such a way that tab completion is available. Is there any such thing? usage example: <command> microeconomics <tab-completed-heading>, or <command> <tab-completed-university-class-name> introduction

source: Stack Exchange

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

sort: votes


text:
How can I have point on today when running org-agenda?
This is a general problem I'm struggling with, but I have to begin somewhere.
This problem didn't happen before.
When I run org-agenda, point ends up on the bottom of the entries, instead of todays' date.
I also see this if I run some org-agenda-custom-command and I get a big list and point is on the last entry, when I really want it on the first entry;)

Before what? What did you do to change it? (FWIW, it does not happen here:  today rules.) At the very least, provide versions of Emacs and Org mode. I would suspect something in your config, so I would suggest that you set up a new config with just your org-agenda-files set up (no other customizations at all). Does C-c a a still end up at the end? Then add org-agenda-custom-commands and test the other case. And report back! With details!

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


text:
How to enter query-replace-regexp with key binding C-M-%, if emacs session is not stand-alone but in mate-terminal running Bash?
Title says it all. The problem: When you start emacs within a terminal running a shell, Meta and Ctrl key act in strange ways: In some regards they work, in others, however, not as it used to be coming from emacs stand-alone usage. The solution: Enter Meta and Ctrl differently.
Example: mark-sexp - set mark ARG sexps from point; the place mark goes is the same place C-M-f would move to with the same argument.
[cursor]The weather is so nice.
C-M-SPC
[cursor][mark]The[/mark] weather is so nice.
In stand-alone emacs sessions, you would type Ctrl-[Alt/Meta]-SPC and it happens.
In emacs sessions within mate-terminal running Bash, however, typing in works differently:
Holding Ctrl, additionally typing [ - replacing Alt/Meta, being alternative way to enter Alt/Meta - and then either holding it or releasing it and typing in Ctrl-SPC.
And now the big quiz question:
How to do that with C-M-%?
You see, this key binding is very similar to the example; the only notable difference: That 3rd key, in this case %, it seems to require holding shift while typing "5" for "%" to appear, but that's probably where emacs sessions within mate-terminal running Bash don't play along.
My suspicion - and it can be wrong: Whenever C-M-[3rd key] doesn't need usage of the shift key, described alternative way works, but whenever that 3rd key makes usage of the shift key necessary, it doesn't work - not just with 3rd key being %, but all others requiring shift key usage.
Trying it, typing Crtl-[, holding or releasing it, and then Ctrl-Shift-5, invokes Query-replace, as if just [Alt/Meta]-Shift-5 was typed in within the emacs session in mate-terminal running Bash, but not query-replace-regexp, as desired.
The bad consequence: Imagine you have a text with several number sets containing seperator . - example 843.87921, 2.99, and so on - and you want to replace the . with another separator, , for example - 843,87921, 2,99 - you can do that in one go with query-replace-regexp using grouping, and back-referencing to the number sequences before and after the separator within the replace-string - \1,\2 - well, but if you can't invoke query-replace-regexp, but just the simple, normal query-replace, that won't work. It needs a tool being capable of handling grouping and back-referencing.
Is there any default way of typing in C-M-% differently, which makes invocation of query-replace-regexp work within emacs sessions in mate-terminal running Bash?
I am aware that giving up on the more efficient key binding entry and instead going the less efficient X way (eXtend) by typing in M-x, followed by writing "query-replace-regexp" is an option.
I'm using emacs version:
GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2017-09-20 on lcy01-07, modified by Debian
My free/libre OS is Trisquel.

Didn't read the whole thing but have you tried ESC C-%? Before the meta key was invented, M-anything was typed ESC anything and that is still the case today.


text:
Is there a way to suggest label names in org-mode html export?
In the org-mode example below, I would like to be able to specify the label name to be used by the latex export back-end. Is there such a way?
I have a reason : To be able to mix org-style references [[fig:label]] and latex-style references \ref{fig:label} in the same document. This is not necessary (in fact, probably bad practice) if I have everything in the org document.
example :
in org file
#+NAME: eq:001
#+label: eq:001
\begin{equation}\begin{split}
x_c(t)=p(t)x(t)
\end{split}\end{equation}

in cui

#+NAME: eq:1012
#+label: eq:1012
\begin{equation}\begin{split}
p(t)=\sum_{n=-\infty}^{\infty}\delta(t - nT_c)
\end{split}\end{equation}

per cui la [[eq:001]] diventa

but when export in html i get
html file
\begin{equation}\begin{split}
\label{eq:001}
x_c(t)=p(t)x(t)
\end{split}\end{equation}

in cui

\begin{equation}\begin{split}
\label{eq:1012}
p(t)=\sum_{n=-\infty}^{\infty}\delta(t - nT_c)
\end{split}\end{equation}

per cui la \eqref{eq:001} diventa

but in browser program i get
per cui (???)

I don't understand why.


text:
Inconsistent behavior for image animation when changing window/frame state
I've noticed that image animation produces strangely inconsistent behavior when changing window or frame state, depending on which command was most recently used to display or redisplay the image.
Steps to replicate:

Open Emacs 29.1 with no config (emacs -Q). I haven't tested this on other versions.
Visit an animated image file (example).
Evaluate (setq image-animate-loop t).
If the animation is not running, do image-toggle-animation (RET). Then run any of the following commands: toggle-frame-maximized, toggle-frame-fullscreen, or delete-other-windows (the latter only if there are other windows open). RESULT: the animation stops.
Run any of the following commands: image-transform-fit-to-window, image-transform-fit-both, or (find-alternate-file (buffer-file-name)) (i.e. (C-x C-v RET), then repeat step 4. RESULT: The animation stops as before.
Run any of the following commands: image-increase-size, image-decrease-size, set-scale, image-transform-fit-to-width, or image-transform-fit-to-height, then repeat step 4. RESULT: The animation does not stop, but keeps running.

I've looked at the definitions for these commands in image-mode.el and image.el, and I don't see anything obvious that would cause this discrepancy. For example, image-transform-fit-to-width and image-transform-fit-to-height give different results from image-transform-fit-both and image-transform-fit-window, but all of those commands work by simply setting the variable image-transform-resize followed by a call to image-toggle-display-image. What could be the  cause of this behavior?


text:
Calculating using entry properties in Org mode clocktable
I have some entries in an Org mode file that have a property containing a lambda expression:
* Tasks
** Task 1
   :PROPERTIES:
   :Formula:     (lambda (x) (max 20.0 (* 11.0 x)))
   :END:
   :LOGBOOK:
   CLOCK: [2023-10-25 Wed 11:31]--[2023-10-25 Wed 13:25] =>  1:54
   :END:
** Task 2
   :PROPERTIES:
   :Formula:     (lambda (x) (* 9.5 x))
   :END:
   :LOGBOOK:
   CLOCK: [2023-10-10 Fri 16:40]--[2023-10-10 Fri 17:26] =>  0:46
   CLOCK: [2023-10-10 Fri 15:10]--[2023-10-10 Fri 15:22] =>  0:12
   :END:

I would like it if when I created a clocktable using such entries, there was a way to create some extra columns using these formulas. Namely, I'd like to interpret each formula as the way to calculate the cost associated with the task using the time as input; in other words, in the example above for Task 1 I'd like to call (lambda (x) (max 20.0 (* 11.0 x))) with the input 1 + 54/60.
In the final table, I'd like an extra column for the formula, and an extra column for the result of calling the lambda. So instead of
#+BEGIN: clocktable :maxlevel 2 :scope file :block 2023-10
#+CAPTION: Clock summary at [2023-11-08 Wed 12:42], for October 2023.
| Headline                                   |   Time |      |
|--------------------------------------------+--------+------|
| *Total time*                               | *2:52* |      |
|--------------------------------------------+--------+------|
| Tasks                                      |   2:52 |      |
| \_  Task 1                                 |        | 1:54 |
| \_  Task 2                                 |        | 0:58 |
#+END:

the table would instead look like:
#+BEGIN: clocktable :maxlevel 2 :scope file :block 2023-10
#+CAPTION: Clock summary at [2023-11-08 Wed 12:42], for October 2023.
| Headline                 |   Time |      | Formula                            | Cost  |
|--------------------------+--------+------|------------------------------------+-------|
| *Total time*             | *2:52* |      |                                    |       |
|--------------------------+--------+------|------------------------------------+-------|
| Tasks                    |   2:52 |      |                                    |       |
| \_  Task 1               |        | 1:54 | (lambda (x) (max 20.0 (* 11.0 x))) | 20.90 |
| \_  Task 2               |        | 0:58 | (lambda (x) (* 9.5 x))             |  9.18 |
#+END:

It would also be really nice if there was a final row containing the total cost.
I am vaguely aware of things like TBLFM in Org mode but can't really tell if it's capable of doing something like this. I have also seen some templates for creating invoices using Org mode, but these all just have a single rate that is being multiplied by the time, whereas I'd like to have custom formulas.


text:
emacsformacosx and ImageMagick
I am attempting to use ImageMagick with emacsformacosx 28.2. I have just installed ImageMagick with brew. Evaluating (image-type-available-p 'imagemagick) returns nil. Much of the advice I have seen centers on building emacs with ImageMagic, which is not the case here. I had naively assumed this simply to be a matter of adding something to my .emacs file. What am I missing?

what are you trying to do with emacs+imagemagick? what's your goal, or why do you need imagemagick?


text:
splits the hunk in ediff mode
Is splitting the hunk in ediff mode possible?

diff-mode provides diff-split-hunk which splits the hunk at the current line. You can then apply, or reverse it with (C-u) diff-apply-hunk. Can be very convenient for selectively applying/undoing changes.

Hope that's possible in ediff mode as well.


text:
Use different font for math fragments in org mode
How do I use the fixed-pitch font for math fragments in org-mode buffers? I.e., I want to use a monospace font for all strings of the form \(...\) or \[...\], where ... may include newline characters as well, as is common for equations written in math display mode. Note that I am not referring to the org special source buffer that edits these fragments in a separate latex-mode buffer.
I'm an Emacs newb, so the best I could come up with was a regex-based font-lock:
(progn
  (setq-local font-lock-keywords
              `((,(rx (group
                       (or "\\[" "\\(")
                       (zero-or-more anything)
                       (or "\\]" "\\)"))) (1 'fixed-pitch))))
  (font-lock-fontify-buffer))

And then running this on an org-mode-hook.
But this is definitely wrong. Not only does it remove all the nice org-mode styling applied to things like section headers, but it's also applying the fixed-pitch font to more than just the intended math fragments, suggesting issues with the regex at least.

One problem is that you are setting font-lock-keywords to the one thing you want, thereby throwing away any other entries that Org mode was careful to add: that probably explains why the rest of the Org mode styling goes away. Another problem is that (zero-or-more anything) probably matches too much: in particular, it should not match \) or \] since they are supposed to close the matching substring. In general, regexps that try to match an opening string, followed by "stuff", followed by a closing string are complicated beasts that may not always work.


text:
Emacs 29 - Error (use-package): rg/:catch: install not supported in nil
Here my init.el
(use-package rg
  :ensure t
  :ensure-system-package rg)

In Emacs 27 it's work just fine.
But I removed Emacs 27.1 and installed Emacs 29.1
And now when start Emacs 29.1 I get error:
⛔ Error (use-package): rg/:catch: install not supported in nil

You probably had some setup in the old version that you forgot about. See :use-package-ensure-system-package in the use-package  manual.


text:
Dom traversal return nil even though the test condition seems to be true
The purpose of the traversal this time is to be able to visit each node, if there is a specific attribute inside that node, it should return true, add that node to the list and proceed on the next recursion as the following code:
(defun pick-tag (x)
  (let ((text-list '()) (node (dom-node x)))
    (pcase (dom-tag node)
      ;; ((pred stringp) (dom-tag node))
      ;; ('comment '())
      ((pred consp) (when (assoc 'data-table (dom-attributes node))
                        (push (dom-text node) text-list))) ;;I was expecting this to be true.
      (_
       (mapconcat #'pick-tag (dom-children node) "")))))

From the above code, per my conviction, for data-table being a symbol inside the node's attribute should return true. but after evaluating the code below, I only obtain a nil result.

(defun macro-listify (tag-entries)
  (with-temp-buffer
    (insert tag-entries)
    (let* ((mytags (libxml-parse-html-region (point-min) (point-max))))
      (text-tag (car (dom-by-tag mytags 'body))))))

(let ((mytree "

         <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-listify mytree))


text:
Eglot and MS SQL
I was looking for a way to use Eglot with the MSSQL Server. I found this GitHub repo https://github.com/emacs-lsp/lsp-mssql, but this is for lsp-mode and not for Eglot.
Is there an Eglot configuration/repo for the MSSQL Server?


text:
How can I convert nnmail-split-methods mail filtering format to Sieve format?
Any pointers to convert nnmail-split-methods to Sieve? Are there any functions in gnus, since it seems to also handle Sieve format?
I have like a few hundred lines exactly like this:
("ffmpeg-devel" "^\\(Mailing-List:\\|Delivered-To:\\|List-Id:\\).*ffmpeg-devel.ffmpeg.org*")
("ffmpeg-user" "^\\(Mailing-List:\\|Delivered-To:\\|List-Id:\\).*ffmpeg-user.ffmpeg.org*")

, so it's a very simple list.


text:
capture day in calfw calendar and pass it to org-agenda
I am trying to capture from the calfw calendar and have the entry appear in the agenda buffer, in the same way that the emacs calendar does.
with bind c for capture it tells me that there is no cfw:org-capture-template set.
my code:
    (require 'calfw)
(use-package calfw
    :config
  (setq cfw:org-overwrite-default-keybinding t)) ;; atajos de teclado de la agenda org-mode

(use-package calfw-org
    :ensure t
    :config
    (setq cfw:org-overwrite-default-keybinding t))
    :bind ([f5] . cfw:open-org-calendar))

In org-calfw file say this:
(defcustom cfw:org-capture-template nil
  "org-capture template. If you use `org-capture' with `calfw', you shold set like
'(\"c\" \"calfw2org\" entry (file nil)  \"* %?\n %(cfw:org-capture-day)\")"
  :group 'cfw-org
  :version "24.1"
  :type
  '(list string string symbol (list symbol (choice file (const nil))) string))

somebody know how do this?


text:
How to clean inactive Eglot events buffers up simultaneously?
Editing multiple Eglot-enabled buffers generates several *EGLOT ... events* (Fundamental) buffers.
Even though M-x eglot-shutdown(-all) kills active events buffers being used for communications with language servers, but it doesn't kill inactive buffers which have already lost connections with language servers.


text:
How to make Gnus auto-expire RSS
I'm very new to Gnus. I have added some feeds by using G R. As far as I understand, the feed is modified by the server (by adding new "messages" and removing old "messages") and when Gnus loads it every time, the new messages are downloaded and the old messages which disappeared from the server feed are not deleted in Gnus. I don't want to keep forever the feeds which I read, therefore I activated auto-expire on the groups corresponding to my feeds. However, every time I read one of the messages in one of my feeds, it doesn't get marked with E (in fact, it will show up as Old, eventually). When I exit the group with q, I read something similar to "setting as expiring"  but when I go back in nothing has changed. In fact, I tried to "purge all messages which are set as expiring" and none was deleted. Does auto-expire only work for emails, and did I understand correctly how Gnus's retrieve pipline works for RSS?


text:
Set default face (font) with use-package ':custom-face'
What do I need to tell 'use-package' so that it will set the default font for all frames on Emacs startup?
With 'use-package' now installed as part of Emacs, I want to specify faces with its :custom-face feature.
(I could use customize-face, but the point here is to migrate this configuration to use-package emacs with the rest of my Emacs customisation.)
When I use :custom-face to specify the 'default' face for the 'emacs' package:
;;; init.el
;; …
(use-package emacs
  ;; …
  :custom-face
  ;; Default face for any frame.
  (default ((t (:foundry "PfEd" :family "Inconsolata" :height 120))))
  ;; The basic fixed-pitch face.
  (fixed-pitch ((t (:foundry "PfEd" :family "Inconsolata" :height 120))))
  ;; …
)

the Inconsolata font is not used in any frame, and the 'default' face is not what :custom-face specified.

M-x describe-face RET default RET

Face: default (sample) (customize this face)
…
       Family: DejaVu Serif
      Foundry: PfEd
        Width: normal
       Height: 120

The Inconsolata font is known to Emacs:

M-x describe-font RET Inconso RET

name (opened by): -PfEd-Inconsolata-medium-normal-normal-*-16-*-*-*-m-0-iso10646-1
       full name: Inconsolata:pixelsize=16:foundry=PfEd:weight=medium:slant=normal:width=normal:spacing=100:scalable=true
       file name: /usr/share/fonts/truetype/inconsolata/Inconsolata.otf
…

If I use the separate function 'set-frame-font', it works:
;;; init.el
;; …
(use-package emacs
  ;; …
  :config
  ;; Set default font in any frame.
  (set-frame-font "Inconsolata 12" nil t)
  ;; …
  )

So, Emacs is not conforming to the :custom-face specification in use-package emacs, yet it knows the font and can set it using set-frame-font. It should obey the specification in :custom-face, no?
How do I use 'use-package' to specify the font for Emacs to use by default?

What happens if you just use M-x customize-face? If that works then check how you're using use-package. If that doesn't work then the problem isn't how you're using use-package.


text:
how to export a table of contents for tagged lines only
Let's say my document has this motif:
* Heading 1           :sometag:
** Heading 1.1
*** Heading 1.1.1     :target:
* Heading 2           :target:
** Heading 2.1        :sometag:

When exporting (say, to HTML) I want the option of creating a Table of Contents with only the :target: lines exported.
Note that the :target: tags occur at all kinds of levels of headings, so there's no way to filter based on exporting headings only to a certain depth.
I'm looking for solutions based on Org-mode and Emacs (even if additional Emacs Lisp code is required), not solutions that entail preprocessing or filtering the file with scripts outside of Emacs, because of portability constraints.


text:
A script to export org with highlighted code block
I've written the script to export all of my ORG files into HTML files.  It takes the files from the folder "content" and saves the results to "public".
(setq user-emacs-directory "./.packages")
(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))
(straight-use-package 'use-package)
(setq-default use-package-always-defer t)

(use-package htmlize
   :straight t)

(use-package tree-sitter-langs
  :straight t)

(global-tree-sitter-mode)
(setq org-html-validation-link nil)
(require 'ox-publish)
(setq org-publish-project-alist
      (list
       (list "org-site:main"
             :recursive t
             :base-directory "./content"
             :publishing-function 'org-html-publish-to-html
             :publishing-directory "./public"
             :with-author nil           ;; Don't include author name
             :with-creator nil            ;; Include Emacs and Org versions in footer
             :with-toc nil                ;; Include a table of contents
             :section-numbers nil       ;; Don't include section numbers
             :time-stamp-file nil)))    ;; Don't include time stamp in file

;; Generate the site output
(org-publish-all t)

The problem is that I don't get the syntax highlight in the source code blocks when I run the script as an Emacs Lisp script: emacs -Q --script init.el. I get the syntax highlighting in the source code blocks when I run Emacs and load the file: emacs -Q  -l init.el.
An example of an org file from the directory
#+BEGIN_SRC python
  def hello(name):
      return f"hello {name}"

  hello("world")
#+END_SRC

How do I get the syntax highlight running the file as an Emacs Lisp script?
GNU Emacs 28.3


text:
How can I make occur work only on visible text (e.g. org outline)?
Is there a way to do an M-x occur on only visible text, similar to how you can make isearch skip folded content with setq-local search-invisible nil? That way we could occur on for example headings of a folded org tree, or outer keys of a folded json structure, etc.
(I know I can anchor the occur regex to ^\*.* etc., but it takes enough time that I avoid doing it, and it only helps in that specific case; occur-ing only on what is visible would be nicer.)


text:
How to stop ispell-message in notmuch-message-mode from checking quotes and citations?
Per the documentation (`ispell-message) should ignore text from quoted mails.
For example:
"My interlocuter" email@domain.net writes:

mispeled

But for some reason my emacs asks me to correct 'mispeled' above in this very message!
I'm using emacs 28.2 on Debian bookworm with notmuch. I think the issue is related to Message[Notmuch] mode. It works as expected in plain Message mode.
Thanks for the help!


text:
How do I --debug-init on Android?
I'm starting Emacs like this:
adb shell am start -n org.gnu.emacs/org.gnu.emacs.EmacsActivity

, but run into some problems that I need to debug.
If I try to pass "--debug-init"
adb shell am start -n org.gnu.emacs/org.gnu.emacs.EmacsActivity --es ARGS "--debug-init"

it says:
Starting: Intent { cmp=org.gnu.emacs/.EmacsActivity (has extras) }

, but it doesn't start Emacs with --debug-init.
Is there some other way I should pass this parameter?
Does Emacs on Android even support any parameters. Where is the source code for Emacs on Android?
If it doesn't support parameters, is there any way to pass this in the init file?;)

This is a question about how to use adb. Surely it has a way to pass arguments to the program you are asking it to run. Consult the documentation or ask on an android forum instead.


text:
How to auto insert new line when hit return key between {}
When write functino in c.c like this:
int main(){}
After I hit return key between {}, it goes like this:
int main(){
}

How could I get it to work like this:
int main() {
   >position of cursor after return<
}

Is there any functions or packages can do this?


text:
Is there a way to line wrap org-mode source blocks when exporting?
In an org-mode document, I sometimes have markdown source blocks, like:
#+BEGIN_SRC markdown
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
#+END_SRC

Problem: When exporting to HTML & opening, these markdown blocks don't line wrap, so all of the text is cut off/not visible (instead it just displays on one huge line, as above).
Question: Is there a way to instruct org-mode to line wrap markdown source blocks?


text:
Is there a function like org-agenda-date-later that only affects the scheduled timestamp?
I would like to be able to bulk increase or decrease the :SCHEDULED timestamps by a  number of days when in agenda view.
I only want to change the date, and retain any existing time ("hh:mm") or repeater settings for each item.
The closest solution I have found is the below bulk action. If I pass a "1" argument it will advance the timestamp to 1 day into the future. With no argument, it will change the timestamp of any marked items to today. "-1" will move the timestamp back one day.
(add-to-list 'org-agenda-bulk-custom-functions '(?D (lambda () (call-interactively 'org-agenda-date-later))))

This would be perfect except org-agenda-date-later does not seem to allow you to select which type of timestamp is changed. If an item has both :DEADLINE and :SCHEDULED timestamps, for example, org-agenda-date-later will often alter the :DEADLINE timestamp instead of the :SCHEDULED timestamp. I think it simply selects the first timestamp it finds.
Is there any way I could achieve a similar result, but only affecting the :SCHEDULED timestamps?


text:
How can I get feedback from helm-projectile-ag that it's still searching?
When I do a helm-projectile-ag search, there's nothing telling me if it's still searching, is there?
Is there any way to show what directories it's working with, sort of being verbose?;)


text:
With helm-do-grep-ag, how can I helm-toggle-truncate-line to be able to see the whole line?
The results for helm-do-grep-ag disappears off screen
I've found this command
C-c > (helm-toggle-truncate-line) to truncate lines

This works;) , but I want to set it default.

Is this link helpful to you?


text:
Doom: Return to previous buffer after kill-buffer?
Recently switched to doom emacs and one behaviour I can't seem to get back is this:

In buffer A, open new file in buffer B
kill-buffer B (Cx-k)
Back in buffer A

Currently, after killing buffer B, it switches to another buffer but not always A. I want it to switch always to the previous buffer. I tried adding (previous-buffer) to kill-buffer-hook which did work but since this hook seems to be called all over the place, it had horrible side-effects. Any ideas?


text:
Make counsel-evil-marks select the candidate immediately, go to the mark in one click
I am using counsel-evil-marks in doom-emacs on Mac OS. When the mini buffer pops up, I still need to select the candidate and press enter.
How can I assign a key, so I switch immediately to the marked position, for example C-a to jump to the a mark?


text:
"Function provided is already compiled" - php mode
I get "Function provided is already compiled" in minibuffer whenever I enter php-mode. Why and how to fix it?
Debian bookworm, Emacs 28.2, php-mode 1.24.2.
EDIT
This is the backtrace @phils asked:
Debugger entered--Lisp error: "Function provided is already compiled"
  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_50>(#f(compiled-function (start end) #<bytecode -0x1dc527c4$
  byte-compile(#f(compiled-function (start end) #<bytecode -0x1dc527c4196f2b60>))
  byte-code("\300\301\302\303!\"\207" [defalias php-syntax-propertize-function byte-compile #f(compiled-function (start$
  command-execute(php-mode record)
  execute-extended-command(nil "php-mode" "php-mode")
  funcall-interactively(execute-extended-command nil "php-mode" "php-mode")
  command-execute(execute-extended-command)

That message comes from byte-compile, so it sounds like something is attempting to byte-compile a byte-code elisp function.
(defun byte-compile (form)
  "If FORM is a symbol, byte-compile its function definition.
If FORM is a lambda or a macro, byte-compile it as a function."
  (displaying-byte-compile-warnings
   (byte-compile-close-variables
    (let* ((lexical-binding lexical-binding)
           (fun (if (symbolp form)
                    (symbol-function form)
                  form))
           (macro (eq (car-safe fun) 'macro)))
      (if macro
          (setq fun (cdr fun)))
      (prog1
          (cond
           ;; Up until Emacs-24.1, byte-compile silently did nothing
           ;; when asked to compile something invalid.  So let's tone
           ;; down the complaint from an error to a simple message for
           ;; the known case where signaling an error causes problems.
           ((compiled-function-p fun)
            (message "Function %s is already compiled"
                     (if (symbolp form) form "provided"))
            fun)
[...]

Try the following to obtain a backtrace to add to your question:
(setq debug-on-message "Function .+ is already compiled")


text:
How to act on the currently highlighted selection of expand region mode in a function?
I am using er/expand-region in doom-emacs on Mac OS. I would like to combine yanking and expanding a region in a function, that is, automatically yank the selection of expand region with evil after expanding a region x times.
I've tried a few things, but they all seem not to work as intended.


text:
Terminate custom avy repeated command
I am using a repeated command in doom-emacs on Mac OS which I borrowed from some other thread here:
(defun avy-delete-line-repeat (count &optional all-frames)
  "Wrapper around `other-window' to continue to jump to other with key o."
  (interactive "p")
  (avy-kill-whole-line count )
  (message "Use o to jump to next window.")
(avy-delete-line-repeat 1)
  (set-transient-map
   (let ((map (make-sparse-keymap)))
     (define-key map (kbd "o")
       (lambda () (interactive) (avy-delete-line-repeat 1)))
     map)))

I would like to achieve an improvement of the repeated behaviour in a sense that I could terminate/break the loop with some modifier.
What I mean by that is that instead of selecting a line (here for deletion) with avy chars, which could be for example h i I could instead press h M-i so that the command terminates.
So it would be more general treating both the repetition, and at the same time having the possibility to break the loop without pressing extra esc.
One would achieve one esc click less which would turn out in a lot considering I am using this command quite often.


text:
Viewing a single mail file in a maildir
Is there any major mode that allows one to properly view a single mail file in a maildir?
By "properly" here I mean similar to "big" email clients, like mu4e or gnus, so allowing (at least) view headers and text parts of an email, hiding unencoded parts (images, files).

Define "properly". Say what the problem is. Question needs clarification.


text:
How can I org-depend on a date?
I don't think org-depend can depend on a date, but maybe org-edna can?
I find lots of org-edna examples, but not the actual documentation where it would list date as an option.
What I want is for a org-heading to change state to TODO after a certain date.
I can't use scheduling, cause it's not considered overdue, if I am free to do it any time after that date.
Something, like
:BLOCKER: not_before(2023-12-24)

This could easily be done the same way as in your SWAY question: a timer triggers a function every night and the function searches all heading for a NOT-BEFORE property - if it finds it, it compares the date in the property with the current date and if they are equal, it sets the TODO state.


text:
Hiding Headings in Doc Exported from ORG-MODE to ODT
I'm writing a short story. The end result will be a 30-page doc with zero chapters or headings, (not even a title.) However, within org mode, I would like to have a foldable outline for working with individual scenes. So I tried the following:
#+BEGIN_COMMENT

* SCENE #1 - Autopsy

#+END_COMMENT

This gives me the foldable outline within Emacs that I need, but unfortunately it exports the comment to ODT, even though the guide says otherwise:
      "regions surrounded by ‘#+BEGIN_COMMENT’ … ‘#+END_COMMENT’ are not exported."
      (Org Guide: 12.5 Comment Lines)

I've also tried using the COMMENT tag in front of the heading, but to no avail.
This is my first time trying Emacs for published prose. I bet there's a simple solution, but I haven't found it yet.

i tested on emacs 26.1... Both #+BEGIN_COMMENT option and tag option are working, by which I mean that the marked sections are not exported to odt. I used C-c C-e o o to export...

@Saravana
Thanks for your reply.
Really? It doesn't work here.
Emacs 29.2 on Macos 14.4
Export: C-c C-e o O
Apache Open Office 4.1.15
Results in following line in exported OD:
SCENE #1 - Autopsy
surrounded by begin/end comments.
Any ideas?

I've just noticed that some scene headings are successfully commented out while others are not. Perhaps an ill-defined macro has screwed up something. I'll investigate further. Thanks for help.

See https://emacs.stackexchange.com/a/73108/42623 for more ideas

Still stuck on this. Here's a minimal doc that reproduces the problem, i.e. comments not hiding headings:
#+OPTIONS: title:nil toc:nil author nil date:nil num:nil

#+BEGIN_COMMENT
* Scene #1: Murder
#+END_COMMENT
Once upon a nasty time...

blah blah

End of scene #1.

#+BEGIN_CENTER
*
#+END_CENTER

#+BEGIN_COMMENT
* Scene #2: Autopsy
#+END_COMMENT
Start of scene #2

Do a C-c C-c of the elisp code below ...
#+begin_src emacs-lisp :exports results :results none
  (add-hook 'org-export-before-parsing-hook
        (defun my-flush-headlines (backend)
          (cl-case backend
        (odt
         (org-with-wide-buffer
          ;; Flush headlines
          (flush-lines (rx (and bol (one-or-more "*") space (one-or-more any) eol))
                   (point-min) (point-max))))
        (otherwise
         ))))

  ;; (remove-hook 'org-export-before-parsing-hook-hook
  ;;         'my-flush-headlines)

#+end_src

* Non non deserunt consectetur amet, ullamco

Enim  non  voluptate  mollit  ea  laboris et  ex  nostrud  qui  labore
cupidatat. Do nisi ea quis et deserunt minim velit ut.

** Excepteur duis eiusmod reprehenderit et reprehenderit

Dolor elit, culpa aliqua enim culpa duis sit nostrud veniam, sint esse
sed id excepteur aute velit velit fugiat dolor.

* Sint eu magna aliqua enim

Occaecat  cupidatat  occaecat  excepteur  sed tempor  dolore  eu  quis
consectetur eu nulla labore proident, enim culpa.

** Fugiat fugiat consectetur fugiat fugiat

Irure  velit pariatur  nulla commodo  anim elit,  ea mollit  sit amet,
commodo et tempor ex commodo adipiscing id.

The recipe below hides the Outline Headings (as opposed to deleting those).  Look at the XML style definition, and you can figure out what XML attributes come in to play for "hiding" and "page breaking" to take effect.
For the recipe below to work, you MUST be using The Authoritative fork of Org mode's ODT exporter .
(Note that the above exporter is a much more advanced and featureful ODT exporter than what is available in Emacs or Org mode repos.)
see also Create a stylesheet for your OpenDocument files, and inline the XML definitions right in your Org file–Think HTML_HEAD, or HTML_HEAD_EXTRA but for ODT / DOCX files
If you want this

export this
* Non non deserunt consectetur amet, ullamco

Enim  non  voluptate  mollit  ea  laboris et  ex  nostrud  qui  labore
cupidatat. Do nisi ea quis et deserunt minim velit ut.

** Excepteur duis eiusmod reprehenderit et reprehenderit

Dolor elit, culpa aliqua enim culpa duis sit nostrud veniam, sint esse
sed id excepteur aute velit velit fugiat dolor.

* Sint eu magna aliqua enim

Occaecat  cupidatat  occaecat  excepteur  sed tempor  dolore  eu  quis
consectetur eu nulla labore proident, enim culpa.

** Fugiat fugiat consectetur fugiat fugiat

Irure  velit pariatur  nulla commodo  anim elit,  ea mollit  sit amet,
commodo et tempor ex commodo adipiscing id.

# Hide Headings but also insert Page Break

#+ATTR_ODT: :target "extra_styles" :backends (odt)
#+begin_src nxml
<style:style style:name="Heading"
             style:parent-style-name="Standard"
             style:next-style-name="Text_20_body"
             style:family="paragraph"
             style:class="text"
             style:master-page-name="">
  <style:paragraph-properties fo:break-before="page"
                              fo:keep-with-next="always"
                              fo:margin-bottom="0.212cm"
                              fo:margin-top="0.423cm"
                              style:page-number="auto">
    <style:tab-stops>
      <style:tab-stop style:position="17cm"
                      style:type="right" />
    </style:tab-stops>
  </style:paragraph-properties>
  <style:text-properties style:font-name="Arial"
             style:font-name-asian="SimSun"
             style:font-name-complex="Tahoma1"
             fo:font-family="Arial"
             fo:font-size="14pt"
             style:font-family-asian="SimSun"
             style:font-family-complex="Tahoma"
             style:font-family-generic="swiss"
             style:font-family-generic-asian="system"
             style:font-pitch="variable"
             style:font-pitch-asian="variable"
             style:font-pitch-complex="variable"
             style:font-size-asian="14pt"
             style:font-size-complex="14pt"
             text:display="none" />
</style:style>
#+end_src

# # Hide Headings

# #+ATTR_ODT: :target "extra_styles" :backends (odt)
# #+begin_src nxml
# <style:style style:name="Heading"
#              style:parent-style-name="Standard"
#              style:next-style-name="Text_20_body"
#              style:family="paragraph"
#              style:class="text">
#   <style:paragraph-properties fo:keep-with-next="always"
#                               fo:margin-bottom="0.212cm"
#                               fo:margin-top="0.423cm">
#     <style:tab-stops>
#       <style:tab-stop style:position="17cm"
#                       style:type="right" />
#     </style:tab-stops>
#   </style:paragraph-properties>
#   <style:text-properties style:font-name="Arial"
#            style:font-name-asian="SimSun"
#            style:font-name-complex="Tahoma1"
#            fo:font-family="Arial"
#            fo:font-size="14pt"
#            style:font-family-asian="SimSun"
#            style:font-family-complex="Tahoma"
#            style:font-family-generic="swiss"
#            style:font-family-generic-asian="system"
#            style:font-family-generic-complex="system"
#            style:font-pitch="variable"
#            style:font-pitch-asian="variable"
#            style:font-pitch-complex="variable"
#            style:font-size-asian="14pt"
#            style:font-size-complex="14pt"
#            text:display="none" />
# </style:style>
# #+end_src

# Hide entries of Heading entries in TOC

#+ATTR_ODT: :target "extra_styles" :backends (odt)
#+begin_src nxml
<style:style style:name="Index"
             style:parent-style-name="Standard"
             style:family="paragraph"
             style:class="index">
  <style:paragraph-properties text:line-number="0"
                              text:number-lines="false" />
  <style:text-properties style:font-name-complex="Tahoma"
             style:font-family-complex="Tahoma"
             text:display="none" />
</style:style>
#+end_src


text:
Inserting a Page Break Wherever in ODT Document when Exporting from Org Mode
Is there a simple one-liner to insert a page break wherever when generating ODT from Org mode? I'd rather not dig into styles if I can avoid it. I'd like to be able to do  something like #+ODT_PAGEBREAK if there was such a tag, but there isn't. Any ideas?

Three is plenty of examples in The Authoritative fork of Org mode's ODT exporter and I also anticiapated this question and more or less gave the answer in other question.

... the "other question" being https://emacs.stackexchange.com/questions/80822/hiding-headings-in-doc-exported-from-org-mode-to-odt

@mxnt

more or less gave the answer in other question.
I'm sorry. I don't see any reference to forcing a page break in the "other question." Could you clue me in, please? I'd be much obliged.

In the docs, I can only find how to generate a page break before or after some specific element (e.g. toc.) I need to generate  a page break wherever/whenever. Is there a one-liner I can use?

Let me reword my question in Yes/No form:
Is there a one-liner that forces a page break whenever/wherever in exported ODT or PDF document?
It is easier to say yes or no, than to berate me for failing to have found an answer myself.


text:
Confirming commit message in magit when working with emacsclient
I am running emacs as client, mostly for the faster startup time.
Now, when I edit a commit message in magit, and confirm it with C-c C-c, not just the window with the commit message is closed, but the entire emacs client (with all the other files I am editing) is terminated, which of course is not what I want.
How can I change this behavior?

While in the buffer you use to edit the commit message, what is the output of C-h k C-c C-c ?

@TristanRiehs it is "with-editor-finish"...


text:
How to change the value of cdlatex-math-modify-prefix?
The prefix key used for creating common LaTeX commands in CDLaTeX is not changed after modifying the cdlatex-math-modify-prefix variable. I have tried changing it using (setq cdlatex-math-modify-prefix ?/) (as per the documentation and this answer) and using Emacs' customisation menu.
The value of the variable itself is changed, but it does not take effect. For instance, typing /i should then expand into \textit{}, but it doesn't — whereas typing 'i still does (note, ' is the default prefix).
Is it possible to change the prefix?

This is due to the fact that the prefix key is mapped during the loading of the cdlatex package and all subsequent changes to the variable do not update the keymap. Therefore, the cdlatex-math-modify-prefix variable should be set before loading the package. With use-package you can achieve this as follows:
(use-package cdlatex
  :custom (cdlatex-math-modify-prefix ?/))


text:
Map a syntax table to Unicode’s general categories
How would you go about mapping the syntax table of a major mode to Unicode’s general categories?  For example, set whitespace class - for each character of the syntax table that belongs to Unicode category Zs, word syntax w for each Lu, and punctuation . for each Po.
My aim is to make functions like skip-syntax-forward and regexp constructs like \s- and [:blank:] operate in Unicode terms.
I know that get-char-code-property gets me the Unicode category, and modify-syntax-entry changes the syntax class for a single character.  But how do I apply these wholesale to every possible character?

Do you have a specific question, or do you just want someone to write the code for you? What have you written so far?


text:
Select region between two rows. Many lines
Emacs 27.1
Suppose I has text file with 50_000 rows.
I want to select region from row number 10_000 to row number 30_000.
How I can do this in Emacs?

You were given the answer in a comment to your previous question: search for the beginning line, set a mark, search for the ending line, and narrow.  Or go to the beginning line number, set a mark, go to the ending line number and narrow. These are very elementary operations that you should know about by now: you've been around for many years.

Does this answer your question? Show text between two lines

The command M-x goto-line, bound to M-g g by default, will allow you to jump to the 10,000th row and 30,000th row. Otherwise the answer from your previous question applies here.


text:
Toggle minor modes in all current and future buffers derived from specific major mode
I am new to elisp. That's why I'd be glad if some of you could help me out.
What I want to achieve
I want to enable hl-line-mode and display-line-number-mode in all current and future buffers derived from prog-mode, text-mode, conf-mode and dired-mode. I also want to be able to toggle this functionality. By default I want this to be turned off. I just want to enable this from time to time.
I'll outline the high level way I thought about achieving this.
Adding functionality

Add mode hooks to enable functionality in future buffers. (1)
Apply buffer-local minor mode functions to all buffers derived from specific modes. (2)

Removing functionality

Remove mode hooks such that future buffers don't have it. (3)
Apply buffer-local minor mode functions to all buffers derived from specfic modes to toggle/disable functionality activated in step 2 above. This step might the same as step 2 above because hl-line-mode and display-line-number-mode provide toggling. (4)

I know how to add and remove hooks but I don't know how implement steps 2 and 4. Especially checking whether buffers are in a mode derived from a specific major mode or not.
I'd be really happy to receive some help on how to go about it.
Thanks in advance!
EDIT: Just to clarify what I actually want, if I wasn't precise enough:

Line numbers and line highlighting should be disabled when I launch emacs.
When the need arises, I want to call a function interactively that immediately turns on display-line-numbers-mode and hl-line-mode in all current buffers that match the requirements specified in my original post. With all current buffers I mean all buffers selectable via switch-to-buffer. Furthermore this function should also modify prog-mode-hook, text-mode-hook and so on, such that all buffers matching the requirements that I open in the future have display-line-numbers-mode and hl-line-mode enabled.
When I don't need line numbers and line highlighting anymore I want to call a different interactive function such that display-line-numbers-mode and hl-line-mode get turned off immediately in all current buffers that match the requirements. Furthermore this function should also remove previously added functions from prog-mode-hook, text-mode-hook and so on, such that all buffers matching the requirements that I open in the future do not have display-line-numbers-mode and hl-line-mode enabled.

This is just my naive way of thinking about the problem. More knowledgeable people might be able to implement equivalent functionality in a better, more idiomatic way.
ANOTHER EDIT: I got it working. It's ugly though:
I got it working exactly how I want it to work.
It's very ugly and the code can probably be shortened. Especially the parts adding/removing hooks.
Any suggestions on how to do so?
(defun my/activate ()
  (interactive)
  (add-hook 'dired-mode-hook 'hl-line-mode)
  (add-hook 'dired-mode-hook 'display-line-numbers-mode)
  (add-hook 'prog-mode-hook 'hl-line-mode)
  (add-hook 'prog-mode-hook 'display-line-numbers-mode)
  (add-hook 'conf-mode-hook 'hl-line-mode)
  (add-hook 'conf-mode-hook 'display-line-numbers-mode)
  (add-hook 'text-mode-hook 'hl-line-mode)
  (add-hook 'text-mode-hook 'display-line-numbers-mode)
  (dolist ($buf (buffer-list))
    (with-current-buffer $buf
      (when (derived-mode-p 'dired-mode 'prog-mode 'conf-mode 'text-mode)
        (lambda)
        (hl-line-mode)
        (display-line-numbers-mode)))))

(defun my/deactivate ()
  (interactive)
  (remove-hook 'dired-mode-hook 'hl-line-mode)
  (remove-hook 'dired-mode-hook 'display-line-numbers-mode)
  (remove-hook 'prog-mode-hook 'hl-line-mode)
  (remove-hook 'prog-mode-hook 'display-line-numbers-mode)
  (remove-hook 'conf-mode-hook 'hl-line-mode)
  (remove-hook 'conf-mode-hook 'display-line-numbers-mode)
  (remove-hook 'text-mode-hook 'hl-line-mode)
  (remove-hook 'text-mode-hook 'display-line-numbers-mode)
  (dolist ($buf (buffer-list))
    (with-current-buffer $buf
      (when (derived-mode-p 'dired-mode 'prog-mode 'conf-mode 'text-mode)
        (lambda)
        (hl-line-mode -1)
        (display-line-numbers-mode -1)))))

You can define a variable with the list of all the modes as value and then loop over that to add/remove hooks, as well as use it when checking for derived modes. Other than that, I think your solution is fine.

What's with the (lambda) in both functions? That doesn't do anything: just delete it.

You can use a "globalized" minor mode, which is the pairing of a buffer local minor mode with a global mode which controls the state of that buffer-local minor mode en-masse in selected buffers (including any future buffers matching the criteria). Globalized modes act during after-change-major-mode-hook, which is later than the major mode's own hook.
(define-globalized-minor-mode global-my-mode my-mode my-mode
  :init-value nil
  :predicate '(prog-mode text-mode conf-mode dired-mode))

(define-minor-mode my-mode
  "Enable line numbering and highlighting."
  :init-value nil
  :global nil
  (let ((state (if my-mode 1 0)))
    (hl-line-mode state)
    (display-line-numbers-mode state)))

Then just use M-x global-my-mode to toggle it.
If you're using Emacs 27 or earlier you can't use :predicate and instead you'll need to specify a separate TURN-ON function in the globalized mode definition:
(defun my-mode-turn-on ()
  "Maybe turn on `my-mode'."
  (when (derived-mode-p 'prog-mode 'text-mode 'conf-mode 'dired-mode)
    (my-mode 1)))

You could alternatively use this approach to create two custom global modes, directly controlling hl-line-mode and display-line-numbers-mode respectively (rather than defining your own buffer-local mode).  It seems simpler to me to combine all of the desired functionality into a single mode, however.  If you prefer that alternative though, make sure you still use sane non-conflicting naming (bearing in mind that both of the minor modes being controlled already have associated global modes by default).

Here comes derived-mode-p function to your rescue.
(defun my-unset-minor-modes-hook ()
  (when (derived-mode-p 'prog-mode 'text-mode 'conf-mode 'dired-mode)
    (hl-line-mode -1)
    (display-line-number-mode -1)))
(add-hook 'after-change-major-mode-hook 'my-unset-minor-modes-hook)

You can alternatively consider change-major-mode-hook in the place of after-change-major-mode-hook to add your hook to.
[Edit] As phils noted in comments, this may do the work but in spirit, change-major-mode-hook is meant to do cleanup operations by the exiting mode & after-change-major-mode-hook is the more suited candidate to do mode initialising operations. So, it is wise to add the hook to after-change-major-mode-hook.

@Saravana: Good answer, but I'm confused by the change-major-mode-hook mention -- that one runs while the previous mode is still active.  It's usually used to enable a major mode to clean up after itself just before some other mode takes its place.  You certainly couldn't use it in place of after-change-major-mode-hook.

Gosh! the names din't tell the difference, at least to me. thanks for clarifying, phils.

You're welcome.  You might find https://stackoverflow.com/a/19295380/324105 to be a worthwhile read.