From: "Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 54704@debbugs.gnu.org
Subject: bug#54704: [PATCH] 29.0.50; Broken code assistance for Scheme libraries
Date: Sat, 24 Dec 2022 23:32:21 +0100 [thread overview]
Message-ID: <m2y1qwjuve.fsf@me.com> (raw)
In-Reply-To: <83a63d5765.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1388 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> Please see the attached patch that makes Emacs recognize R6RS/R7RS
>> library files, as well as, makes Emacs recognize their members.
>
> Thanks.
Thank you for your review!
> The "+++" mark means that the manuals have been updated with this
> information. I don't think this is the case, and we don't have any
> manuals for the Scheme mode, right? So this should be "---" instead.
Fixed.
>> +*** Auto-detection of Scheme library files
>
> Heading lines in NEWS should end with a period.
Fixed.
>> +Emacs now automatically enables the Scheme mode for R6RS library
>> +sources ('.sls') and R7RS library definitions ('.sld').
>
> "source files" and "library definition files", right?
Nope. Historically, Scheme has two *standard* library definitions,
incompatible with each other, due to a bit "screwed up" transition from
R5RS to R6RS and then R7RS. While not mandated by the standards R6RS
and R7RS standards, in the wild, these come as:
- Scheme Library Source ('.sls') for R6RS
- Scheme Library Definition ('.sld) for R7RS
However! I see how this can confuse the user, so I reworded both items
in the NEWS file. Importantly, I capitalized the names and put them
right next to their extensions, to tie it all together. Better?
>> ++++
>> +*** Imenu members for R6RS and R7RS library members
>
> Same comments here.
Fixed.
Rudy
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Improve-support-for-Scheme-R6RS-and-R7RS-libraries-b.patch --]
[-- Type: text/x-patch, Size: 4204 bytes --]
From 0cd5b236981fa1dda92fd63da0017ff288fd50b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <salutis@me.com>
Date: Sat, 24 Dec 2022 01:00:32 +0100
Subject: [PATCH] Improve support for Scheme R6RS and R7RS libraries
(bug#54704)
* etc/NEWS (Scheme mode): Document improved file-type auto-detection
and Imenu support for R6RS and R7RS Scheme libraries.
* lisp/files.el (auto-mode-alist): Associate the '.sls' (R6RS Scheme
Library Source) and '.sld' (R7RS Scheme Library Definition) file name
extensions with the Scheme mode.
* lisp/progmodes/scheme.el (scheme-imenu-generic-expression): Make
Imenu recognize the members nested (and so indented) inside of
'library' (R6RS) or 'define-library' (R7RS) forms.
---
etc/NEWS | 14 ++++++++++++++
lisp/files.el | 2 +-
lisp/progmodes/scheme.el | 20 +++++++++++++-------
3 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index af7f1050b7..c121a0dd24 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -93,6 +93,20 @@ This command either fills a single paragraph in a defun, such as a
doc-string, or a comment, or (re)indents the surrounding defun if
point is not in a comment or a string. It is by default bound to
'M-q' in 'prog-mode' and all its descendants.
+
+** Scheme mode
+
+---
+*** Auto-detection of Scheme library files.
+Emacs now automatically enables the Scheme mode when opening R6RS
+Scheme Library Source ('.sls') files and R7RS Scheme Library
+Definition ('.sld') files.
+
+---
+*** Imenu members for R6RS and R7RS library members.
+Imenu now lists the members directly nested in R6RS Scheme libraries
+('library') and R7RS libraries ('define-library').
+
\f
* New Modes and Packages in Emacs 30.1
diff --git a/lisp/files.el b/lisp/files.el
index f352d3a9a7..522e4fbf93 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2850,7 +2850,7 @@ auto-mode-alist
("\\.emacs-places\\'" . lisp-data-mode)
("\\.el\\'" . emacs-lisp-mode)
("Project\\.ede\\'" . emacs-lisp-mode)
- ("\\.\\(scm\\|stk\\|ss\\|sch\\)\\'" . scheme-mode)
+ ("\\.\\(scm\\|sls\\|sld\\|stk\\|ss\\|sch\\)\\'" . scheme-mode)
("\\.l\\'" . lisp-mode)
("\\.li?sp\\'" . lisp-mode)
("\\.[fF]\\'" . fortran-mode)
diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el
index 8454f24356..f45d799252 100644
--- a/lisp/progmodes/scheme.el
+++ b/lisp/progmodes/scheme.el
@@ -115,7 +115,8 @@ 'scheme-mode-abbrev-table
(defvar scheme-imenu-generic-expression
`((nil
- ,(rx bol "(define"
+ ,(rx bol (zero-or-more space)
+ "(define"
(zero-or-one "*")
(zero-or-one "-public")
(one-or-more space)
@@ -123,36 +124,41 @@ scheme-imenu-generic-expression
(group (one-or-more (or word (syntax symbol)))))
1)
("Methods"
- ,(rx bol "(define-"
+ ,(rx bol (zero-or-more space)
+ "(define-"
(or "generic" "method" "accessor")
(one-or-more space)
(zero-or-one "(")
(group (one-or-more (or word (syntax symbol)))))
1)
("Classes"
- ,(rx bol "(define-class"
+ ,(rx bol (zero-or-more space)
+ "(define-class"
(one-or-more space)
(zero-or-one "(")
(group (one-or-more (or word (syntax symbol)))))
1)
("Records"
- ,(rx bol "(define-record-type"
+ ,(rx bol (zero-or-more space)
+ "(define-record-type"
(zero-or-one "*")
(one-or-more space)
(group (one-or-more (or word (syntax symbol)))))
1)
("Conditions"
- ,(rx bol "(define-condition-type"
+ ,(rx bol (zero-or-more space)
+ "(define-condition-type"
(one-or-more space)
(group (one-or-more (or word (syntax symbol)))))
1)
("Modules"
- ,(rx bol "(define-module"
+ ,(rx bol (zero-or-more space)
+ "(define-module"
(one-or-more space)
(group "(" (one-or-more any) ")"))
1)
("Macros"
- ,(rx bol "("
+ ,(rx bol (zero-or-more space) "("
(or (and "defmacro"
(zero-or-one "*")
(zero-or-one "-public"))
--
2.39.0
[-- Attachment #3: Type: text/plain, Size: 257 bytes --]
--
"Logic is a science of the necessary laws of thought, without which no
employment of the understanding and the reason takes place."
-- Immanuel Kant, 1785
Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia
next prev parent reply other threads:[~2022-12-24 22:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-04 5:33 bug#54704: 29.0.50; Broken code assistance for Scheme libraries Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-24 0:31 ` bug#54704: [PATCH] " Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-24 12:15 ` Eli Zaretskii
2022-12-24 22:32 ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-12-26 12:49 ` Eli Zaretskii
2022-12-27 0:48 ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-27 14:00 ` Eli Zaretskii
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=m2y1qwjuve.fsf@me.com \
--to=bug-gnu-emacs@gnu.org \
--cc=54704@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=salutis@me.com \
/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).