unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50674: Major mode for etc/AUTHORS with basic font-locking
@ 2021-09-19 14:12 Stefan Kangas
  2021-09-19 15:19 ` Lars Ingebrigtsen
                   ` (3 more replies)
  0 siblings, 4 replies; 29+ messages in thread
From: Stefan Kangas @ 2021-09-19 14:12 UTC (permalink / raw)
  To: 50674

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

Severity: wishlist

Please find attached a small visual improvement for the splash screen,
or rather the AUTHORS file that is reachable from the splash screen.
It comes in the form of a major mode for etc/AUTHORS that has some basic
font-locking and nothing else.

The motivation for this is basically that I have clicked the "AUTHORS"
button on the splash screen and found the file thus reached to be a bit
bare-bone visually.  (It's just a text file.)  Other software tend to
have a bit more formatting, and it's nice to show off in this small way
that Emacs has such capabilities as well.

We could of course live without it, but there's not much reason to.

[-- Attachment #2: 0001-New-major-mode-with-font-locking-for-etc-AUTHORS.patch --]
[-- Type: text/x-diff, Size: 4515 bytes --]

From 3ae76791e43b6bdd0af8934059471c5ab62c8521 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Sun, 19 Sep 2021 15:46:44 +0200
Subject: [PATCH] New major mode with font-locking for etc/AUTHORS

* lisp/textmodes/etc-authors-mode.el: New file.
* lisp/files.el (auto-mode-alist): Use 'etc-authors-mode' for the
etc/AUTHORS file.
---
 lisp/files.el                      |  3 +-
 lisp/textmodes/etc-authors-mode.el | 80 ++++++++++++++++++++++++++++++
 2 files changed, 82 insertions(+), 1 deletion(-)
 create mode 100644 lisp/textmodes/etc-authors-mode.el

diff --git a/lisp/files.el b/lisp/files.el
index b113ff32f2..171b69e01e 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3006,7 +3006,8 @@ auto-mode-alist
      ("\\.xcf\\'" . image-mode)
      ("\\.xmp\\'" . image-mode)
      ("\\.xwd\\'" . image-mode)
-     ("\\.yuv\\'" . image-mode)))
+     ("\\.yuv\\'" . image-mode)
+     ("emacs.*/etc/AUTHORS\\'" . etc-authors-mode)))
   "Alist of file name patterns vs corresponding major mode functions.
 Each element looks like (REGEXP . FUNCTION) or (REGEXP FUNCTION NON-NIL).
 \(NON-NIL stands for anything that is not nil; the value does not matter.)
