unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [elpa] externals/tempel 7fc015b652 1/2: Respect major-mode-remap-alist (Emacs 29 major mode remapping)
       [not found] ` <20240215235854.989F4C0F008@vcs2.savannah.gnu.org>
@ 2024-02-16  2:28   ` Stefan Monnier
  2024-02-16  6:04     ` Daniel Mendler via Emacs development discussions.
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2024-02-16  2:28 UTC (permalink / raw)
  To: Daniel Mendler; +Cc: emacs-devel

> --- a/tempel.el
> +++ b/tempel.el
> @@ -494,7 +494,9 @@ This is meant to be a source in `tempel-template-sources'."
>     (cl-loop
>      for m in modes thereis
>      (or (eq m #'fundamental-mode)
> -        (derived-mode-p m)))
> +        (derived-mode-p m)
> +        (when-let ((remap (alist-get m (bound-and-true-p major-mode-remap-alist))))
> +          (derived-mode-p remap))))

We do the same in YASnippet, but note that it's a hack: it will work for
those alternative modes activated via `major-mode-remap-alist` but not
for those activated some other way (e.g. `M-x`, `auto-mode-alist`).
:-(


        Stefan




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [elpa] externals/tempel 7fc015b652 1/2: Respect major-mode-remap-alist (Emacs 29 major mode remapping)
  2024-02-16  2:28   ` [elpa] externals/tempel 7fc015b652 1/2: Respect major-mode-remap-alist (Emacs 29 major mode remapping) Stefan Monnier
@ 2024-02-16  6:04     ` Daniel Mendler via Emacs development discussions.
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Mendler via Emacs development discussions. @ 2024-02-16  6:04 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> --- a/tempel.el
>> +++ b/tempel.el
>> @@ -494,7 +494,9 @@ This is meant to be a source in `tempel-template-sources'."
>>     (cl-loop
>>      for m in modes thereis
>>      (or (eq m #'fundamental-mode)
>> -        (derived-mode-p m)))
>> +        (derived-mode-p m)
>> +        (when-let ((remap (alist-get m (bound-and-true-p major-mode-remap-alist))))
>> +          (derived-mode-p remap))))
>
> We do the same in YASnippet, but note that it's a hack: it will work for
> those alternative modes activated via `major-mode-remap-alist` but not
> for those activated some other way (e.g. `M-x`, `auto-mode-alist`).
> :-(

Yes, I got reminded about the remap feature by your recent Yas commit. I
hadn't added this so far since I had hoped for a better solution.

Daniel



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-16  6:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <170804153424.9663.14060540462885238224@vcs2.savannah.gnu.org>
     [not found] ` <20240215235854.989F4C0F008@vcs2.savannah.gnu.org>
2024-02-16  2:28   ` [elpa] externals/tempel 7fc015b652 1/2: Respect major-mode-remap-alist (Emacs 29 major mode remapping) Stefan Monnier
2024-02-16  6:04     ` Daniel Mendler via Emacs development discussions.

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).