emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#69573: closed (Eager macro-expansion failure: (wrong-type-argument i


From: GNU bug Tracking System
Subject: bug#69573: closed (Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil))
Date: Tue, 26 Mar 2024 13:45:02 +0000

Your message dated Tue, 26 Mar 2024 03:34:46 -0400
with message-id <yp1edbxqwdl.fsf@fencepost.gnu.org>
and subject line Re: bug#69573: Eager macro-expansion failure: 
(wrong-type-argument integer-or-marker-p nil)
has caused the debbugs.gnu.org bug report #69573,
regarding Eager macro-expansion failure: (wrong-type-argument 
integer-or-marker-p nil)
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
69573: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69573
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil) Date: Wed, 6 Mar 2024 00:53:20 +0100 User-agent: Mozilla Thunderbird

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


--- End Message ---
--- Begin Message --- Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil) Date: Tue, 26 Mar 2024 03:34:46 -0400 User-agent: Gnus/5.13 (Gnus v5.13)
Andrea Corallo <acorallo@gnu.org> writes:

> Gabriele Nicolardi <gabriele@medialab.sissa.it> writes:
>
>> Il 15/03/24 14:52, Andrea Corallo ha scritto:
>>
>>  kay I've installed 00553628558 into master, I believe it does what we
>> want and seems to fix the minimal reproducer I made from the original
>> example.
>>
>> Gabriele could you check it solves the issue for you?
>>
>> I confirm that the version compiled from master resolves my issue.
>>
>> Thank you!
>>
>> Gabriele
>
> Very cool.  I'll keep this bug open a bit just so we remeber to
> re-evaluate the backport.

Okay backported the fix to emacs-29.  I'm closing this.

Thanks

  Andrea


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]