unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefankangas@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Michael Heerdegen <michael_heerdegen@web.de>,
	Andrew Goh <andrewgoh95@yahoo.com.sg>,
	41403@debbugs.gnu.org
Subject: bug#41403: A more user-friendly version of GNU Emacs
Date: Tue, 21 Sep 2021 13:13:11 -0700	[thread overview]
Message-ID: <CADwFkmm+euJoRVYFeiZZHYmjefoGDsah=CkuaxyLsKWj-Y1eKA@mail.gmail.com> (raw)
In-Reply-To: <8735q2t3d9.fsf@gnus.org>

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

reopen 41403
tags 41403 - wontfix
thanks

Lars Ingebrigtsen <larsi@gnus.org> writes:

>>     Starting Emacs
>>     To enter GNU Emacs 28, just type its name: emacs
>>
>> This seems useless, for two reasons:
>> A) The overwhelming majority of users will click an icon to start Emacs.
>> B) Any other users will already know to type "emacs".
>
> Yeah, that's pretty useless.
>
>> This leaves me wondering if putting a brief explanation of our strange
>> key conventions on there isn't a better use of space.
>
> That's true.

How about the attached patch?  I've checked it visually and it looks
okay to me, but I'm not exactly a TeX expert.

[-- 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


  reply	other threads:[~2021-09-21 20:13 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1572340523.1158427.1589893725280.ref@mail.yahoo.com>
2020-05-19 13:08 ` bug#41403: A more user-friendly version of GNU Emacs Andrew Goh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-05-19 14:43   ` Stefan Kangas
2020-05-19 22:48     ` Michael Heerdegen
2020-05-19 23:02       ` Stefan Kangas
2021-09-17 16:42         ` Lars Ingebrigtsen
2021-09-17 20:57           ` Stefan Kangas
2021-09-17 22:04             ` Michael Heerdegen
2021-09-18 13:33             ` Lars Ingebrigtsen
2021-09-21 20:13               ` Stefan Kangas [this message]
2021-09-21 20:14                 ` Lars Ingebrigtsen
2021-09-21 23:07                   ` Stefan Kangas
2021-09-21 23:22                     ` Lars Ingebrigtsen
2021-09-22  0:30                       ` Michael Heerdegen
2021-09-22 21:24                         ` Richard Stallman
2021-09-22 21:34                           ` Lars Ingebrigtsen
2021-09-23  6:24                             ` Eli Zaretskii
2021-09-22 14:41                       ` Stefan Kangas
2021-09-22 15:57                         ` Andreas Schwab
2021-09-22 20:00                         ` Lars Ingebrigtsen
2021-09-22 22:28                           ` Stefan Kangas
2021-09-22 21:42                         ` Alan Third
2021-09-22 22:28                           ` Stefan Kangas
     [not found]     ` <1269710845.1235081.1589931944379@mail.yahoo.com>
2020-05-20  0:55       ` Stefan Kangas
     [not found]         ` <919459122.1576791.1589981239406@mail.yahoo.com>
2020-05-20 13:37           ` Stefan Kangas
2021-09-17 18:44   ` Eduardo Ochs
     [not found] <DE284271-933A-4DB1-9D01-2E21F43E6201@acm.org>
2021-09-22 18:01 ` Andreas Schwab
2021-09-22 18:47   ` Mattias Engdegård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADwFkmm+euJoRVYFeiZZHYmjefoGDsah=CkuaxyLsKWj-Y1eKA@mail.gmail.com' \
    --to=stefankangas@gmail.com \
    --cc=41403@debbugs.gnu.org \
    --cc=andrewgoh95@yahoo.com.sg \
    --cc=larsi@gnus.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).