bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#54704: [PATCH] 29.0.50; Broken code assistance for Scheme libraries


From: Rudolf Adamkovič
Subject: bug#54704: [PATCH] 29.0.50; Broken code assistance for Scheme libraries
Date: Tue, 27 Dec 2022 01:48:34 +0100

Eli Zaretskii <eliz@gnu.org> writes:

> Thanks.

Thank you!

> I'd like to install this on the emacs-29 branch, so could you please
> rebase the patch on top of emacs-29 and resubmit?

Please see the attached file.

Rudy

>From 8d3a6f2c384af04a4ae03e9d08bb183da14bf364 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                 | 13 +++++++++++++
 lisp/files.el            |  2 +-
 lisp/progmodes/scheme.el | 20 +++++++++++++-------
 3 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 5b804b82b7..c64db9973d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3055,6 +3055,19 @@ name.
 This key is now bound to 'Buffer-menu-view-other-window', which will
 view this line's buffer in View mode in another window.
 
+** 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').
+
 
 * New Modes and Packages in Emacs 29.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

-- 
"'Contrariwise,' continued Tweedledee, 'if it was so, it might be; and
if it were so, it would be; but as it isn't, it ain't.  That's logic.'"
-- Lewis Carroll, Through the Looking Glass, 1871/1872

Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia

reply via email to

[Prev in Thread] Current Thread [Next in Thread]