GNU bug report logs - #69573
Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)

Previous Next

Package: emacs;

Reported by: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>

Date: Tue, 5 Mar 2024 23:55:01 UTC

Severity: normal

Done: Andrea Corallo <acorallo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
To: bug-gnu-emacs <at> gnu.org
Subject: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Wed, 6 Mar 2024 00:53:20 +0100
[Message part 1 (text/plain, inline)]
Hi,
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'" (let ((POINT (point))) (catch 'filtered 
(while (apply orig-fun args) (let ((B (match-beginning 0)) (E (match-end 
0))) ;; 1 - If all points in the region that matches the search ;; from 
the previous "search-command" meet the criteria ;; accepted by the 
filter, then the loop stops (`throw') and ;; returns the position 
`(point)`: (when (funcall isearch-filter-predicate B E) (throw 'filtered 
(point))))) ;; 2 - If the search is unsuccessful, or does not meet ;; 
the criteria accepted by the filter, then return to the ;; starting 
position and return the value `nil'. (goto-char POINT) nil))) |

|(defalias 'search-forward-ifpmod (symbol-function 'search-forward) 
"Copy of `search-forward' function (to be) adviced to obey to 
`isearch-filter-predicate'") (advice-add 'search-forward-ifpmod :around 
#'make-search-sensitive-to-ifpmod-advice) (defalias 
're-search-forward-ifpmod (symbol-function 're-search-forward) "Copy of 
`re-search-forward' function (to be) adviced to obey to 
`isearch-filter-predicate'") (defalias 'search-forward-regexp-ifpmod 
're-search-forward-ifpmod) ;; The following breaks my minor-modes 
definitions (advice-add 're-search-forward-ifpmod :around 
#'make-search-sensitive-to-ifpmod-advice) |

I found that this particular code snippet:

|(advice-add 're-search-forward-ifpmod :around 
#'make-search-sensitive-to-ifpmod-advice) |

breaks my minor-modes definitions. E.g. if I evaluate the code above and 
later on the following code (MWE):

|(defun mwe-function-1 () "MWE function 1" (interactive) (message 
"function 1 executed")) (define-minor-mode mwe-mode "MWE mode" 
:init-value nil :lighter (:eval (propertize " MWE " 'face '(:foreground 
"RoyalBlue" :background "DarkGoldenrod1"))) :keymap `( (,(kbd 
"<C-kp-1>") . mwe-function) ) (if mwe-mode (easy-menu-define mwe-menu 
mwe-mode-map "MWE" '("MWE mode" ;; I want the menu on mode-line only: 
:visible (not (eq (framep (selected-frame)) 'x)) ["mwe-function-1" 
mwe-function-1 :help "mwe-function 1"] )) t)) |

I get this error:

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


       Step to reproduce the error:

1. |emacs -Q|
2. Evalute the |add-advice| code
3. Evalute my minor-mode definiton

Did I make a mistake in the |add-advice| usage or is it a bug?

Best regards,

Gabriele Nicolardi

​
[Message part 2 (text/html, inline)]

This bug report was last modified 1 year and 117 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.