Skip to main content

Questions tagged [advice]

is for the Elisp advice feature that changes an existing definition of a function in a way that lets you undo the change easily. This tag applies to both old and new advice features. The old advice feature uses `defadvice`. The new advice feature uses functions and macros such as `advice-add` and `add-function`.

19 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3 votes
0 answers
71 views

How to advise a CL method?

I am familiar with setting advice on a function: (advice-add 'some-tag :before 'function-being-advised (lambda (arg) (message "In advice with arg: %s" arg))) How do you advise a ...
Troy Daniels's user avatar
3 votes
0 answers
435 views

How to set the colors for pdf-tools annotations individually?

I would like to be able to set the annotation colors to be different (e.g. strike-out "black" while keeping highlight "yellow"). I asked about this as an issue at the github page for pdftools and was ...
brittAnderson's user avatar
3 votes
0 answers
933 views

mu4e without mu server process

Occasionally I get error from mu4e error in process sentinel: Database is locked by another process. To solve this issue I usually end up to kill the process in list-process or sometimes pkill emacs ...
Jānis Erdmanis's user avatar
3 votes
0 answers
59 views

Passing advice to mode line

I'd like to advise format-mode-line to collapse whitespace across the whole string. The following attempt does not work for me. (advice-add 'format-mode-line :filter-return 'collapse-whitespace) ...
Matthew Piziak's user avatar
2 votes
0 answers
78 views

How to find out what advice has been defined for a function?

I accidentally added a lambda function that wasn't done being written to the advice of a function, and the function doesn't work. I don't know the exact text of the lambda function. Obviously, I could ...
Zorgoth's user avatar
  • 840
2 votes
0 answers
398 views

Faces not set immediately after load-theme

I'm trying to set the faces of highlight-indent-guides automatically whenever a new theme is loaded by making small adjustments to the background color of the default face. I have everything working ...
imalison's user avatar
  • 211
1 vote
2 answers
44 views

How to create an independent copy of a function's definition?

I want to create a modified copy of re-search-forward and advise this copy to be sensitive to isearch-filter-predicate. I tried: (defun make-search-sensitive-to-ifpmod-advice (orig-fun &rest args) ...
Gabriele's user avatar
  • 1,662
1 vote
0 answers
63 views

Get time since last keystroke

I would like to know how many seconds have passed since the last keystroke (or character that showed up in the screen, whatever is easier). Is there a timer that is associated to self-insert-command? ...
scaramouche's user avatar
  • 1,754
1 vote
0 answers
37 views

Why doesn't the window begin and end update after `outline-show-all`?

I'm using this test code. (defun +outline~show-all (orig-fn &rest args) "Show all." (let ((beg1 (window-start)) (end1 (window-end)) (beg2) (end2)) (apply orig-fn args) ...
Aquaactress's user avatar
  • 1,453
1 vote
0 answers
92 views

advise around org-add-note behaves differnt in Windows and macOS

I have the following in my init.el file: (defun my::with-no-drawer (func &rest args) (interactive "P") (let ((org-log-into-drawer (car args))) (funcall-interactively func args))) ...
SamanGh's user avatar
  • 51
1 vote
0 answers
178 views

Find where advice is defined (defadvice)

When a function documentation page tells me that a function has advice, is there any way to find out where that piece of advice is defined? This is advice that was created using the defadvice ...
nispio's user avatar
  • 8,245
0 votes
0 answers
32 views

Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)

I have this code: (defun make-search-sensitive-to-ifpmod-advice (orig-fun &rest args) "Temporary advice the search functions to make them sensitive to `isearch-filter-predicate'" (...
Gabriele's user avatar
  • 1,662
0 votes
2 answers
78 views

How do you handle an error in the scope of current-buffer with condition-case?

I would like to create headings and subheadings with org-capture if they don't exist with file+olp in my templates. The problem is that I get this message Heading not found on level 1. I'm not sure ...
Rick's user avatar
  • 25
0 votes
2 answers
26 views

Save before running tests? (Prepend function?)

How can I prepend a function call in Elisp? E.g. I have a key binding (C-c C-c C-t) that runs some tests (command rustic-cargo-test) and it always asks me if I want to save - I'd like to run (save-...
John Graham's user avatar
0 votes
0 answers
105 views

How can I advise a cl-defgeneric method?

There's a bug in eglot.el where initialisation options aren't handled, so I can't set the initialisation parameters for a given server; that is causing me problems because the language server I'm ...
cl-defgeneric's user avatar
0 votes
0 answers
82 views

How to properly advise macros used by functions if earlier byte-compilation is present?

I am trying to customize the looks of org-agenda and, in order to do so, I would like to advice the macro org-agenda--insert-overriding-header; this macro appears to be used in several functions. ...
Wilder's user avatar
  • 95
0 votes
0 answers
48 views

How do I stop checkdoc from flagging header/footer in org-src-edit buffers?

When editing Emacs Lisp source blocks in org-mode via org-src-edit, if flycheck is enabled (which I'd like to keep that way) checkdoc rather annoyingly remarks that I'm missing headers and footers and ...
Aleksandar Dimitrov's user avatar
0 votes
0 answers
81 views

Using advices to flatten a single subfolder

One of Github's features i like is that it "flattens" path if a folder contains only one subfolder, i.e you have a src folder which has only main folder, so by clicking on src you go to the content of ...
4lex1v's user avatar
  • 613
0 votes
0 answers
46 views

Updating advice in function

I've noticed that if function f is used to advise function g through advice-add, and function f is then redefined, function g's advice is not updated. After digging into advice-add a bit, it is clear ...
Tianxiang Xiong's user avatar