unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* autoconf-mode fontification
@ 2024-11-24 17:42 Björn Bidar
  0 siblings, 0 replies; 8+ messages in thread
From: Björn Bidar @ 2024-11-24 17:42 UTC (permalink / raw)
  To: help-gnu-emacs


Hey,

I noticed that font-lock mode isn't enable by default for autoconf-mode.

Is it intended that I have to call it myself for this mode?

I also noticed that the fontification is rather limited.

Hope you have a great day,

Björn



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

* Re: autoconf-mode fontification
       [not found] <87iksc7cle.fsf@>
@ 2024-11-24 17:59 ` Arsen Arsenović
  2024-11-24 18:52 ` Eli Zaretskii
  2024-11-28  9:42 ` Björn Bidar
  2 siblings, 0 replies; 8+ messages in thread
From: Arsen Arsenović @ 2024-11-24 17:59 UTC (permalink / raw)
  To: Björn Bidar; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]

Björn Bidar <bjorn.bidar@thaodan.de> writes:

> Hey,
>
> I noticed that font-lock mode isn't enable by default for autoconf-mode.
>
> Is it intended that I have to call it myself for this mode?
>
> I also noticed that the fontification is rather limited.

In general, IME, the autoconf mode isn't great, lacking even
indentation.  Am I missing something?
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: autoconf-mode fontification
       [not found] <87iksc7cle.fsf@>
  2024-11-24 17:59 ` Arsen Arsenović
@ 2024-11-24 18:52 ` Eli Zaretskii
  2024-11-27 22:55   ` Björn Bidar
                     ` (2 more replies)
  2024-11-28  9:42 ` Björn Bidar
  2 siblings, 3 replies; 8+ messages in thread
From: Eli Zaretskii @ 2024-11-24 18:52 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Björn Bidar <bjorn.bidar@thaodan.de>
> Date: Sun, 24 Nov 2024 19:42:21 +0200
> 
> 
> I noticed that font-lock mode isn't enable by default for autoconf-mode.

How did you see that?  Is that in "emacs -Q"?

When I visit configure.ac in "emacs -Q", I do see font-lock, and
major-mode is autoconf-mode.  So I wonder how it doesn't work for you.

> I also noticed that the fontification is rather limited.

Feel free to submit a feature-request bug report with improvements in
font-lock.



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

* Re: autoconf-mode fontification
  2024-11-24 18:52 ` Eli Zaretskii
@ 2024-11-27 22:55   ` Björn Bidar
       [not found]   ` <874j3s70df.fsf@>
       [not found]   ` <87y1145k1c.fsf@>
  2 siblings, 0 replies; 8+ messages in thread
From: Björn Bidar @ 2024-11-27 22:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Björn Bidar <bjorn.bidar@thaodan.de>
>> Date: Sun, 24 Nov 2024 19:42:21 +0200
>> 
>> 
>> I noticed that font-lock mode isn't enable by default for autoconf-mode.
>
> How did you see that?  Is that in "emacs -Q"?
>
> When I visit configure.ac in "emacs -Q", I do see font-lock, and
> major-mode is autoconf-mode.  So I wonder how it doesn't work for you.

Hm that works for me too. However I noticed that once I enter
autoconf-mode that font-lock mode is disabled and doesn't turn on again.
I tried to step through the debugger once triggered after turn-on-font-lock-if-desired.

After kill-all-local-variables font-lock-mode is never t again in the
buffer that's opened with that mode unless I call the mode explicitly.