diff --git a/lisp/textmodes/etc-authors-mode.el b/lisp/textmodes/etc-authors-mode.el
new file mode 100644
index 0000000000..36312745a0
--- /dev/null
+++ b/lisp/textmodes/etc-authors-mode.el
@@ -0,0 +1,80 @@
+;;; etc-authors-mode.el --- font-locking for etc/AUTHORS  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021 Free Software Foundation, Inc.
+
+;; Author: Stefan Kangas <stefan@marxist.se>
+;; Keywords: internal
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Major mode to display the etc/AUTHORS file in the Emacs
+;; distribution.  Provides some basic font locking and not much else.
+
+;;; Code:
+
+(defgroup etc-authors-mode nil
+  "Display the etc/AUTHORS file in the Emacs distribution."
+  :version "28.1")
+
+(defface etc-authors-default '((t :inherit variable-pitch))
+  "Default face used in `etc-authors-mode'."
+  :version "28.1")
+
+(defface etc-authors-author '((t :weight bold :height 1.05
+                                   :inherit variable-pitch))
+  "Face used for the author in `etc-authors-mode'."
+  :version "28.1")
+
+(defface etc-authors-descriptor '((t :foreground "gray30" :italic nil
+                                       :inherit variable-pitch))
+  "Face used for the author in `etc-authors-mode'."
+  :version "28.1")
+
+(defface etc-authors-other-files '((t :inherit etc-authors-descriptor))
+  "Face used for other files in `etc-authors-mode'."
+  :version "28.1")
+
+(defvar etc-authors-mode-font-lock-keywords
+  `((,(rx bol (group (not (any blank "\n")) (+? (not (any ":" "\n")))) ":")
+     1 'etc-authors-author)
+    (,(rx (or "wrote"
+              (seq (? "and ") (or "co-wrote" "changed"))))
+     0 'etc-authors-descriptor)
+    (,(rx "and " (+ digit) " other files")
+     0 'etc-authors-other-files)
+    (,(rx bol (not space) (+ not-newline) eol)
+     0 'etc-authors-default)))
+
+(defun etc-authors-mode--hide-local-variables ()
+  "Hide local variables in \"etc/AUTHORS\"."
+  (narrow-to-region (point-min)
+                    (save-excursion
+                      (goto-char (point-min))
+                      (if (re-search-forward "^Local Variables:$" nil t)
+                          (progn (forward-line -1) (point))
+                        (point-max)))))
+
+;;;###autoload
+(define-derived-mode etc-authors-mode special-mode "Authors View"
+  "Major mode for viewing \"etc/AUTHORS\" from the Emacs distribution.
+Provides some basic font locking and not much else."
+  (setq-local font-lock-defaults
+              '(etc-authors-mode-font-lock-keywords nil nil ((?_ . "w"))))
+  (setq font-lock-multiline nil)
+  (etc-authors-mode--hide-local-variables))
+
+(provide 'etc-authors-mode)
+;;; etc-authors-mode.el ends here
-- 
2.30.2


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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-19 14:12 bug#50674: Major mode for etc/AUTHORS with basic font-locking Stefan Kangas
@ 2021-09-19 15:19 ` Lars Ingebrigtsen
  2021-09-19 16:25 ` Eli Zaretskii
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 29+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-19 15:19 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 50674

Stefan Kangas <stefan@marxist.se> writes:

> The motivation for this is basically that I have clicked the "AUTHORS"
> button on the splash screen and found the file thus reached to be a bit
> bare-bone visually.  (It's just a text file.)  Other software tend to
> have a bit more formatting, and it's nice to show off in this small way
> that Emacs has such capabilities as well.

Looks very nice, I think.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-19 14:12 bug#50674: Major mode for etc/AUTHORS with basic font-locking Stefan Kangas
  2021-09-19 15:19 ` Lars Ingebrigtsen
@ 2021-09-19 16:25 ` Eli Zaretskii
  2021-09-19 21:58   ` Stefan Kangas
  2021-09-19 16:33 ` Juri Linkov
  2021-09-21 17:28 ` Juri Linkov
  3 siblings, 1 reply; 29+ messages in thread
From: Eli Zaretskii @ 2021-09-19 16:25 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 50674

> From: Stefan Kangas <stefan@marxist.se>
> Date: Sun, 19 Sep 2021 07:12:40 -0700
> 
> Please find attached a small visual improvement for the splash screen,
> or rather the AUTHORS file that is reachable from the splash screen.
> It comes in the form of a major mode for etc/AUTHORS that has some basic
> font-locking and nothing else.

Thanks, LGTM.

Did you try these faces on TTY frames, in particular those with 8 or
16 colors?  I think those will need separate face definitions.

> +(defgroup etc-authors-mode nil
> +  "Display the etc/AUTHORS file in the Emacs distribution."

If we only intend this to be used for our etc/AUTHORS, then how about
saying that explicitly in the other doc strings, instead of
referencing etc-authors-mode?





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-19 14:12 bug#50674: Major mode for etc/AUTHORS with basic font-locking Stefan Kangas
  2021-09-19 15:19 ` Lars Ingebrigtsen
  2021-09-19 16:25 ` Eli Zaretskii
@ 2021-09-19 16:33 ` Juri Linkov
  2021-09-19 17:38   ` Stefan Kangas
  2021-09-21 17:28 ` Juri Linkov
  3 siblings, 1 reply; 29+ messages in thread
From: Juri Linkov @ 2021-09-19 16:33 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 50674

> +;;;###autoload
> +(define-derived-mode etc-authors-mode special-mode "Authors View"
> +  "Major mode for viewing \"etc/AUTHORS\" from the Emacs distribution.
> +Provides some basic font locking and not much else."
> +  (setq-local font-lock-defaults
> +              '(etc-authors-mode-font-lock-keywords nil nil ((?_ . "w"))))
> +  (setq font-lock-multiline nil)
> +  (etc-authors-mode--hide-local-variables))

Isn't generic-x.el a more suitable place for such small modes?





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-19 16:33 ` Juri Linkov
@ 2021-09-19 17:38   ` Stefan Kangas
  2021-09-20  6:41     ` Juri Linkov
  0 siblings, 1 reply; 29+ messages in thread
From: Stefan Kangas @ 2021-09-19 17:38 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 50674

Juri Linkov <juri@linkov.net> writes:

>> +;;;###autoload
>> +(define-derived-mode etc-authors-mode special-mode "Authors View"
>> +  "Major mode for viewing \"etc/AUTHORS\" from the Emacs distribution.
>> +Provides some basic font locking and not much else."
>> +  (setq-local font-lock-defaults
>> +              '(etc-authors-mode-font-lock-keywords nil nil ((?_ . "w"))))
>> +  (setq font-lock-multiline nil)
>> +  (etc-authors-mode--hide-local-variables))
>
> Isn't generic-x.el a more suitable place for such small modes?

The problem I see is that this does not use `define-generic-mode',
unlike the other modes in there, and also I'm not sure it makes sense to
drop autoloaded functions in there.  AFAIU, that file and its modes is
supposed to be optional (not that I agree that they should be).





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-19 16:25 ` Eli Zaretskii
@ 2021-09-19 21:58   ` Stefan Kangas
  2021-09-21 19:54     ` Stefan Kangas
  0 siblings, 1 reply; 29+ messages in thread
From: Stefan Kangas @ 2021-09-19 21:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 50674

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

Eli Zaretskii <eliz@gnu.org> writes:

> Did you try these faces on TTY frames, in particular those with 8 or
> 16 colors?  I think those will need separate face definitions.

I've updated the face definitions to check for such capabilities, and
tested it in xterm (256 colors) and the Linux console (8 colors
according to `display-color-cells').  It looks good with my pair of
eyes, but I sometimes have a hard time differentiating between certain
colors.

If anyone feels that they are good with colors, feel free to suggest
something better.

I've attached a new patch.

> If we only intend this to be used for our etc/AUTHORS, then how about
> saying that explicitly in the other doc strings, instead of
> referencing etc-authors-mode?

Yes, that makes sense, changed in the attached.

Thanks for reviewing this.

[-- Attachment #2: 0001-New-major-mode-with-font-locking-for-etc-AUTHORS.patch --]
[-- Type: text/x-diff, Size: 5570 bytes --]

From 18d00dd62f71be36e0c19bfde25e7a31649ed3bf Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Sun, 19 Sep 2021 15:46:44 +0200
Subject: [PATCH] New major mode with font-locking for etc/AUTHORS

* lisp/textmodes/etc-authors-mode.el: New file.
* lisp/files.el (auto-mode-alist): Use 'etc-authors-mode' for the
etc/AUTHORS file.
---
 lisp/files.el                      |  3 +-
 lisp/textmodes/etc-authors-mode.el | 99 ++++++++++++++++++++++++++++++
 2 files changed, 101 insertions(+), 1 deletion(-)
 create mode 100644 lisp/textmodes/etc-authors-mode.el

diff --git a/lisp/files.el b/lisp/files.el
index b113ff32f2..171b69e01e 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3006,7 +3006,8 @@ auto-mode-alist
      ("\\.xcf\\'" . image-mode)
      ("\\.xmp\\'" . image-mode)
      ("\\.xwd\\'" . image-mode)
-     ("\\.yuv\\'" . image-mode)))
+     ("\\.yuv\\'" . image-mode)
+     ("emacs.*/etc/AUTHORS\\'" . etc-authors-mode)))
   "Alist of file name patterns vs corresponding major mode functions.
 Each element looks like (REGEXP . FUNCTION) or (REGEXP FUNCTION NON-NIL).
 \(NON-NIL stands for anything that is not nil; the value does not matter.)
diff --git a/lisp/textmodes/etc-authors-mode.el b/lisp/textmodes/etc-authors-mode.el
new file mode 100644
index 0000000000..0ef84d3d65
--- /dev/null
+++ b/lisp/textmodes/etc-authors-mode.el
@@ -0,0 +1,99 @@
+;;; etc-authors-mode.el --- font-locking for etc/AUTHORS  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021 Free Software Foundation, Inc.
+
+;; Author: Stefan Kangas <stefan@marxist.se>
+;; Keywords: internal
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Major mode to display the etc/AUTHORS file in the Emacs
+;; distribution.  Provides some basic font locking and not much else.
+
+;;; Code:
+
+(defgroup etc-authors-mode nil
+  "Display the \"etc/AUTHORS\" file from the Emacs distribution."
+  :version "28.1")
+
+(defface etc-authors-default '((t :inherit variable-pitch))
+  "Default face used to display the \"etc/AUTHORS\" file.
+See also `etc-authors-mode'."
+  :version "28.1")
+
+(defface etc-authors-author '((((class color) (min-colors 88) (background light))
+                    :foreground "midnight blue"
+                    :weight bold :height 1.05
+                    :inherit variable-pitch)
+                   (((class color) (min-colors 88) (background dark))
+                    :foreground "cyan"
+                    :weight bold :height 1.05
+                    :inherit variable-pitch)
+                   (((supports :weight bold) (supports :height 1.05))
+                    :weight bold :height 1.05
+                    :inherit variable-pitch)
+                   (((supports :weight bold))
+                    :weight bold :inherit variable-pitch)
+                   (t :inherit variable-pitch))
+  "Face used for the author in the \"etc/AUTHORS\" file.
+See also `etc-authors-mode'."
+  :version "28.1")
+
+(defface etc-authors-descriptor '((((class color) (min-colors 88) (background light))
+                        :foreground "sienna" :inherit variable-pitch)
+                       (((class color) (min-colors 88) (background dark))
+                        :foreground "peru" :inherit variable-pitch)
+                       (t :inherit variable-pitch))
+  "Face used for the description text in the \"etc/AUTHORS\" file.
+See also `etc-authors-mode'."
+  :version "28.1")
+
+(defface etc-authors-other-files '((t :inherit etc-authors-descriptor))
+  "Face used for the \"other files\" text in the \"etc/AUTHORS\" file.
+See also `etc-authors-mode'."
+  :version "28.1")
+
+(defvar etc-authors-mode-font-lock-keywords
+  `((,(rx bol (group (not (any blank "\n")) (+? (not (any ":" "\n")))) ":")
+     1 'etc-authors-author)
+    (,(rx (or "wrote"
+              (seq (? "and ") (or "co-wrote" "changed"))))
+     0 'etc-authors-descriptor)
+    (,(rx "and " (+ digit) " other files")
+     0 'etc-authors-other-files)
+    (,(rx bol (not space) (+ not-newline) eol)
+     0 'etc-authors-default)))
+
+(defun etc-authors-mode--hide-local-variables ()
+  "Hide local variables in \"etc/AUTHORS\".  Used by `etc-authors-mode'."
+  (narrow-to-region (point-min)
+                    (save-excursion
+                      (goto-char (point-min))
+                      (if (re-search-forward "^Local Variables:$" nil t)
+                          (progn (forward-line -1) (point))
+                        (point-max)))))
+
+;;;###autoload
+(define-derived-mode etc-authors-mode special-mode "Authors View"
+  "Major mode for viewing \"etc/AUTHORS\" from the Emacs distribution.
+Provides some basic font locking and not much else."
+  (setq-local font-lock-defaults
+              '(etc-authors-mode-font-lock-keywords nil nil ((?_ . "w"))))
+  (setq font-lock-multiline nil)
+  (etc-authors-mode--hide-local-variables))
+
+(provide 'etc-authors-mode)
+;;; etc-authors-mode.el ends here
-- 
2.30.2


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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-19 17:38   ` Stefan Kangas
@ 2021-09-20  6:41     ` Juri Linkov
  2021-09-20  7:42       ` Stefan Kangas
  0 siblings, 1 reply; 29+ messages in thread
From: Juri Linkov @ 2021-09-20  6:41 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 50674

>> Isn't generic-x.el a more suitable place for such small modes?
>
> The problem I see is that this does not use `define-generic-mode',
> unlike the other modes in there, and also I'm not sure it makes sense to
> drop autoloaded functions in there.  AFAIU, that file and its modes is
> supposed to be optional (not that I agree that they should be).

I really see no difference from etc-authors-mode and e.g.
etc-fstab-generic-mode defined in generic-x.el by define-generic-mode.
And still it can be autoloaded like c++-mode-syntax-table used to be autoloaded.





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-20  6:41     ` Juri Linkov
@ 2021-09-20  7:42       ` Stefan Kangas
  2021-09-20  9:14         ` Stefan Kangas
  0 siblings, 1 reply; 29+ messages in thread
From: Stefan Kangas @ 2021-09-20  7:42 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 50674

Juri Linkov <juri@linkov.net> writes:

> I really see no difference from etc-authors-mode and e.g.
> etc-fstab-generic-mode defined in generic-x.el by define-generic-mode.
> And still it can be autoloaded like c++-mode-syntax-table used to be autoloaded.

That means that a user will see font-locking in some files, only if she
has first visited AUTHORS.  In a subsequent Emacs session, the user will
be surprised to see that the font-locking is no longer there.

IOW, I can agree to put it in generic-x.el, but only if we autoload some
other modes in there.  Such as the fstab mode.  Otherwise this makes no
sense to me.

A natural first step would be to make those modes load unconditionally,
but that proposal has been rejected; see my last two commits to
generic-x.el.  Perhaps it will be okay to load only some of the modes
unconditionally.

This would also have to be coupled with the necessary documentation
changes to generic-x.el, to explain that this file is not only about
`define-generic-mode'.

Personally, I'd rather create a new file for small modes than go down
this rabbit hole.  generic-x.el is hardly the best library name or
location.





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-20  7:42       ` Stefan Kangas
@ 2021-09-20  9:14         ` Stefan Kangas
  2021-09-20 15:24           ` Juri Linkov
  0 siblings, 1 reply; 29+ messages in thread
From: Stefan Kangas @ 2021-09-20  9:14 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 50674

Stefan Kangas <stefan@marxist.se>:

> Personally, I'd rather create a new file for small modes than go down
> this rabbit hole.  generic-x.el is hardly the best library name or
> location.

Thinking about this a bit more, what is the problem with just keeping
this in its own file?  It is fairly self-contained and not really
related to anything else.  If the worry is that it will clutter
lisp/textmodes, perhaps we could add a new directory where such
"small" modes could go.

In general, I'm not a fan of mega-files with many bits and pieces in
them -- see for example time.el that for some reason contains both
'display-time' and 'world-clock'.  The latter could easily be in its
own file instead, and from working in that file I can say that it
would have been easier to understand and modify if it was.  ("Large"
files is a common practice in ELisp, but not in many other programming
languages AFAIK.)





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-20  9:14         ` Stefan Kangas
@ 2021-09-20 15:24           ` Juri Linkov
  2021-09-21  6:12             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 29+ messages in thread
From: Juri Linkov @ 2021-09-20 15:24 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 50674

> Thinking about this a bit more, what is the problem with just keeping
> this in its own file?  It is fairly self-contained and not really
> related to anything else.  If the worry is that it will clutter
> lisp/textmodes, perhaps we could add a new directory where such
> "small" modes could go.

It really will clutter lisp/textmodes.  For the same reasoning
all modes in generic-x.el should be moved to separate files
that makes no sense.

So the current situation is following: we have generic-x.el for such
small modes like etc-passwd-generic-mode and etc-authors-mode.
But the problem is that modes in generic-x.el are not autoloaded.
I don't understand why visiting /etc/passwd doesn't highlight it
properly when etc-passwd-generic-mode is available for this file?
But I see no problem to autoload all available modes from generic-x.el.

> A natural first step would be to make those modes load unconditionally,
> but that proposal has been rejected; see my last two commits to
> generic-x.el.  Perhaps it will be okay to load only some of the modes
> unconditionally.

I agree that only some should be loaded unconditionally.  For example,
we should not use modes for filename regexps that are not specific,
such as '("alias\\'") and '("inventory\\'") that has too wide coverage
to produce false matches.  OTOH, autoloaded modes should be enabled
by default for "/etc/passwd", "/etc/fstab", "emacs.*/etc/AUTHORS\\'"
that has no problem of mismatching.





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-20 15:24           ` Juri Linkov
@ 2021-09-21  6:12             ` Lars Ingebrigtsen
  2021-09-21  6:25               ` Eli Zaretskii
  2021-09-21  8:28               ` Stefan Kangas
  0 siblings, 2 replies; 29+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-21  6:12 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 50674, Stefan Kangas

Juri Linkov <juri@linkov.net> writes:

>> If the worry is that it will clutter
>> lisp/textmodes, perhaps we could add a new directory where such
>> "small" modes could go.
>
> It really will clutter lisp/textmodes.

I'd prefer to have it as a separate file.  However, it is a really,
really specialised mode -- for one single Emacs file -- so perhaps it
would make sense to create a specific sub-directory for it (and similar
things that are kinda meta-Emacsey).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-21  6:12             ` Lars Ingebrigtsen
@ 2021-09-21  6:25               ` Eli Zaretskii
  2021-09-21  6:28                 ` Lars Ingebrigtsen
  2021-09-21  8:28               ` Stefan Kangas
  1 sibling, 1 reply; 29+ messages in thread
From: Eli Zaretskii @ 2021-09-21  6:25 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 50674, stefan, juri

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Tue, 21 Sep 2021 08:12:04 +0200
> Cc: 50674@debbugs.gnu.org, Stefan Kangas <stefan@marxist.se>
> 
> Juri Linkov <juri@linkov.net> writes:
> 
> >> If the worry is that it will clutter
> >> lisp/textmodes, perhaps we could add a new directory where such
> >> "small" modes could go.
> >
> > It really will clutter lisp/textmodes.
> 
> I'd prefer to have it as a separate file.  However, it is a really,
> really specialised mode -- for one single Emacs file -- so perhaps it
> would make sense to create a specific sub-directory for it (and similar
> things that are kinda meta-Emacsey).

That directory is 'admin', I think.





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-21  6:25               ` Eli Zaretskii
@ 2021-09-21  6:28                 ` Lars Ingebrigtsen
  2021-09-21  7:57                   ` Stefan Kangas
  2021-09-21  8:36                   ` Eli Zaretskii
  0 siblings, 2 replies; 29+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-21  6:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 50674, stefan, juri

Eli Zaretskii <eliz@gnu.org> writes:

> That directory is 'admin', I think.

I thought that wasn't included in the distributions?  Hm...  no, doesn't
look like it -- Debian includes lisp and etc in /usr/share/emacs/27.1,
for instance.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-21  6:28                 ` Lars Ingebrigtsen
@ 2021-09-21  7:57                   ` Stefan Kangas
  2021-09-21  8:36                   ` Eli Zaretskii
  1 sibling, 0 replies; 29+ messages in thread
From: Stefan Kangas @ 2021-09-21  7:57 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Eli Zaretskii; +Cc: 50674, juri

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>> That directory is 'admin', I think.
>
> I thought that wasn't included in the distributions?  Hm...  no, doesn't
> look like it -- Debian includes lisp and etc in /usr/share/emacs/27.1,
> for instance.

But it's not in `load-path', AFAICT.





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-21  6:12             ` Lars Ingebrigtsen
  2021-09-21  6:25               ` Eli Zaretskii
@ 2021-09-21  8:28               ` Stefan Kangas
  2021-09-21 16:51                 ` Lars Ingebrigtsen
  2021-09-21 17:56                 ` Lars Ingebrigtsen
  1 sibling, 2 replies; 29+ messages in thread
From: Stefan Kangas @ 2021-09-21  8:28 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Juri Linkov; +Cc: 50674

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Juri Linkov <juri@linkov.net> writes:
>
>>> If the worry is that it will clutter
>>> lisp/textmodes, perhaps we could add a new directory where such
>>> "small" modes could go.
>>
>> It really will clutter lisp/textmodes.
>
> I'd prefer to have it as a separate file.

Same.

> However, it is a really, really specialised mode -- for one single
> Emacs file -- so perhaps it would make sense to create a specific
> sub-directory for it (and similar things that are kinda meta-Emacsey).

Yes, we could add a new directory.

It seems to me that very few things would be in a directory for
meta-Emacsey things.  The only other file I could think to add
font-locking for is COPYING and perhaps DISTRIB (as those are reachable
from the splash-screen).  Maybe the tutorial could use some font-locking
as well, but we could put that in tutorial.el.

Another idea is to add, on the same level as progmodes and textmodes, a
new directory "display-modes", in which we would put modes that are not
really meant for editing.  I can see several modes that would in
principle fit in such a directory: help-mode, tabulated-list-mode,
world-clock, etc.  (There would be no immediate need to move anything,
however.)

Or, you know, we just live with having it in textmodes.  I don't think
it's too bad, all things considered.  We are talking of a very small
number of files here, and it's not like we add new textmodes every week.
Worst case, we move it later; it's small enough that convenient access
to its git history is probably not even a concern.





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-21  6:28                 ` Lars Ingebrigtsen
  2021-09-21  7:57                   ` Stefan Kangas
@ 2021-09-21  8:36                   ` Eli Zaretskii
  2021-09-21  8:58                     ` Stefan Kangas
  1 sibling, 1 reply; 29+ messages in thread
From: Eli Zaretskii @ 2021-09-21  8:36 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 50674, stefan, juri

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: juri@linkov.net,  50674@debbugs.gnu.org,  stefan@marxist.se
> Date: Tue, 21 Sep 2021 08:28:10 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > That directory is 'admin', I think.
> 
> I thought that wasn't included in the distributions?  Hm...  no, doesn't
> look like it -- Debian includes lisp and etc in /usr/share/emacs/27.1,
> for instance.

You mean, binary distributions?  Do we care?  Do users of binary
distributions read the AUTHORS file?






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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-21  8:36                   ` Eli Zaretskii
@ 2021-09-21  8:58                     ` Stefan Kangas
  2021-09-21  9:24                       ` Eli Zaretskii
  0 siblings, 1 reply; 29+ messages in thread
From: Stefan Kangas @ 2021-09-21  8:58 UTC (permalink / raw)
  To: Eli Zaretskii, Lars Ingebrigtsen; +Cc: 50674, juri

Eli Zaretskii <eliz@gnu.org> writes:

> You mean, binary distributions?  Do we care?  Do users of binary
> distributions read the AUTHORS file?

It is reachable from the splash screen, so yes.





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-21  8:58                     ` Stefan Kangas
@ 2021-09-21  9:24                       ` Eli Zaretskii
  2021-09-21 11:18                         ` Stefan Kangas
  0 siblings, 1 reply; 29+ messages in thread
From: Eli Zaretskii @ 2021-09-21  9:24 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 50674, larsi, juri

> From: Stefan Kangas <stefan@marxist.se>
> Date: Tue, 21 Sep 2021 01:58:58 -0700
> Cc: juri@linkov.net, 50674@debbugs.gnu.org
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > You mean, binary distributions?  Do we care?  Do users of binary
> > distributions read the AUTHORS file?
> 
> It is reachable from the splash screen, so yes.

The splash screen button could load the file from any place we want,
so if that is the problem, I don't understand all the sub-thread about
where to put the file.  E.g., we could put it in etc/.





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-21  9:24                       ` Eli Zaretskii
@ 2021-09-21 11:18                         ` Stefan Kangas
  2021-09-21 11:25                           ` Eli Zaretskii
  0 siblings, 1 reply; 29+ messages in thread
From: Stefan Kangas @ 2021-09-21 11:18 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 50674, Lars Ingebrigtsen, Juri Linkov

Eli Zaretskii <eliz@gnu.org> writes:

> The splash screen button could load the file from any place we want,
> so if that is the problem, I don't understand all the sub-thread about
> where to put the file.  E.g., we could put it in etc/.

I'm also not sure what problem this are trying to solve, indeed.
IIUC, it is that "lisp/textmodes" is too cluttered, or something?

If we put it outside of 'load-path' we can't put it in
'auto-mode-alist', and you can't just M-x etc-authors-mode, etc.





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-21 11:18                         ` Stefan Kangas
@ 2021-09-21 11:25                           ` Eli Zaretskii
  0 siblings, 0 replies; 29+ messages in thread
From: Eli Zaretskii @ 2021-09-21 11:25 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 50674, larsi, juri

> From: Stefan Kangas <stefan@marxist.se>
> Date: Tue, 21 Sep 2021 13:18:02 +0200
> Cc: Lars Ingebrigtsen <larsi@gnus.org>, Juri Linkov <juri@linkov.net>, 50674@debbugs.gnu.org
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > The splash screen button could load the file from any place we want,
> > so if that is the problem, I don't understand all the sub-thread about
> > where to put the file.  E.g., we could put it in etc/.
> 
> I'm also not sure what problem this are trying to solve, indeed.
> IIUC, it is that "lisp/textmodes" is too cluttered, or something?

Doesn't sound like a problem to me.

> If we put it outside of 'load-path' we can't put it in
> 'auto-mode-alist', and you can't just M-x etc-authors-mode, etc.

Indeed.





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-21  8:28               ` Stefan Kangas
@ 2021-09-21 16:51                 ` Lars Ingebrigtsen
  2021-09-21 17:56                 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 29+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-21 16:51 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 50674, Juri Linkov

Stefan Kangas <stefan@marxist.se> writes:

> Or, you know, we just live with having it in textmodes.  I don't think
> it's too bad, all things considered.  We are talking of a very small
> number of files here, and it's not like we add new textmodes every week.
> Worst case, we move it later; it's small enough that convenient access
> to its git history is probably not even a concern.

Yeah, I'm fine with putting it in textmodes.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-19 14:12 bug#50674: Major mode for etc/AUTHORS with basic font-locking Stefan Kangas
                   ` (2 preceding siblings ...)
  2021-09-19 16:33 ` Juri Linkov
@ 2021-09-21 17:28 ` Juri Linkov
  2021-09-21 18:33   ` Stefan Kangas
  3 siblings, 1 reply; 29+ messages in thread
From: Juri Linkov @ 2021-09-21 17:28 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 50674

> diff --git a/lisp/files.el b/lisp/files.el
> index b113ff32f2..171b69e01e 100644
> --- a/lisp/files.el
> +++ b/lisp/files.el
> @@ -3006,7 +3006,8 @@ auto-mode-alist
>       ("\\.xcf\\'" . image-mode)
>       ("\\.xmp\\'" . image-mode)
>       ("\\.xwd\\'" . image-mode)
> -     ("\\.yuv\\'" . image-mode)))
> +     ("\\.yuv\\'" . image-mode)
> +     ("emacs.*/etc/AUTHORS\\'" . etc-authors-mode)))

I think cluttering auto-mode-alist is worse than cluttering lisp/textmodes
because you can add ‘mode: etc-authors’ to Local Variables of etc/AUTHORS.





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-21  8:28               ` Stefan Kangas
  2021-09-21 16:51                 ` Lars Ingebrigtsen
@ 2021-09-21 17:56                 ` Lars Ingebrigtsen
  2021-09-21 18:33                   ` Stefan Kangas
  1 sibling, 1 reply; 29+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-21 17:56 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 50674, Juri Linkov

Stefan Kangas <stefan@marxist.se> writes:

> It seems to me that very few things would be in a directory for
> meta-Emacsey things.  The only other file I could think to add
> font-locking for is COPYING and perhaps DISTRIB (as those are reachable
> from the splash-screen).

I thought of another one -- NEWS should really have its own major mode
to make it easier to edit.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-21 17:28 ` Juri Linkov
@ 2021-09-21 18:33   ` Stefan Kangas
  0 siblings, 0 replies; 29+ messages in thread
From: Stefan Kangas @ 2021-09-21 18:33 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 50674

Juri Linkov <juri@linkov.net> writes:

> I think cluttering auto-mode-alist is worse than cluttering lisp/textmodes
> because you can add ‘mode: etc-authors’ to Local Variables of etc/AUTHORS.

That's a very good point.  I'll change that part.





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-21 17:56                 ` Lars Ingebrigtsen
@ 2021-09-21 18:33                   ` Stefan Kangas
  2021-09-21 18:41                     ` Juri Linkov
  0 siblings, 1 reply; 29+ messages in thread
From: Stefan Kangas @ 2021-09-21 18:33 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 50674, Juri Linkov

Lars Ingebrigtsen <larsi@gnus.org> writes:

> I thought of another one -- NEWS should really have its own major mode
> to make it easier to edit.

Indeed.  In comparison to the others, such a mode wouldn't (or
shouldn't) be purely cosmetic.





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-21 18:33                   ` Stefan Kangas
@ 2021-09-21 18:41                     ` Juri Linkov
  2021-09-21 18:56                       ` Eli Zaretskii
  2021-09-21 19:22                       ` Stefan Kangas
  0 siblings, 2 replies; 29+ messages in thread
From: Juri Linkov @ 2021-09-21 18:41 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 50674, Lars Ingebrigtsen

>> I thought of another one -- NEWS should really have its own major mode
>> to make it easier to edit.
>
> Indeed.  In comparison to the others, such a mode wouldn't (or
> shouldn't) be purely cosmetic.

Gradually it will grow to become a doppelgänger of org-mode.
And this will be the punishment for not using org-mode in NEWS :-)





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-21 18:41                     ` Juri Linkov
@ 2021-09-21 18:56                       ` Eli Zaretskii
  2021-09-21 19:22                       ` Stefan Kangas
  1 sibling, 0 replies; 29+ messages in thread
From: Eli Zaretskii @ 2021-09-21 18:56 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 50674, larsi, stefan

> From: Juri Linkov <juri@linkov.net>
> Date: Tue, 21 Sep 2021 21:41:43 +0300
> Cc: 50674@debbugs.gnu.org, Lars Ingebrigtsen <larsi@gnus.org>
> 
> >> I thought of another one -- NEWS should really have its own major mode
> >> to make it easier to edit.
> >
> > Indeed.  In comparison to the others, such a mode wouldn't (or
> > shouldn't) be purely cosmetic.
> 
> Gradually it will grow to become a doppelgänger of org-mode.

I don't see why.  We don't need any of the bells-and-whistles of Org
to edit NEWS, but we do need a couple of features that Org doesn't
have, like better support for marking the entries documented, easier
quoting, and a few more.





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-21 18:41                     ` Juri Linkov
  2021-09-21 18:56                       ` Eli Zaretskii
@ 2021-09-21 19:22                       ` Stefan Kangas
  1 sibling, 0 replies; 29+ messages in thread
From: Stefan Kangas @ 2021-09-21 19:22 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 50674, Lars Ingebrigtsen

Juri Linkov <juri@linkov.net> writes:

> Gradually it will grow to become a doppelgänger of org-mode.
> And this will be the punishment for not using org-mode in NEWS :-)

This is the way.





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

* bug#50674: Major mode for etc/AUTHORS with basic font-locking
  2021-09-19 21:58   ` Stefan Kangas
@ 2021-09-21 19:54     ` Stefan Kangas
  0 siblings, 0 replies; 29+ messages in thread
From: Stefan Kangas @ 2021-09-21 19:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 50674

tags 50674 fixed
close 50674 28.1
thanks

Stefan Kangas <stefan@marxist.se> writes:

> I've attached a new patch.

I've pushed this to master as commit 6478ce4a4b with the following
changes:

- Added two commands to go to the previous and next author, bound to "p"
  and "n" respectively.

- As Juri suggested, I removed the entry from `auto-mode-alist' and
  replaced it with a "mode: etc-authors" line in AUTHORS.  That was a
  much cleaner way to do it.

- Some other very minor clean-up, such as putting a :group on the
  defgroup.

- Added a NEWS entry.





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

end of thread, other threads:[~2021-09-21 19:54 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-19 14:12 bug#50674: Major mode for etc/AUTHORS with basic font-locking Stefan Kangas
2021-09-19 15:19 ` Lars Ingebrigtsen
2021-09-19 16:25 ` Eli Zaretskii
2021-09-19 21:58   ` Stefan Kangas
2021-09-21 19:54     ` Stefan Kangas
2021-09-19 16:33 ` Juri Linkov
2021-09-19 17:38   ` Stefan Kangas
2021-09-20  6:41     ` Juri Linkov
2021-09-20  7:42       ` Stefan Kangas
2021-09-20  9:14         ` Stefan Kangas
2021-09-20 15:24           ` Juri Linkov
2021-09-21  6:12             ` Lars Ingebrigtsen
2021-09-21  6:25               ` Eli Zaretskii
2021-09-21  6:28                 ` Lars Ingebrigtsen
2021-09-21  7:57                   ` Stefan Kangas
2021-09-21  8:36                   ` Eli Zaretskii
2021-09-21  8:58                     ` Stefan Kangas
2021-09-21  9:24                       ` Eli Zaretskii
2021-09-21 11:18                         ` Stefan Kangas
2021-09-21 11:25                           ` Eli Zaretskii
2021-09-21  8:28               ` Stefan Kangas
2021-09-21 16:51                 ` Lars Ingebrigtsen
2021-09-21 17:56                 ` Lars Ingebrigtsen
2021-09-21 18:33                   ` Stefan Kangas
2021-09-21 18:41                     ` Juri Linkov
2021-09-21 18:56                       ` Eli Zaretskii
2021-09-21 19:22                       ` Stefan Kangas
2021-09-21 17:28 ` Juri Linkov
2021-09-21 18:33   ` Stefan Kangas

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