[Top][All Lists]

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

bug#32795: Acknowledgement (26.1; provided-mode-derived-p does not suppo

From: Andrew Schwartzmeyer
Subject: bug#32795: Acknowledgement (26.1; provided-mode-derived-p does not support parent modes set with defalias)
Date: Mon, 24 Sep 2018 19:36:11 -0700
User-agent: Posteo Webmail

Hi all,

I actually just found _another_ scenario that breaks due to this. I was editing a Jenkinsfile (groovy-mode) and expecting dtrt-indent to automatically adjust the indent, but it was not. Turns out it's the same reason again!


(define-globalized-minor-mode dtrt-indent-global-mode dtrt-indent-mode
      (lambda ()
        (when (derived-mode-p 'prog-mode 'text-mode)

The check `(derived-mode-p 'prog-mode 'text-mode)` returns nil, because the mode that groovy-mode derived from is set up like this:

    (defalias 'groovy-parent-mode
      (if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))

Using this for `provided-mode-derived-p` fixes it:

    (defun provided-mode-derived-p (mode &rest modes)
      "Non-nil if MODE is derived from one of MODES.
Uses the `derived-mode-parent' property of the symbol to trace backwards.
    If you just want to check `major-mode', use `derived-mode-p'."
           (not (memq mode modes))
           (let* ((parent (get mode 'derived-mode-parent))
                  (parentfn (symbol-function parent)))
(setq mode (if (and parentfn (symbolp parentfn)) parentfn parent)))))

Thanks Robert Pluim for the `let*` trick, I was wondering how you do that without nesting `let` expressions.

Does anyone have other suggestions before I send a patch file?



On 09/21/2018 8:22 am, address@hidden wrote:
Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):

If you wish to submit further information on this problem, please
send it to address@hidden

Please do not send mail to address@hidden unless you wish
to report a problem with the Bug-tracking system.

reply via email to

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