Debugger entered--entering a function:
* copy-tree(((face font-lock-face)))
* font-lock-default-function(nil)
* font-lock-mode(-1)
* font-lock-change-mode()
* kill-all-local-variables()
* autoconf-mode()
* set-auto-mode-0(autoconf-mode nil)
* set-auto-mode--apply-alist((("/etc/conf\\.modules" . etc-modules-conf-generic-mode) ("/etc/modules\\.conf" . etc-modules-conf-generic-mode) ("/etc/resolve?\\.conf\\'" . resolve-conf-generic-mode) ("/etc/named\\.boot\\'" . named-boot-generic-mode) ("/etc/sudoers\\'" . etc-sudoers-generic-mode) ("/etc/[v]*fstab\\'" . etc-fstab-generic-mode) ("/etc/shadow-?\\'" . etc-passwd-generic-mode) ("/etc/group-?\\'" . etc-passwd-generic-mode) ("/etc/passwd-?\\'" . etc-passwd-generic-mode) ("/etc/services\\'" . etc-services-generic-mode) ("/etc/inetd\\.conf\\'" . inetd-conf-generic-mode) ("\\.mailrc\\'" . mailrc-generic-mode) ("inventory\\'" . ansible-inventory-generic-mode) ("alias\\'" . alias-generic-mode) ("[mM][aA][nN][iI][fF][eE][sS][tT]\\.[mM][fF]\\'" . java-manifest-generic-mode) ("\\.wrl\\'" . vrml-generic-mode) ("prototype\\'" . prototype-generic-mode) ("\\.rules\\'" . mailagent-rules-generic-mode) ("[hH][oO][sS][tT][sS]\\'" . hosts-generic-mode) ("[xX]modmap\\(rc\\)?\\'" . xmodmap-generic-mode) ("\\.ad\\'" . x-resource-generic-mode) ("\\.Xenvironment\\'" . x-resource-generic-mode) ("\\.Xresources\\'" . x-resource-generic-mode) ("\\.Xdefaults\\'" . x-resource-generic-mode) ("\\.fvwm2rc\\'" . fvwm-generic-mode) ("\\.fvwmrc\\'" . fvwm-generic-mode) ("smb\\.conf\\'" . samba-generic-mode) ("access_log\\'" . apache-log-generic-mode) ("access\\.conf\\'" . apache-conf-generic-mode) ("httpd\\.conf\\'" . apache-conf-generic-mode) ("srm\\.conf\\'" . apache-conf-generic-mode) ("\\.epub\\'" . nov-mode) ("\\.po\\'" . po-mode) ("\\.\\(org\\|org_archive\\)\\'" . org-mode) ("\\.jira\\'" . jira-markup-mode) ("\\.confluence\\'" . jira-markup-mode) ("\\/\\.ssh/config\\'" . ssh-config-mode) ("Cargo.lock\\'" . toml-mode) ("\\.\\(service\\|timer\\)\\'" . systemd-mode) ("\\.yml\\'" . yaml-mode) ("\\.yaml\\'" . yaml-mode) ("\\.inc\\'" . rpm-spec-mode) ("\\.spec\\'" . rpm-spec-mode) ("/PKGBUILD$" . pkgbuild-mode) ("/etc/nginx/.*\\.conf\\'" . nginx-mode) ("\\.nginx\\'" . nginx-mode) ("\\.plantuml\\'" . plantuml-mode) ("\\.\\(ex\\([s]\\)\\|elixir\\)\\'" . elixir-mode) ("\\.tmpl?\\'" . web-mode) ("\\.html?\\'" . web-mode) ...) nil nil)
* #<subr set-auto-mode>()
* so-long--set-auto-mode(#<subr set-auto-mode>)
* apply(so-long--set-auto-mode #<subr set-auto-mode> nil)
* set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer scratchbox2/configure.ac> "~/dev/sailfish/jolla/pkgs/pj_oss/scratchbox2/configure.ac" nil nil "~/dev/sailfish/jolla/pkgs/pj_oss/scratchbox2/configure.ac" (262001439 56))
  #<subr find-file-noselect>("/home/bidar/dev/sailfish/jolla/pkgs/pj_oss/scratchbox2/configure.ac" nil nil nil)
  ad-Advice-find-file-noselect(#<subr find-file-noselect> "/home/bidar/dev/sailfish/jolla/pkgs/pj_oss/scratchbox2/configure.ac" nil nil nil)
  apply(ad-Advice-find-file-noselect #<subr find-file-noselect> ("/home/bidar/dev/sailfish/jolla/pkgs/pj_oss/scratchbox2/configure.ac" nil nil nil))
  #f(advice ad-Advice-find-file-noselect :around #<subr find-file-noselect>)("/home/bidar/dev/sailfish/jolla/pkgs/pj_oss/scratchbox2/configure.ac" nil nil nil)
  apply(#f(advice ad-Advice-find-file-noselect :around #<subr find-file-noselect>) "/home/bidar/dev/sailfish/jolla/pkgs/pj_oss/scratchbox2/configure.ac" (nil nil nil))
  editorconfig--advice-find-file-noselect(#f(advice ad-Advice-find-file-noselect :around #<subr find-file-noselect>) "/home/bidar/dev/sailfish/jolla/pkgs/pj_oss/scratchbox2/configure.ac" nil nil nil)
  apply(editorconfig--advice-find-file-noselect #f(advice ad-Advice-find-file-noselect :around #<subr find-file-noselect>) ("/home/bidar/dev/sailfish/jolla/pkgs/pj_oss/scratchbox2/configure.ac" nil nil nil))
  find-file-noselect("/home/bidar/dev/sailfish/jolla/pkgs/pj_oss/scratchbox2/configure.ac" nil nil nil)
  find-file("/home/bidar/dev/sailfish/jolla/pkgs/pj_oss/scratchbox2/configure.ac")
  dirvish-find-entry-a()
  apply(dirvish-find-entry-a nil)
  dired-find-file()
  dired-open-file(nil)
  funcall-interactively(dired-open-file nil)
  command-execute(dired-open-file)


While further stepping through with debug-on-variable-change
font-lock-mode with emacs -Q and my currently used Emacs.
I noticed that at some point this happens with emacs -Q:
* #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_136>(t font-lock-mode nil (:debug-on-exit t))
* backtrace-frame(1 called-interactively-p)
* called-interactively-p(any)
* font-lock-mode()
* turn-on-font-lock()
* turn-on-font-lock-if-desired()
* global-font-lock-mode-enable-in-buffer()
* run-hooks(after-change-major-mode-hook)

While for me this also happens except that the anonymous lambda function
is:
*  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_136> (t font-lock-mode (-1) (:debug-on-exit t))

How could that be?

>> I also noticed that the fontification is rather limited.
>
> Feel free to submit a feature-request bug report with improvements in
> font-lock.

I was talking about the font-lock in that mode, I hope that was clear.



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

* Re: autoconf-mode fontification
       [not found]   ` <874j3s70df.fsf@>
@ 2024-11-27 23:33     ` Björn Bidar
  0 siblings, 0 replies; 8+ messages in thread
From: Björn Bidar @ 2024-11-27 23:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs



Ah I got what was different.

With Emacs -Q I was using the builtin autoconf mode while currently I'm
using the autoconf-mode.el from the autoconf package.

Once I switched over that mode to also use derived-mode and be closer to
what m4-mode does even that one worked again:

;;;###autoload
(define-derived-mode autoconf-mode prog-mode "ac"
  "A major-mode to edit Autoconf files like configure.ac.
\\{autoconf-mode-map}
"
  :syntax-table autoconf-mode-syntax-table
  (setq-local add-log-current-defun-function #'autoconf-current-defun)
  (setq-local comment-start "# ")
  (setq-local parse-sexp-ignore-comments t)
  (setq-local font-lock-defaults '(autoconf-font-lock-keywords nil)))



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

* Re: autoconf-mode fontification
       [not found]   ` <87y1145k1c.fsf@>
@ 2024-11-28  7:32     ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2024-11-28  7:32 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Björn Bidar <bjorn.bidar@thaodan.de>
> Cc: help-gnu-emacs@gnu.org
> Date: Thu, 28 Nov 2024 01:33:35 +0200
> 
> 
> 
> Ah I got what was different.
> 
> With Emacs -Q I was using the builtin autoconf mode while currently I'm
> using the autoconf-mode.el from the autoconf package.
> 
> Once I switched over that mode to also use derived-mode and be closer to
> what m4-mode does even that one worked again:

OK, this explains why I couldn't reproduce the issues you reported.

Maybe the Autoconf developers should be advised not to distribute
their mode, if it is incompatible with the recent versions of Emacs
and/or is much less capable?



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

* Re: autoconf-mode fontification
       [not found] <87iksc7cle.fsf@>
  2024-11-24 17:59 ` Arsen Arsenović
  2024-11-24 18:52 ` Eli Zaretskii
@ 2024-11-28  9:42 ` Björn Bidar
  2024-11-28 11:54   ` Eli Zaretskii
  2 siblings, 1 reply; 8+ messages in thread
From: Björn Bidar @ 2024-11-28  9:42 UTC (permalink / raw)
  To: help-gnu-emacs


I don't exactly know. First thing I see is that autoconf.el
claims the autoconf-mode.el appears to be for Autoconf M4 sources
while autoconf-mode.el suggests the user to register
it to auto-mode-alist for configure.ac/configure.in

It would be great to clarify that and reduce duplicate work
if possible.
Would it make sense to crosspost this thread to them?

That the autoconf-mode from autoconf-mode.el didn't work for recent
Emacs seems to be because of the way it's activated in the autoconf-mode
function, I don't know exactly why but changing it to use
define-derived-mode fixed the issue for me, it should have used the
function in any case I think.



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

* Re: autoconf-mode fontification
  2024-11-28  9:42 ` Björn Bidar
@ 2024-11-28 11:54   ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2024-11-28 11:54 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Björn Bidar <bjorn.bidar@thaodan.de>
> Date: Thu, 28 Nov 2024 11:42:49 +0200
> 
> 
> I don't exactly know. First thing I see is that autoconf.el
> claims the autoconf-mode.el appears to be for Autoconf M4 sources
> while autoconf-mode.el suggests the user to register
> it to auto-mode-alist for configure.ac/configure.in
> 
> It would be great to clarify that and reduce duplicate work
> if possible.
> Would it make sense to crosspost this thread to them?

It is better to post to their list directly.  There's no reason to
cross-post to this list, since this is for helping Emacs users, not
for discussing bugs or new features.

But it's your call.



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

end of thread, other threads:[~2024-11-28 11:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-24 17:42 autoconf-mode fontification Björn Bidar
     [not found] <87iksc7cle.fsf@>
2024-11-24 17:59 ` Arsen Arsenović
2024-11-24 18:52 ` Eli Zaretskii
2024-11-27 22:55   ` Björn Bidar
     [not found]   ` <874j3s70df.fsf@>
2024-11-27 23:33     ` Björn Bidar
     [not found]   ` <87y1145k1c.fsf@>
2024-11-28  7:32     ` Eli Zaretskii
2024-11-28  9:42 ` Björn Bidar
2024-11-28 11:54   ` Eli Zaretskii

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).