--- Begin Message ---
Source: dpkg-dev-el
Severity: wishlist
Tags: patch
Hello.
Some suggestions are attached.
I hope that you will find some of them useful.
Thanks for maintaining this package.
>From 60e55e0eae1f81b5aeeb7b7f5572e2a05d10b4bb Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Fri, 5 Jul 2024 10:47:12 +0200
Subject: [PATCH 01/27] Build-Depend on dh-elpa via the convenient
dh-sequence-elpa
---
debian/control | 2 +-
debian/rules | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/debian/control b/debian/control
index 420a37e..ed8f9d7 100644
--- a/debian/control
+++ b/debian/control
@@ -6,7 +6,7 @@ Uploaders:
David Bremner <[email protected]>,
Xiyue Deng <[email protected]>,
Build-Depends: debhelper-compat (= 13),
- dh-elpa,
+ dh-sequence-elpa,
elpa-debian-el,
Standards-Version: 4.7.0
Homepage: https://salsa.debian.org/emacsen-team/dpkg-dev-el
diff --git a/debian/rules b/debian/rules
index e8e22ba..2d33f6a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,4 +1,4 @@
#!/usr/bin/make -f
%:
- dh $@ --with elpa
+ dh $@
--
2.39.2
>From 0ce37655345048ef5e77f12757c32964086866da Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Fri, 5 Jul 2024 10:51:14 +0200
Subject: [PATCH 02/27] Remove a transition maintainer script older than
oldoldstable
---
debian/dpkg-dev-el.maintscript | 1 -
1 file changed, 1 deletion(-)
delete mode 100644 debian/dpkg-dev-el.maintscript
diff --git a/debian/dpkg-dev-el.maintscript b/debian/dpkg-dev-el.maintscript
deleted file mode 100644
index 4a80e3c..0000000
--- a/debian/dpkg-dev-el.maintscript
+++ /dev/null
@@ -1 +0,0 @@
-rm_conffile /etc/emacs/site-start.d/50dpkg-dev-el.el
--
2.39.2
>From 2632ff216870bfe4209dae28b9a1dc8767039aae Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Fri, 5 Jul 2024 10:54:49 +0200
Subject: [PATCH 03/27] Remove a transitional package older than oldoldstable
---
debian/control | 7 -------
1 file changed, 7 deletions(-)
diff --git a/debian/control b/debian/control
index ed8f9d7..745b8be 100644
--- a/debian/control
+++ b/debian/control
@@ -29,10 +29,3 @@ Description: Emacs helpers specific to Debian development
* debian-control-mode - a helper mode for debian/control files;
* debian-copyright - major mode for Debian package copyright files;
* readme-debian - major mode for editing README.Debian files.
-
-Package: dpkg-dev-el
-Architecture: all
-Depends: ${misc:Depends}, elpa-dpkg-dev-el
-Description: Transition package, dpkg-dev-el to elpa-dpkg-dev-el
- The dpkg-dev-el emacs addon has been elpafied. This dummy package
- helps ease transition from dpkg-dev-el to elpa-dpkg-dev-el.
--
2.39.2
>From 7da14280a6b8578f469bde40df74f5236f2a90ba Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Sun, 21 Jul 2024 10:39:35 +0200
Subject: [PATCH 04/27] Construct the syntax table once when loading the mode
source file
---
debian-autopkgtest-control-mode.el | 15 +++++++--------
debian-control-mode.el | 10 ++++------
debian-copyright.el | 15 +++++++--------
readme-debian.el | 15 ++++++++-------
4 files changed, 26 insertions(+), 29 deletions(-)
diff --git a/debian-autopkgtest-control-mode.el b/debian-autopkgtest-control-mode.el
index f50a353..ef004be 100644
--- a/debian-autopkgtest-control-mode.el
+++ b/debian-autopkgtest-control-mode.el
@@ -46,8 +46,6 @@
(defvar debian-autopkgtest-control-mode-map nil
"Keymap for debian-autopkgtest-control-mode.")
-(defvar debian-autopkgtest-control-mode-syntax-table nil
- "Syntax table for debian-autopkgtest-control-mode.")
(defvar debian-autopkgtest-control-mode-font-lock-keywords nil
"Regexps to highlight in font-lock.")
@@ -94,12 +92,13 @@ https://people.debian.org/~eriberto/README.package-tests.html.")
As defined in the `Depends' section in
https://people.debian.org/~eriberto/README.package-tests.html.")
-(if debian-autopkgtest-control-mode-syntax-table
- () ; Do not change the table if it is already set up.
- (setq debian-autopkgtest-control-mode-syntax-table (make-syntax-table))
- (modify-syntax-entry ?\" ". " debian-autopkgtest-control-mode-syntax-table)
- (modify-syntax-entry ?\\ ". " debian-autopkgtest-control-mode-syntax-table)
- (modify-syntax-entry ?' "w " debian-autopkgtest-control-mode-syntax-table))
+(defvar debian-autopkgtest-control-mode-syntax-table
+ (let ((table (make-syntax-table)))
+ (modify-syntax-entry ?\" ". " table)
+ (modify-syntax-entry ?\\ ". " table)
+ (modify-syntax-entry ?' "w " table)
+ table)
+ "Syntax table for debian-autopkgtest-control-mode.")
(defun debian-autopkgtest-control-mode--font-lock-add-field-keywords (field-names)
"Add font lock for field in FIELD-NAMES."
diff --git a/debian-control-mode.el b/debian-control-mode.el
index 45ff91f..6542392 100644
--- a/debian-control-mode.el
+++ b/debian-control-mode.el
@@ -154,14 +154,12 @@
:type 'face
:group 'debian-control)
-(defvar debian-control-syntax-table nil
+(defvar debian-control-syntax-table
+ (let ((table (make-syntax-table)))
+ (modify-syntax-entry ?\n "> " table)
+ table)
"Syntax table used in debian-control-mode buffers.")
-(if debian-control-syntax-table
- ()
- (setq debian-control-syntax-table (make-syntax-table))
- (modify-syntax-entry ?\n "> " debian-control-syntax-table))
-
;; FIXME: As of policy 3.5.6.0, the allowed characters in a field name
;; are not specified. So we just go with "word constituent" or '-'
;; characters before a colon.
diff --git a/debian-copyright.el b/debian-copyright.el
index 3ed5b32..03f6135 100644
--- a/debian-copyright.el
+++ b/debian-copyright.el
@@ -48,8 +48,6 @@
(defvar debian-copyright-mode-map nil
"Keymap for debian/copyright mode.")
-(defvar debian-copyright-mode-syntax-table nil
- "Syntax table for debian/copyright mode.")
(defvar debian-copyright-font-lock-keywords nil
"Regexps to highlight in font-lock.")
@@ -97,12 +95,13 @@ It should be immediately followed by a non-slash character.")
"MPL-2\\.0")
"Supported licenses based on /usr/share/common-licenses.")
-(if debian-copyright-mode-syntax-table
- () ; Do not change the table if it is already set up.
- (setq debian-copyright-mode-syntax-table (make-syntax-table))
- (modify-syntax-entry ?\" ". " debian-copyright-mode-syntax-table)
- (modify-syntax-entry ?\\ ". " debian-copyright-mode-syntax-table)
- (modify-syntax-entry ?' "w " debian-copyright-mode-syntax-table))
+(defvar debian-copyright-mode-syntax-table
+ (let ((table (make-syntax-table)))
+ (modify-syntax-entry ?\" ". " table)
+ (modify-syntax-entry ?\\ ". " table)
+ (modify-syntax-entry ?' "w " table)
+ table)
+ "Syntax table for debian/copyright mode.")
(defun debian-copyright--font-lock-add-field-keywords (field-names)
"Add font lock for field in FIELD-NAMES."
diff --git a/readme-debian.el b/readme-debian.el
index 390d401..d328d18 100644
--- a/readme-debian.el
+++ b/readme-debian.el
@@ -84,13 +84,14 @@ Automatically invoked when saving file."
(if readme-debian-mode-map
()
(setq readme-debian-mode-map (make-sparse-keymap)))
-(defvar readme-debian-mode-syntax-table nil "Syntax table for README.Debian mode.")
-(if readme-debian-mode-syntax-table
- () ; Do not change the table if it is already set up.
- (setq readme-debian-mode-syntax-table (make-syntax-table))
- (modify-syntax-entry ?\" ". " readme-debian-mode-syntax-table)
- (modify-syntax-entry ?\\ ". " readme-debian-mode-syntax-table)
- (modify-syntax-entry ?' "w " readme-debian-mode-syntax-table))
+
+(defvar readme-debian-mode-syntax-table
+ (let ((table (make-syntax-table)))
+ (modify-syntax-entry ?\" ". " table)
+ (modify-syntax-entry ?\\ ". " table)
+ (modify-syntax-entry ?' "w " table)
+ table)
+ "Syntax table for README.Debian mode.")
(defvar font-lock-defaults) ;For XEmacs byte-compilation
;;;###autoload
--
2.39.2
>From da9dcafddb645b9b234d87a89884e5c8c0656685 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Sun, 21 Jul 2024 11:16:43 +0200
Subject: [PATCH 05/27] Construct the key map once when loading the mode source
file
---
debian-bts-control.el | 9 ++++-----
debian-changelog-mode.el | 43 ++++++++++++++--------------------------
readme-debian.el | 7 +++----
3 files changed, 22 insertions(+), 37 deletions(-)
diff --git a/debian-bts-control.el b/debian-bts-control.el
index 56dc469..2e3930c 100644
--- a/debian-bts-control.el
+++ b/debian-bts-control.el
@@ -121,12 +121,11 @@ the top of the message."
"Email address domain to send control message to.")
(defvar debian-bts-control-minor-mode nil)
-(defvar debian-bts-control-minor-mode-map nil
+(defvar debian-bts-control-minor-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "\C-c\C-b" 'debian-bts-control)
+ map)
"Keymap for `debian-bts-control' minor mode.")
-(if debian-bts-control-minor-mode-map
- nil
- (setq debian-bts-control-minor-mode-map (make-sparse-keymap))
- (define-key debian-bts-control-minor-mode-map "\C-c\C-b" 'debian-bts-control))
(easy-menu-define debian-bts-control-menu debian-bts-control-minor-mode-map
"Debian Bug Mode Menu"
diff --git a/debian-changelog-mode.el b/debian-changelog-mode.el
index a7844b6..71cdf37 100644
--- a/debian-changelog-mode.el
+++ b/debian-changelog-mode.el
@@ -732,35 +732,22 @@ Upload to " val " anyway?")))
(autoload 'outline-next-visible-heading "outline")
(autoload 'outline-prev-visible-heading "outline")
-(defvar debian-changelog-mode-map nil
+(defvar debian-changelog-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "\C-c\C-a" 'debian-changelog-add-entry)
+ (define-key map "\C-c\C-o" 'debian-changelog-build-open-bug-list)
+ (define-key map "\C-c\C-b" 'debian-changelog-close-bug)
+ (define-key map "\C-c\C-f" 'debian-changelog-finalise-last-version)
+ (define-key map "\C-c\C-c" 'debian-changelog-finalise-and-save)
+ (define-key map "\C-c\C-v" 'debian-changelog-add-version)
+ (define-key map "\C-c\C-d" 'debian-changelog-distribution)
+ (define-key map "\C-c\C-u" 'debian-changelog-urgency)
+ (define-key map "\C-c\C-e" 'debian-changelog-unfinalise-last-version)
+ (define-key map "\C-c\C-n" 'outline-next-visible-heading)
+ (define-key map "\C-c\C-p" 'outline-previous-visible-heading)
+ (define-key map "\C-c\C-t" 'debian-changelog-toggle-team-upload)
+ map)
"Keymap for Debian changelog major mode.")
-(if debian-changelog-mode-map
- nil
- (setq debian-changelog-mode-map (make-sparse-keymap))
- (define-key debian-changelog-mode-map "\C-c\C-a"
- 'debian-changelog-add-entry)
- (define-key debian-changelog-mode-map "\C-c\C-o"
- 'debian-changelog-build-open-bug-list)
- (define-key debian-changelog-mode-map "\C-c\C-b"
- 'debian-changelog-close-bug)
- (define-key debian-changelog-mode-map "\C-c\C-f"
- 'debian-changelog-finalise-last-version)
- (define-key debian-changelog-mode-map "\C-c\C-c"
- 'debian-changelog-finalise-and-save)
- (define-key debian-changelog-mode-map "\C-c\C-v"
- 'debian-changelog-add-version)
- (define-key debian-changelog-mode-map "\C-c\C-d"
- 'debian-changelog-distribution)
- (define-key debian-changelog-mode-map "\C-c\C-u"
- 'debian-changelog-urgency)
- (define-key debian-changelog-mode-map "\C-c\C-e"
- 'debian-changelog-unfinalise-last-version)
- (define-key debian-changelog-mode-map "\C-c\C-n"
- 'outline-next-visible-heading)
- (define-key debian-changelog-mode-map "\C-c\C-p"
- 'outline-previous-visible-heading)
- (define-key debian-changelog-mode-map "\C-c\C-t"
- 'debian-changelog-toggle-team-upload))
;;
;; menu definition (Chris Waters)
diff --git a/readme-debian.el b/readme-debian.el
index d328d18..6bed091 100644
--- a/readme-debian.el
+++ b/readme-debian.el
@@ -80,10 +80,9 @@ Automatically invoked when saving file."
(if (and (= (point)(point-max)) (not (bolp)))
(insert "\n"))))
-(defvar readme-debian-mode-map nil "Keymap for README.Debian mode.")
-(if readme-debian-mode-map
- ()
- (setq readme-debian-mode-map (make-sparse-keymap)))
+(defvar readme-debian-mode-map
+ (make-sparse-keymap)
+ "Keymap for README.Debian mode.")
(defvar readme-debian-mode-syntax-table
(let ((table (make-syntax-table)))
--
2.39.2
>From f97c9428949f7be03ac28b66907e45525ec185b9 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Sun, 21 Jul 2024 11:55:19 +0200
Subject: [PATCH 06/27] Construct the font lock keywords once when loading the
mode source file
---
debian-autopkgtest-control-mode.el | 43 ++++++------------
debian-copyright.el | 72 +++++++++++++-----------------
2 files changed, 43 insertions(+), 72 deletions(-)
diff --git a/debian-autopkgtest-control-mode.el b/debian-autopkgtest-control-mode.el
index ef004be..2d7edc4 100644
--- a/debian-autopkgtest-control-mode.el
+++ b/debian-autopkgtest-control-mode.el
@@ -47,9 +47,6 @@
(defvar debian-autopkgtest-control-mode-map nil
"Keymap for debian-autopkgtest-control-mode.")
-(defvar debian-autopkgtest-control-mode-font-lock-keywords nil
- "Regexps to highlight in font-lock.")
-
(defvar debian-autopkgtest-control-mode--field-names
'("Architecture"
"Classes"
@@ -100,26 +97,19 @@ https://people.debian.org/~eriberto/README.package-tests.html.")
table)
"Syntax table for debian-autopkgtest-control-mode.")
-(defun debian-autopkgtest-control-mode--font-lock-add-field-keywords (field-names)
- "Add font lock for field in FIELD-NAMES."
- (dolist (field-name field-names)
- (add-to-list 'debian-autopkgtest-control-mode-font-lock-keywords
- `(,(concat "^" field-name ":") . font-lock-keyword-face))))
-
-(defun debian-autopkgtest-control-mode--font-lock-add-dependency-extensions
- (extensions)
- "Add font lock for dependency EXTENSIONS."
- (dolist (extension extensions)
- (add-to-list 'debian-autopkgtest-control-mode-font-lock-keywords
- `(,extension . font-lock-variable-name-face))))
-
-(defun debian-autopkgtest-control-mode--font-lock-add-restrictions (restrictions)
- "Add font lock for RESTRICTIONS."
- (dolist (restriction restrictions)
- (add-to-list 'debian-autopkgtest-control-mode-font-lock-keywords
- `(,(concat "^\\Restrictions:.*\\_<\\(" restriction
- "\\)\\_>")
- (1 font-lock-type-face)))))
+(defvar debian-autopkgtest-control-mode-font-lock-keywords
+ (append
+ (mapcar (lambda (field-name)
+ `(,(concat "^" field-name ":") . font-lock-keyword-face))
+ debian-autopkgtest-control-mode--field-names)
+ (mapcar (lambda (extension)
+ `(,extension . font-lock-variable-name-face))
+ debian-autopkgtest-control-mode--dependency-extensions)
+ (mapcar (lambda (restriction)
+ `(,(concat "^\\Restrictions:.*\\_<\\(" restriction "\\)\\_>")
+ (1 font-lock-type-face)))
+ debian-autopkgtest-control-mode--restrictions))
+ "Regexps to highlight in font-lock.")
;;;###autoload
(defun debian-autopkgtest-control-mode ()
@@ -132,13 +122,6 @@ https://people.debian.org/~eriberto/README.package-tests.html.")
(mapc 'make-local-variable '(font-lock-defaults write-file-hooks))
(use-local-map debian-autopkgtest-control-mode-map)
(set-syntax-table debian-autopkgtest-control-mode-syntax-table)
- ;; Add font locks
- (debian-autopkgtest-control-mode--font-lock-add-field-keywords
- debian-autopkgtest-control-mode--field-names)
- (debian-autopkgtest-control-mode--font-lock-add-dependency-extensions
- debian-autopkgtest-control-mode--dependency-extensions)
- (debian-autopkgtest-control-mode--font-lock-add-restrictions
- debian-autopkgtest-control-mode--restrictions)
(setq font-lock-defaults
'(debian-autopkgtest-control-mode-font-lock-keywords
nil ;keywords-only
diff --git a/debian-copyright.el b/debian-copyright.el
index 03f6135..f76c291 100644
--- a/debian-copyright.el
+++ b/debian-copyright.el
@@ -49,9 +49,6 @@
(defvar debian-copyright-mode-map nil
"Keymap for debian/copyright mode.")
-(defvar debian-copyright-font-lock-keywords nil
- "Regexps to highlight in font-lock.")
-
(defvar debian-copyright--field-names
'("Comment"
"Copyright"
@@ -103,36 +100,35 @@ It should be immediately followed by a non-slash character.")
table)
"Syntax table for debian/copyright mode.")
-(defun debian-copyright--font-lock-add-field-keywords (field-names)
- "Add font lock for field in FIELD-NAMES."
- (dolist (field-name field-names)
- (add-to-list 'debian-copyright-font-lock-keywords
- `(,(concat "^" field-name ":") . font-lock-keyword-face))))
-
-(defun debian-copyright--font-lock-add-email ()
- "Add font lock for email addresses.
-This is not a fully compliant email detecting regexp. It
-additionally detects the extra `<' and `>' around the address. I
-hope this works well enough until the day we have to follow
-https://stackoverflow.com/a/201378."
- (add-to-list 'debian-copyright-font-lock-keywords
- '("<?\\([^<> \t\n]+@[^<> \t\n]+\\.[^<> \t\n]+\\)>?"
- (1 font-lock-variable-name-face))))
-
-(defun debian-copyright--font-lock-add-urls (protocol-prefixes)
- "Add font lock for a URL with PROTOCOL-PREFIXES."
- (dolist (protocol-prefix protocol-prefixes)
- (add-to-list 'debian-copyright-font-lock-keywords
- `(,(concat "\\(" protocol-prefix "[^/ \t\n][^ \t\n]*\\)")
- (1 font-lock-constant-face)))))
-
-(defun debian-copyright--font-lock-add-licenses (supported-licenses)
- "Add font lock for SUPPORTED-LICENSES."
- (dolist (supported-license supported-licenses)
- (add-to-list 'debian-copyright-font-lock-keywords
- `(,(concat "^\\License:.*\\_<\\(" supported-license
- "\\+?\\)\\_>")
- (1 font-lock-type-face)))))
+(defvar debian-copyright--goto-addr-highlight-p
+ (progn
+ (defvar goto-address-highlight-p) ;; To suppress comp warnings.
+ (and (featurep 'goto-addr)
+ goto-address-highlight-p))
+ "Whether URLs are highlighted with goto-addr (instead of font-lock).")
+
+(defvar debian-copyright-font-lock-keywords
+ (append
+ (mapcar (lambda (field-name)
+ `(,(concat "^" field-name ":") . font-lock-keyword-face))
+ debian-copyright--field-names)
+ ;; Add font lock for email addresses.
+ ;; This is not a fully compliant email detecting regexp. It
+ ;; additionally detects the extra `<' and `>' around the address. I
+ ;; hope this works well enough until the day we have to follow
+ ;; https://stackoverflow.com/a/201378.
+ '(("<?\\([^<> \t\n]+@[^<> \t\n]+\\.[^<> \t\n]+\\)>?"
+ (1 font-lock-variable-name-face)))
+ (unless debian-copyright--goto-addr-highlight-p
+ (mapcar (lambda (protocol-prefix)
+ `(,(concat "\\(" protocol-prefix "[^/ \t\n][^ \t\n]*\\)")
+ (1 font-lock-constant-face)))
+ debian-copyright--supported-url-protocol-prefixes))
+ (mapcar (lambda (supported-license)
+ `(,(concat "^\\License:.*\\_<\\(" supported-license "\\+?\\)\\_>")
+ (1 font-lock-type-face)))
+ debian-copyright--supported-licenses))
+ "Regexps to highlight in font-lock.")
;;;###autoload
(defun debian-copyright-mode ()
@@ -145,15 +141,7 @@ https://stackoverflow.com/a/201378."
(mapc 'make-local-variable '(font-lock-defaults write-file-hooks))
(use-local-map debian-copyright-mode-map)
(set-syntax-table debian-copyright-mode-syntax-table)
- ;; Add font locks
- (debian-copyright--font-lock-add-field-keywords debian-copyright--field-names)
- (debian-copyright--font-lock-add-email)
- (debian-copyright--font-lock-add-licenses debian-copyright--supported-licenses)
- (defvar goto-address-highlight-p) ;; To suppress comp warnings.
- (if (or (not (featurep 'goto-addr))
- (not goto-address-highlight-p))
- (debian-copyright--font-lock-add-urls
- debian-copyright--supported-url-protocol-prefixes)
+ (when debian-copyright--goto-addr-highlight-p
(goto-address))
(setq font-lock-defaults
'(debian-copyright-font-lock-keywords
--
2.39.2
>From d8bec39f404c80ca8c09007ba33813db116c832b Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Sun, 21 Jul 2024 13:41:52 +0200
Subject: [PATCH 07/27] Shorten declaration of local variables with setq-local
Especially, document font-lock-defaults in all files and remove a
wrong parameter from the call in debian-control-mode.el.
The original motivation is a warning that (mapc ...) should not be
used when the result is ignored.
---
debian-autopkgtest-control-mode.el | 7 +++----
debian-bts-control.el | 2 +-
debian-changelog-mode.el | 26 ++++++++++++++------------
debian-control-mode.el | 20 +++++++-------------
debian-copyright.el | 4 ++--
readme-debian.el | 5 ++---
6 files changed, 29 insertions(+), 35 deletions(-)
diff --git a/debian-autopkgtest-control-mode.el b/debian-autopkgtest-control-mode.el
index 2d7edc4..8f6d077 100644
--- a/debian-autopkgtest-control-mode.el
+++ b/debian-autopkgtest-control-mode.el
@@ -119,15 +119,14 @@ https://people.debian.org/~eriberto/README.package-tests.html.")
(kill-all-local-variables)
(setq major-mode 'debian-autopkgtest-control-mode)
(setq mode-name "debian-autopkgtest-control")
- (mapc 'make-local-variable '(font-lock-defaults write-file-hooks))
+ (make-local-variable 'write-file-hooks)
(use-local-map debian-autopkgtest-control-mode-map)
(set-syntax-table debian-autopkgtest-control-mode-syntax-table)
- (setq font-lock-defaults
+ (setq-local font-lock-defaults
'(debian-autopkgtest-control-mode-font-lock-keywords
nil ;keywords-only
nil ;case-fold
- nil ;syntax-alist
- ))
+ ())) ; local syntax table alist
(run-mode-hooks 'debian-autopkgtest-control-mode-hook))
diff --git a/debian-bts-control.el b/debian-bts-control.el
index 2e3930c..4d63aa7 100644
--- a/debian-bts-control.el
+++ b/debian-bts-control.el
@@ -302,7 +302,7 @@ a negative prefix argument turns it off.
\\<debian-bts-control-minor-mode-map>
\\[debian-bts-control]\t\tAdd a control command to the current message."
(interactive "P")
- (set (make-local-variable 'debian-bts-control-minor-mode)
+ (setq-local debian-bts-control-minor-mode
(if arg
(> (prefix-numeric-value arg) 0)
(not debian-bts-control-minor-mode)))
diff --git a/debian-changelog-mode.el b/debian-changelog-mode.el
index 71cdf37..ba9d9d6 100644
--- a/debian-changelog-mode.el
+++ b/debian-changelog-mode.el
@@ -1542,24 +1542,26 @@ interface to set it, or simply set the variable
;; done.
(use-local-map debian-changelog-mode-map)
;; Let each entry behave as one paragraph:
- (set (make-local-variable 'fill-forward-paragraph-function)
+ (setq-local fill-forward-paragraph-function
#'debian-changelog--forward-paragraph)
- (set (make-local-variable 'paragraph-start) "\\s *[*+-]\\|\\s *$\\|\f\\|^\\<")
- (set (make-local-variable 'paragraph-separate) "\\s *$\\|\f\\|^\\<")
+ (setq-local paragraph-start "\\s *[*+-]\\|\\s *$\\|\f\\|^\\<")
+ (setq-local paragraph-separate "\\s *$\\|\f\\|^\\<")
;; Let each version behave as one page.
;; Match null string on the heading line so that the heading line
;; is grouped with what follows.
- (set (make-local-variable 'page-delimiter) "^\\<")
- (set (make-local-variable 'version-control) 'never)
- (set (make-local-variable 'adaptive-fill-regexp) "\\s *")
- (set (make-local-variable 'font-lock-defaults)
+ (setq-local page-delimiter "^\\<")
+ (setq-local version-control 'never)
+ (setq-local adaptive-fill-regexp "\\s *")
+ (setq-local font-lock-defaults
'((debian-changelog-font-lock-keywords
debian-changelog-font-lock-keywords-1
- debian-changelog-font-lock-keywords-2) t t))
- (set (make-local-variable
- 'debian-changelog-local-variables-maybe-remove-done) nil)
- (set (make-local-variable 'indent-line-function) 'indent-relative-maybe)
- (set (make-local-variable 'outline-regexp) "^[a-z]")
+ debian-changelog-font-lock-keywords-2)
+ t ; keywords-only?
+ t ; case-fold?
+ ())) ; local syntax table alist
+ (setq-local debian-changelog-local-variables-maybe-remove-done nil)
+ (setq-local indent-line-function 'indent-relative-maybe)
+ (setq-local outline-regexp "^[a-z]")
(setq local-abbrev-table text-mode-abbrev-table)
(set-syntax-table text-mode-syntax-table)
(debian-bug-bug-menu-init debian-changelog-mode-map)
diff --git a/debian-control-mode.el b/debian-control-mode.el
index 6542392..7533d7d 100644
--- a/debian-control-mode.el
+++ b/debian-control-mode.el
@@ -297,30 +297,24 @@ It should be immediately followed by a non-slash character.")
"A major mode for editing Debian control files (i.e. debian/control)."
(set-syntax-table debian-control-syntax-table)
;; Comments
- (make-local-variable 'comment-start-skip) ;Need this for font-lock...
- (setq comment-start-skip "^#+\s-*")
- (make-local-variable 'comment-start)
- (make-local-variable 'comment-end)
- (setq comment-start "#"
- comment-end "")
+ (setq-local comment-start-skip "^#+\s-*") ;Need this for font-lock...
+ (setq-local comment-start "#")
+ (setq-local comment-end "")
;; Support # style comments
(setq-local syntax-propertize-function
(syntax-propertize-rules ("^\\(#\\)" (1 "<"))))
- (make-local-variable 'font-lock-defaults)
- (setq font-lock-defaults
+ (setq-local font-lock-defaults
'(debian-control-font-lock-keywords
nil ;;; Keywords only? No, let it do syntax via table.
nil ;;; case-fold?
- nil ;;; Local syntax table.
- nil ;;; Use `backward-paragraph' ? No
- ))
- (set (make-local-variable 'fill-paragraph-function)
+ ())) ; local syntax table alist
+ (setq-local fill-paragraph-function
#'debian-control-mode-fill-paragraph)
(make-local-variable 'after-change-functions)
(push 'debian-control-mode-after-change-function after-change-functions)
- (set (make-local-variable 'imenu-generic-expression)
+ (setq-local imenu-generic-expression
'((nil "^\\(Package\\|Source\\):\\s-*\\([-a-zA-Z0-9+.]+?\\)\\s-*$" 2)))
(define-key debian-control-mode-map (kbd "C-c C-b") 'debian-control-view-package-bugs)
diff --git a/debian-copyright.el b/debian-copyright.el
index f76c291..16a94df 100644
--- a/debian-copyright.el
+++ b/debian-copyright.el
@@ -138,12 +138,12 @@ It should be immediately followed by a non-slash character.")
(kill-all-local-variables)
(setq major-mode 'debian-copyright-mode)
(setq mode-name "debian/copyright")
- (mapc 'make-local-variable '(font-lock-defaults write-file-hooks))
+ (make-local-variable 'write-file-hooks)
(use-local-map debian-copyright-mode-map)
(set-syntax-table debian-copyright-mode-syntax-table)
(when debian-copyright--goto-addr-highlight-p
(goto-address))
- (setq font-lock-defaults
+ (setq-local font-lock-defaults
'(debian-copyright-font-lock-keywords
nil ;keywords-only
nil ;case-fold
diff --git a/readme-debian.el b/readme-debian.el
index 6bed091..162dc4f 100644
--- a/readme-debian.el
+++ b/readme-debian.el
@@ -104,14 +104,13 @@ will be updated.
(kill-all-local-variables)
(setq major-mode 'readme-debian-mode)
(setq mode-name "README.Debian")
- (make-local-variable 'font-lock-defaults)
(use-local-map readme-debian-mode-map)
(set-syntax-table readme-debian-mode-syntax-table)
- (setq font-lock-defaults
+ (setq-local font-lock-defaults
'(readme-debian-font-lock-keywords
nil ;; keywords-only? No, let it do syntax via table.
nil ;; case-fold?
- nil ;; Local syntax table.
+ () ;; Local syntax table.
))
;; add timestamp update func to write-contents-hooks
(if (or (= emacs-major-version 20)
--
2.39.2
>From 3270788a00af1cfac98a0d598525b5a1b66a72d4 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Fri, 5 Jul 2024 15:13:22 +0200
Subject: [PATCH 08/27] Simplify addition of a co-maintainer by changelog-mode
---
debian-changelog-mode.el | 65 +++++++++++-----------------------------
1 file changed, 17 insertions(+), 48 deletions(-)
diff --git a/debian-changelog-mode.el b/debian-changelog-mode.el
index ba9d9d6..e98ac7a 100644
--- a/debian-changelog-mode.el
+++ b/debian-changelog-mode.el
@@ -1308,8 +1308,9 @@ Use UTC if `debian-changelog-date-utc-flag' is non-nil."
(defun debian-changelog-last-maintainer ()
"Return maintainer name and e-mail of the last changelog entry as
-a list in the form (NAME EMAIL)."
- (save-excursion
+a list in the form (NAME EMAIL).
+The point is left after the > character closing the email part of the
+signature line at the end of the last entry."
(goto-char (point-min))
(let ((string
(if (re-search-forward "^ -- \\(.*\\)>" nil t)
@@ -1317,7 +1318,7 @@ a list in the form (NAME EMAIL)."
(match-string-no-properties 1)
(match-string 1))
(error "Maintainer name and email not found."))))
- (split-string string " <"))))
+ (split-string string " <")))
(defun debian-changelog-web-developer-page ()
"Browse the BTS for the last upload maintainer's developer summary page."
@@ -1327,48 +1328,10 @@ a list in the form (NAME EMAIL)."
(load "browse-url" nil t)
(if (not (featurep 'browse-url))
(error "This function requires the browse-url elisp package"))))
- (let ((email (cadr (debian-changelog-last-maintainer))))
+ (let ((email (cadr (save-excursion (debian-changelog-last-maintainer)))))
(browse-url (concat "http://qa.debian.org/developer.php?login=" email))
(message "Looking up developer summary page for %s via browse-url" email)))
-;; co-maintenance as per bug #352957 by Luca Capello 2006
-(defun debian-changelog-comaintainer-insert (name separator)
- "In the line before SEPARATOR, insert the co-maintainer name as for
-the form [ NAME ]."
- (goto-char (point-min))
- (re-search-forward (concat "\n " separator))
- (forward-line -1)
- (insert "\n [ " name " ]")
- (when (string= "--" separator)
- (insert "\n")))
-
-(defun debian-changelog-comaintainer ()
- "If the last maintainer is different from the current one, create a
-co-maintained changelog entry."
- (let ((name (car (debian-changelog-last-maintainer))))
- (unless (string= name debian-changelog-full-name)
- (let ((maintainers-found)
- (debian-changelog-last-entry-end
- (progn (goto-char (point-min))
- (re-search-forward "\n --"))))
- (mapc (lambda (x)
- (goto-char (point-min))
- (when (search-forward x debian-changelog-last-entry-end t)
- (add-to-list 'maintainers-found x)))
- (list name debian-changelog-full-name))
- ;; set the co-maintenance if any
- (if maintainers-found
- ;; co-maintenance, debian-changelog-full-name is not present
- (if (and (member name maintainers-found)
- (not (member debian-changelog-full-name
- maintainers-found)))
- (debian-changelog-comaintainer-insert
- debian-changelog-full-name "--"))
- ;; no co-maintenance
- (mapc (lambda (x)
- (debian-changelog-comaintainer-insert (car x) (cadr x)))
- `((,name " *") (,debian-changelog-full-name "--"))))))))
-
;;
;; interactive function to unfinalise changelog (so modifications can be made)
;;
@@ -1381,12 +1344,18 @@ can be made."
(if (debian-changelog-finalised-p) nil
(error "Most recent version is not finalised"))
(save-excursion
- (debian-changelog-comaintainer)
- (goto-char (point-min))
- (re-search-forward "\n --")
- (let ((dels (point)))
- (end-of-line)
- (delete-region dels (point)))))
+ ;; Save the name of the last maintainer, then cut after " --".
+ (let ((last-maintainer (car (debian-changelog-last-maintainer))))
+ (beginning-of-line)
+ (delete-region (+ 3 (point)) (point-at-eol))
+ (unless (or (string= last-maintainer debian-changelog-full-name)
+ (search-backward debian-changelog-full-name nil t))
+ ;; Mention the new co-maintainer at the end of the entry.
+ (insert " [ " debian-changelog-full-name " ]\n\n")
+ (unless (search-backward last-maintainer nil 1)
+ ;; Mention the last maintainer at the beginning of the entry.
+ (end-of-line)
+ (insert "\n [ " last-maintainer " ]"))))))
;;
;; Functions to handle team upload
--
2.39.2
>From ec3237003135916b77325f29d7deeb0fbdeeb41c Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Sat, 19 Oct 2024 10:05:12 +0200
Subject: [PATCH 09/27] Simplify some conditionals
---
debian-bts-control.el | 31 +++----
debian-changelog-mode.el | 172 +++++++++++++++++----------------------
debian-control-mode.el | 6 +-
3 files changed, 92 insertions(+), 117 deletions(-)
diff --git a/debian-bts-control.el b/debian-bts-control.el
index 4d63aa7..b6d9238 100644
--- a/debian-bts-control.el
+++ b/debian-bts-control.el
@@ -306,17 +306,15 @@ a negative prefix argument turns it off.
(if arg
(> (prefix-numeric-value arg) 0)
(not debian-bts-control-minor-mode)))
- (cond
- (debian-bts-control-minor-mode ;Setup the minor-mode
- (if (fboundp 'font-lock-add-keywords)
- (font-lock-add-keywords nil debian-bts-control-font-lock-keywords t))
- )))
+ (if (and debian-bts-control-minor-mode ; Setup the minor-mode
+ (fboundp 'font-lock-add-keywords))
+ (font-lock-add-keywords nil debian-bts-control-font-lock-keywords t)))
;; Install ourselves:
-(or (assq 'debian-bts-control-minor-mode minor-mode-alist)
+(unless (assq 'debian-bts-control-minor-mode minor-mode-alist)
(setq minor-mode-alist
(cons '(debian-bts-control-minor-mode " DBugC") minor-mode-alist)))
-(or (assq 'debian-bts-control-minor-mode minor-mode-map-alist)
+(unless (assq 'debian-bts-control-minor-mode minor-mode-map-alist)
(setq minor-mode-map-alist
(cons (cons 'debian-bts-control-minor-mode
debian-bts-control-minor-mode-map)
@@ -339,17 +337,14 @@ a negative prefix argument turns it off.
(defun debian-bts-control-prompt (prompt &optional number)
"Prompt for bug number using sensible default if found."
- (let ((default-number number))
- (unless default-number
- (save-excursion
- (goto-char (point-min))
- (if (re-search-forward (concat "\\([0-9]+\\)@" debian-bts-emaildomain)
- (mail-header-end) t)
- (setq default-number (match-string-no-properties 1)))))
- (if default-number
- (read-string (format "%s [%s]: " prompt default-number)
- nil nil default-number)
- (read-string (format "%s: " prompt)))))
+ (unless number
+ (save-excursion
+ (goto-char (point-min))
+ (if (re-search-forward (concat "\\([0-9]+\\)@" debian-bts-emaildomain)
+ (mail-header-end) t)
+ (setq number (match-string-no-properties 1)))))
+ (read-string (format (if number "%s [%s]: " "%s: ") prompt number)
+ nil nil number))
;;;###autoload
(defun debian-bts-control (action &optional arg)
diff --git a/debian-changelog-mode.el b/debian-changelog-mode.el
index e98ac7a..408f5f4 100644
--- a/debian-changelog-mode.el
+++ b/debian-changelog-mode.el
@@ -607,9 +607,8 @@ STRING should be given if the last search was by `string-match' on STRING."
(defun debian-changelog-local-variables-maybe-remove ()
"Ask to remove local variables block if buffer not read-only."
(interactive)
- (if (or debian-changelog-local-variables-maybe-remove-done
- buffer-read-only)
- nil
+ (unless (or debian-changelog-local-variables-maybe-remove-done
+ buffer-read-only)
(setq debian-changelog-local-variables-maybe-remove-done t)
(if (debian-changelog-local-variables-exists-p)
(save-excursion
@@ -889,8 +888,7 @@ for the debian/changelog file to add the entry to."
(goto-char (point-min))
(re-search-forward "\n --")
(backward-char 5)
- (if (prog1 (looking-at "\n") (forward-char 1))
- nil
+ (unless (prog1 (looking-at "\n") (forward-char 1))
(insert "\n"))
(insert " * ")
(save-excursion (insert "\n")))
@@ -926,10 +924,11 @@ for the debian/changelog file to add the entry to."
(let ((action (capitalize
(read-string
"Most recent version is finalised, [u]nfinalize or [a]dd new version? "))))
- (if (not (string-match "^[uU]" action))
- (debian-changelog-add-version)
- (debian-changelog-unfinalise-last-version)
- (debian-changelog-add-entry-plain)))
+ (if (string-match "^[uU]" action)
+ (progn
+ (debian-changelog-unfinalise-last-version)
+ (debian-changelog-add-entry-plain))
+ (debian-changelog-add-version)))
(debian-changelog-add-entry-plain))
(insert filename ": "))
@@ -948,24 +947,22 @@ for the debian/changelog file to add the entry to."
(defun debian-changelog-close-bug (bug-number)
"Add a new change entry to close a BUG-NUMBER."
(interactive
- (progn
- (if (eq (debian-changelog-finalised-p) t)
- (error (substitute-command-keys "most recent version has been finalised - use \\[debian-changelog-unfinalise-last-version] or \\[debian-changelog-add-version]")))
+ (if (eq (debian-changelog-finalised-p) t)
+ (error (substitute-command-keys "most recent version has been finalised - use \\[debian-changelog-unfinalise-last-version] or \\[debian-changelog-add-version]"))
(list (completing-read "Bug number to close: "
debian-bug-open-alist nil nil))))
- (if (not (string-match "^[0-9]+$" bug-number))
- (error "The bug number should consists of only digits"))
+ (unless (string-match "^[0-9]+$" bug-number)
+ (error "The bug number should consists of only digits"))
(debian-changelog-add-entry)
- (cond
- ((and debian-bug-open-alist
- (assoc bug-number debian-bug-open-alist))
- (insert (cadr (assoc bug-number debian-bug-open-alist)))
- (fill-paragraph nil))
- (t
+ (if (and debian-bug-open-alist
+ (assoc bug-number debian-bug-open-alist))
+ (progn
+ (insert (cadr (assoc bug-number debian-bug-open-alist)))
+ (fill-paragraph nil))
(save-excursion
(insert " " (debian-changelog--rris
"%s" bug-number debian-changelog-close-bug-statement)))
- (message "Enter a brief description of what was done here."))))
+ (message "Enter a brief description of what was done here.")))
;;
;; interactive functions to set urgency and distribution
@@ -980,8 +977,8 @@ for the debian/changelog file to add the entry to."
"Select distribution: "
debian-changelog-allowed-distributions
nil t nil)))
- (if (not (equal str ""))
- (debian-changelog-setdistribution str))))
+ (unless (equal str "")
+ (debian-changelog-setdistribution str))))
(defun debian-changelog-urgency ()
"Delete the current urgency and prompt for a new one."
@@ -992,8 +989,8 @@ for the debian/changelog file to add the entry to."
"Select urgency: "
'(("low" 1) ("medium" 2) ("high" 3) ("critical" 4))
nil t nil)))
- (if (not (equal str ""))
- (debian-changelog-seturgency str))))
+ (unless (equal str "")
+ (debian-changelog-seturgency str))))
;;
;; internal function: test if changelog has been finalized or not
@@ -1007,22 +1004,18 @@ for the debian/changelog file to add the entry to."
\(ie, has a maintainer name and email address and a release date."
(save-excursion
(goto-char (point-min))
- (or (re-search-forward "\n\\S-" (point-max) t)
- (goto-char (point-max)))
+ (unless (re-search-forward "\n\\S-" (point-max) t)
+ (goto-char (point-max)))
(if (re-search-backward "\n --" (point-min) t)
(forward-char 4)
;;(beginning-of-line)
;;(insert " --\n\n")
;;(backward-char 2)
)
- (cond
- ((looking-at
- "[ \n]+\\S-[^\n\t]+\\S- <[^ \t\n<>]+> +\\S-[^\t\n]+\\S-[ \t]*\n")
- t)
- ((looking-at "[ \t]*\n")
- nil)
- (t
- "finalisation line has bad format (not ` -- maintainer <email> date')"))))
+ (or (looking-at
+ "[ \n]+\\S-[^\n\t]+\\S- <[^ \t\n<>]+> +\\S-[^\t\n]+\\S-[ \t]*\n")
+ (and (not (looking-at "[ \t]*\n"))
+ "finalisation line has bad format (not ` -- maintainer <email> date')"))))
;;
;; interactive functions to add new versions (whole new sections)
;; to changelog.
@@ -1040,10 +1033,10 @@ for the debian/changelog file to add the entry to."
"Add a new version section to a debian-style changelog file.
If file is empty, create initial entry."
(interactive)
- (if (not (= (point-min)(point-max)))
- (let ((f (debian-changelog-finalised-p)))
- (and (stringp f) (error f))
- (or f (error "Previous version not yet finalised"))))
+ (unless (= (point-min)(point-max))
+ (let ((f (debian-changelog-finalised-p)))
+ (if (stringp f) (error f))
+ (unless f (error "Previous version not yet finalised"))))
(goto-char (point-min))
(let ((pkg-name (or (debian-changelog-suggest-package-name)
(read-string "Package name: ")))
@@ -1078,12 +1071,8 @@ If file is empty, create initial entry."
" *debian-changelog-mode-temp-buffer*")))
(set-buffer tmp-buffer)
(unwind-protect
- (progn
- (let ((mesg (call-process "dpkg" nil '(t nil) nil
- "--compare-versions" vsn1 "gt" vsn2)))
- (if (equal mesg 0)
- t
- nil)))
+ (equal 0 (call-process "dpkg" nil '(t nil) nil
+ "--compare-versions" vsn1 "gt" vsn2))
(kill-buffer tmp-buffer)))))
(defun debian-changelog-suggest-version ()
@@ -1129,8 +1118,7 @@ If file is empty, create initial entry."
;;; match 4: debian version number exists if matched
;;; match 5: debian version number
;;; match 6: rest of string
- (if (not findmatch)
- nil
+ (when findmatch
(let ((pkg-name (match-string-no-properties 1))
(epoch (or (match-string-no-properties 2) ""))
(upstream-vsn (match-string-no-properties 3))
@@ -1269,8 +1257,8 @@ If file is empty, create initial entry."
"Finalise, if necessary, and then save a debian-style changelog file."
(interactive)
(let ((f (debian-changelog-finalised-p)))
- (and (stringp f) (error f))
- (or f (debian-changelog-finalise-last-version)))
+ (if (stringp f) (error f))
+ (unless f (debian-changelog-finalise-last-version)))
(save-buffer))
;;
@@ -1294,8 +1282,8 @@ Use UTC if `debian-changelog-date-utc-flag' is non-nil."
(defun debian-changelog-finalise-last-version ()
"Finalise maintainer's name and email and release date."
(interactive)
- (and (debian-changelog-finalised-p)
- (debian-changelog-unfinalise-last-version))
+ (if (debian-changelog-finalised-p)
+ (debian-changelog-unfinalise-last-version))
(if debian-changelog-local-variables-maybe-remove
(debian-changelog-local-variables-maybe-remove))
(save-excursion
@@ -1312,22 +1300,20 @@ a list in the form (NAME EMAIL).
The point is left after the > character closing the email part of the
signature line at the end of the last entry."
(goto-char (point-min))
- (let ((string
- (if (re-search-forward "^ -- \\(.*\\)>" nil t)
- (if (fboundp 'match-string-no-properties)
- (match-string-no-properties 1)
- (match-string 1))
- (error "Maintainer name and email not found."))))
+ (unless (re-search-forward "^ -- \\(.*\\)>" nil t)
+ (error "Maintainer name and email not found."))
+ (let ((string (if (fboundp 'match-string-no-properties)
+ (match-string-no-properties 1)
+ (match-string 1))))
(split-string string " <")))
(defun debian-changelog-web-developer-page ()
"Browse the BTS for the last upload maintainer's developer summary page."
(interactive)
- (if (not (featurep 'browse-url))
- (progn
- (load "browse-url" nil t)
- (if (not (featurep 'browse-url))
- (error "This function requires the browse-url elisp package"))))
+ (unless (featurep 'browse-url)
+ (load "browse-url" nil t)
+ (unless (featurep 'browse-url)
+ (error "This function requires the browse-url elisp package")))
(let ((email (cadr (save-excursion (debian-changelog-last-maintainer)))))
(browse-url (concat "http://qa.debian.org/developer.php?login=" email))
(message "Looking up developer summary page for %s via browse-url" email)))
@@ -1341,7 +1327,7 @@ signature line at the end of the last entry."
Removes maintainer's name, email address and release date so that new entries
can be made."
(interactive)
- (if (debian-changelog-finalised-p) nil
+ (unless (debian-changelog-finalised-p)
(error "Most recent version is not finalised"))
(save-excursion
;; Save the name of the last maintainer, then cut after " --".
@@ -1534,20 +1520,17 @@ interface to set it, or simply set the variable
(setq local-abbrev-table text-mode-abbrev-table)
(set-syntax-table text-mode-syntax-table)
(debian-bug-bug-menu-init debian-changelog-mode-map)
- (cond
- (debian-changelog-use-imenu
+ (when debian-changelog-use-imenu
(require 'imenu)
(setq imenu-create-index-function 'imenu--create-debian-changelog-index)
- (if (or window-system
- (fboundp 'tmm-menubar))
- (progn
- (imenu-add-to-menubar "History")
- ;; (imenu-update-menubar)
- ))))
- (cond
- (debian-changelog-highlight-mouse-t
+ (when (or window-system
+ (fboundp 'tmm-menubar))
+ (imenu-add-to-menubar "History")
+ ;; (imenu-update-menubar)
+ ))
+ (when debian-changelog-highlight-mouse-t
(debian-changelog-setup-highlight-mouse-keymap)
- (debian-changelog-highlight-mouse)))
+ (debian-changelog-highlight-mouse))
(run-mode-hooks 'debian-changelog-mode-hook))
;;(easy-menu-add debian-changelog-menu))
@@ -1786,14 +1769,13 @@ match 1 -> package name
;; ((and debian-changelog-use-imenu
;; (or window-system (fboundp 'tmm-menubar)))
;; (imenu-add-to-menubar "History")))
- (cond
- (debian-changelog-is-XEmacs
- (set-keymap-name m 'debian-changelog-mouse-keymap)
- (define-key m [button3]
- 'debian-bug-web-this-bug-under-mouse))
- (t
+ (if debian-changelog-is-XEmacs
+ (progn
+ (set-keymap-name m 'debian-changelog-mouse-keymap)
+ (define-key m [button3]
+ 'debian-bug-web-this-bug-under-mouse))
(define-key m [down-mouse-3]
- 'debian-bug-web-this-bug-under-mouse)))
+ 'debian-bug-web-this-bug-under-mouse))
m)))
(defvar debian-changelog-ext-list nil
@@ -1837,21 +1819,20 @@ Also set keymap."
nil t)
(setq s (match-beginning 2))
(setq e (match-end 2))
- (cond
- ((string-match "XEmacs\\|Lucid" emacs-version)
- (setq extent (make-extent s e))
- (setq debian-changelog-ext-list
- (cons extent debian-changelog-ext-list))
- (set-extent-property extent 'highlight t)
- (set-extent-property extent 'start-open t)
- ;; (set-extent-property extent 'balloon-help 'debian-changelog-label-help)
- ;; (set-extent-property extent 'help-echo 'debian-changelog-label-help-echo)
- (set-extent-property extent 'keymap debian-changelog-mouse-keymap))
- (t
+ (if (string-match "XEmacs\\|Lucid" emacs-version)
+ (progn
+ (setq extent (make-extent s e))
+ (setq debian-changelog-ext-list
+ (cons extent debian-changelog-ext-list))
+ (set-extent-property extent 'highlight t)
+ (set-extent-property extent 'start-open t)
+ ;; (set-extent-property extent 'balloon-help 'debian-changelog-label-help)
+ ;; (set-extent-property extent 'help-echo 'debian-changelog-label-help-echo)
+ (set-extent-property extent 'keymap debian-changelog-mouse-keymap))
(let ((before-change-functions) (after-change-functions))
(put-text-property s e 'local-map
debian-changelog-mouse-keymap)
- (put-text-property s e 'mouse-face 'highlight)))))
+ (put-text-property s e 'mouse-face 'highlight))))
(set-buffer-modified-p modified))))
;;;-------------
@@ -1928,8 +1909,7 @@ Also set keymap."
(push (cons (match-string-no-properties 4) marker)
index-alist)))))
;;; (message "Scanning changelog history... done.")
- (cond
- (index-bug-alist
+ (when index-bug-alist
(push (cons "Closed Bugs (chrono)"
index-bug-alist)
index-alist)
@@ -1937,7 +1917,7 @@ Also set keymap."
(push (cons "Closed Bugs (sorted)"
(sort index-bugsorted-alist
'debian-changelog-imenu-sort))
- index-alist)))
+ index-alist))
index-alist))))
(defun debian-changelog-imenu-sort (el1 el2)
diff --git a/debian-control-mode.el b/debian-control-mode.el
index 7533d7d..6c8afdc 100644
--- a/debian-control-mode.el
+++ b/debian-control-mode.el
@@ -430,7 +430,7 @@ It should be immediately followed by a non-slash character.")
(beginning-of-line)
(looking-at "^\\(Package\\|Source\\)"))
(re-search-backward "^\\(Package\\|Source\\)" nil t))
- (not (not (string-match "Package" (match-string 0))))
+ (string-match "Package" (match-string 0))
(error "Couldn't find Package or Source field")))
(fields (if binary-p
debian-control-binary-fields
@@ -536,10 +536,10 @@ text file."
"Find-file a possibly compressed FILE"
(require 'jka-compr)
(let ((installed (jka-compr-installed-p)))
- (if (not installed)
+ (unless installed
(auto-compression-mode t))
(find-file file)
- (if (not installed)
+ (unless installed
(auto-compression-mode -1))))
(defun debian-control-mode-bugs-mouse-click (event)
--
2.39.2
>From e19fea178fefd1e57f8642011a361ed2b04da682 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Sat, 19 Oct 2024 10:31:35 +0200
Subject: [PATCH 10/27] Simplify debian-changelog-setdistribution
---
debian-changelog-mode.el | 50 +++++++++++++++++-----------------------
1 file changed, 21 insertions(+), 29 deletions(-)
diff --git a/debian-changelog-mode.el b/debian-changelog-mode.el
index 408f5f4..afc4ba2 100644
--- a/debian-changelog-mode.el
+++ b/debian-changelog-mode.el
@@ -683,41 +683,33 @@ STRING should be given if the last search was by `string-match' on STRING."
(defun debian-changelog-getdistribution ()
(debian-changelog-getheadervalue ") \\(.*\\)\\;"))
(defvar last-nonmenu-event)
-(defun debian-changelog-setdistribution (val)
- (if (not (string-match "^.*security" val))
- (debian-changelog-setheadervalue ") \\(.*\\)\\;" val)
- (cond
- ((or (and (fboundp 'should-use-dialog-box-p)
- (should-use-dialog-box-p))
- (and window-system
- (equal last-nonmenu-event '(menu-bar))
- use-dialog-box))
- (if (y-or-n-p
- (concat
- "Warning, although the {oldstable,stable,testing}-security
+(defvar debian-changelog-setdistribution-question
+ "Warning, although the {oldstable,stable,testing}-security
distribution exists it should not be used unless you are a
member of the security team. Please don't upload to it if you
are not 150% sure that your package is suitable. In case of
doubt, please send the files to [email protected] via
mail instead.
-Upload to " val " anyway?"))
- (debian-changelog-setheadervalue ") \\(.*\\)\\;" val)))
- (t
- (let ((window-config (current-window-configuration)))
- (with-output-to-temp-buffer "*Help*"
- (princ (concat
- "Warning, although the {oldstable,stable,testing}-security
-distribution exists it should not be used unless you are a
-member of the security team. Please don't upload to it if you
-are not 150% sure that your package is suitable. In case of
-doubt, please send the files to [email protected] via
-mail instead.
-
-Upload to " val " anyway?")))
- (if (y-or-n-p (format "Upload to %s anyway? " val))
- (debian-changelog-setheadervalue ") \\(.*\\)\\;" val))
- (set-window-configuration window-config))))))
+Upload to %s anyway?")
+(defun debian-changelog-setdistribution (val)
+ (cond
+ ((not (string-match "^.*security" val))
+ (debian-changelog-setheadervalue ") \\(.*\\)\\;" val))
+ ((or (and (fboundp 'should-use-dialog-box-p)
+ (should-use-dialog-box-p))
+ (and window-system
+ (equal last-nonmenu-event '(menu-bar))
+ use-dialog-box))
+ (if (y-or-n-p (format debian-changelog-setdistribution-question val))
+ (debian-changelog-setheadervalue ") \\(.*\\)\\;" val)))
+ (t
+ (let ((window-config (current-window-configuration)))
+ (with-output-to-temp-buffer "*Help*"
+ (princ (format debian-changelog-setdistribution-question val)))
+ (if (y-or-n-p (format "Upload to %s anyway? " val))
+ (debian-changelog-setheadervalue ") \\(.*\\)\\;" val))
+ (set-window-configuration window-config)))))
(defun debian-changelog--get-all-code-names ()
"Returns a list of all code names from supported distributions."
--
2.39.2
>From 9fca71d32585cedb97f78522aec9be517d5d05d3 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Sat, 19 Oct 2024 10:45:33 +0200
Subject: [PATCH 11/27] Simplify debian-changelog-add-entry-file
---
debian-changelog-mode.el | 31 ++++++++++++-------------------
1 file changed, 12 insertions(+), 19 deletions(-)
diff --git a/debian-changelog-mode.el b/debian-changelog-mode.el
index afc4ba2..9771c75 100644
--- a/debian-changelog-mode.el
+++ b/debian-changelog-mode.el
@@ -887,26 +887,19 @@ for the debian/changelog file to add the entry to."
(defun debian-changelog-add-entry-file ()
"Add an entry for current file in debian/changelog."
- (let* ((this-file (buffer-file-name))
- (directory (if (not this-file)
- (error "This buffer has no file associated to it")
- (directory-file-name (file-name-directory this-file))))
+ (let* ((this-file (or (buffer-file-name)
+ (error "This buffer has no file associated to it")))
+ (directory (directory-file-name (file-name-directory this-file)))
(filename (file-name-nondirectory this-file))
- (success))
- (while directory
- (let ((changelog (expand-file-name "debian/changelog" directory)))
- (cond
- ((file-readable-p changelog)
- (debian-changelog-add-entry-file-specified changelog filename)
- (setq directory nil
- success t))
- (t
- (if (not (string-match "\\(.*\\)/\\([^/]+\\)$" directory))
- (setq directory nil)
- (setq filename (concat (match-string 2 directory) "/" filename)
- directory (match-string 1 directory)))))))
- (if (not success)
- (error "debian directory not found"))))
+ changelog)
+ (while (progn
+ (setq changelog (expand-file-name "debian/changelog" directory))
+ (not (file-readable-p changelog)))
+ (unless (string-match "\\(.*\\)/\\([^/]+\\)$" directory)
+ (error "debian directory not found"))
+ (setq filename (concat (match-string 2 directory) "/" filename)
+ directory (match-string 1 directory)))
+ (debian-changelog-add-entry-file-specified changelog filename)))
(defun debian-changelog-add-entry-file-specified (changelog filename)
"Insert an entry in debian CHANGELOG file for FILENAME."
--
2.39.2
>From 9825abe69677e2c1373023d6e5d83b45ce94d47b Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Sat, 19 Oct 2024 11:16:35 +0200
Subject: [PATCH 12/27] Simplify debian-changelog-fontify-version
---
debian-changelog-mode.el | 40 +++++++++++++++++-----------------------
1 file changed, 17 insertions(+), 23 deletions(-)
diff --git a/debian-changelog-mode.el b/debian-changelog-mode.el
index 9771c75..7bcc705 100644
--- a/debian-changelog-mode.el
+++ b/debian-changelog-mode.el
@@ -1631,34 +1631,28 @@ match 1 -> package name
;; match 3: upstream version number
;; match 4: debian version number exists if matched
;; match 5: debian version number
- (cond
- ((not (match-string 4))
- ;; No Debian version number -> Debian native package
- (store-match-data
+ (store-match-data
+ (cond
+ ((not (match-string 4))
+ ;; No Debian version number -> Debian native package
(list (match-beginning 1)(match-end 3)
(match-beginning 1)(match-end 1)
(match-beginning 3)(match-end 3)
nil nil
- nil nil)))
- ((match-string 4)
+ nil nil))
;; Debian version number -> Let's see if NMU...
- (let* ((deb-vsn (match-string 5))
- (is-NMU (save-match-data (string-match "\\." deb-vsn))))
- (cond
- (is-NMU
- (store-match-data
- (list (match-beginning 1)(match-end 5)
- (match-beginning 1)(match-end 1)
- nil nil
- nil nil
- (match-beginning 3)(match-end 5))))
- (t
- (store-match-data
- (list (match-beginning 1)(match-end 5)
- (match-beginning 1)(match-end 1)
- nil nil
- (match-beginning 3)(match-end 5)
- nil nil)))))))
+ ((save-match-data (string-match "\\." (match-string 5)))
+ (list (match-beginning 1)(match-end 5)
+ (match-beginning 1)(match-end 1)
+ nil nil
+ nil nil
+ (match-beginning 3)(match-end 5)))
+ (t
+ (list (match-beginning 1)(match-end 5)
+ (match-beginning 1)(match-end 1)
+ nil nil
+ (match-beginning 3)(match-end 5)
+ nil nil))))
t))
(defun debian-changelog-fontify-urgency-crit (limit)
--
2.39.2
>From b5ef19ef5f08d40df51112b2ad8eec789321bf00 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Fri, 18 Oct 2024 18:32:19 +0200
Subject: [PATCH 13/27] Simplify
debian-changelog-imenu-prev-index-position-function
---
debian-changelog-mode.el | 56 +++++++++++++++++-----------------------
1 file changed, 23 insertions(+), 33 deletions(-)
diff --git a/debian-changelog-mode.el b/debian-changelog-mode.el
index 7bcc705..0b7fae1 100644
--- a/debian-changelog-mode.el
+++ b/debian-changelog-mode.el
@@ -1827,39 +1827,29 @@ Also set keymap."
(make-variable-buffer-local 'debian-changelog-imenu-doing-closebug)
(defun debian-changelog-imenu-prev-index-position-function ()
- (cond
- (debian-changelog-imenu-doing-closebug
- (if (not (posix-search-backward
- "\\(closes:\\)\\|[^0-9]\\([0-9]+\\)" nil t))
- nil ; No match
- ;; match 1 -> "closes:"
- ;; match 2 -> a bug number
- (cond
- ((match-string 1)
- (setq debian-changelog-imenu-doing-closebug nil)
- (debian-changelog-imenu-prev-index-position-function))
- (t
- ;; Return the bug number match
- t))))
- (t
- (if (not (re-search-backward
- "\\(closes: *\\(bug\\)?#? *[0-9]+\\)\\|\\(^\\sw.* (\\(.+\\))\\)"
- nil t))
- nil ; No match
- ;; match 1 -> "closes:"
- ;; match 4 -> a version number
- (cond
- ((match-string 1)
- (setq debian-changelog-imenu-doing-closebug t)
- (forward-char -1)
- (re-search-forward
- "\\(closes:\\) *\\(\\(bug\\)?#? *[0-9]+\\(, *\\(bug\\)?#? *[0-9]+\\)*\\)"
- nil t)
- (forward-char 1)
- (debian-changelog-imenu-prev-index-position-function))
- (t
- ;; Return the version number match
- t))))))
+ (if debian-changelog-imenu-doing-closebug
+ (and (posix-search-backward "\\(closes:\\)\\|[^0-9]\\([0-9]+\\)" nil t)
+ ;; match 1 -> "closes:"
+ ;; match 2 -> a bug number
+ (or (not (match-string 1)) ;; Return the bug number match
+
+ (progn
+ (setq debian-changelog-imenu-doing-closebug nil)
+ (debian-changelog-imenu-prev-index-position-function))))
+ (and (re-search-backward
+ "\\(closes: *\\(bug\\)?#? *[0-9]+\\)\\|\\(^\\sw.* (\\(.+\\))\\)"
+ nil t)
+ ;; match 1 -> "closes:"
+ ;; match 4 -> a version number
+ (or (not (match-string 1)) ;; Return the version number match
+ (progn
+ (setq debian-changelog-imenu-doing-closebug t)
+ (forward-char -1)
+ (re-search-forward
+ "\\(closes:\\) *\\(\\(bug\\)?#? *[0-9]+\\(, *\\(bug\\)?#? *[0-9]+\\)*\\)"
+ nil t)
+ (forward-char 1)
+ (debian-changelog-imenu-prev-index-position-function))))))
(defvar debian-changelog-imenu-counter nil
"Debian-changelog-mode internal variable for imenu support.")
--
2.39.2
>From b07d76a7bf54374d31cf08668954cbd7feff8068 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Sat, 12 Oct 2024 15:15:09 +0200
Subject: [PATCH 14/27] Shorten some constructs with push
---
debian-bts-control.el | 9 +++------
debian-changelog-mode.el | 6 ++----
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/debian-bts-control.el b/debian-bts-control.el
index b6d9238..a701428 100644
--- a/debian-bts-control.el
+++ b/debian-bts-control.el
@@ -312,13 +312,10 @@ a negative prefix argument turns it off.
;; Install ourselves:
(unless (assq 'debian-bts-control-minor-mode minor-mode-alist)
- (setq minor-mode-alist
- (cons '(debian-bts-control-minor-mode " DBugC") minor-mode-alist)))
+ (push '(debian-bts-control-minor-mode " DBugC") minor-mode-alist))
(unless (assq 'debian-bts-control-minor-mode minor-mode-map-alist)
- (setq minor-mode-map-alist
- (cons (cons 'debian-bts-control-minor-mode
- debian-bts-control-minor-mode-map)
- minor-mode-map-alist)))
+ (push (cons 'debian-bts-control-minor-mode debian-bts-control-minor-mode-map)
+ minor-mode-map-alist))
(defvar debian-bts-control-alist
'(("reassign") ("severity") ("reopen") ("submitter") ("forwarded")
diff --git a/debian-changelog-mode.el b/debian-changelog-mode.el
index 0b7fae1..3481749 100644
--- a/debian-changelog-mode.el
+++ b/debian-changelog-mode.el
@@ -1779,8 +1779,7 @@ Also set keymap."
(and (<= (point-min)(extent-start-position extent))
(>= (point-max)(extent-end-position extent))))
(delete-extent extent)
- (setq debian-changelog-ext-list
- (cons extent debian-changelog-ext-list)))
+ (push extent debian-changelog-ext-list))
(setq local-extent-list (cdr local-extent-list)))
;; Remove properties for regular emacs
;; FIXME This detroys all mouse-faces and local-maps!
@@ -1801,8 +1800,7 @@ Also set keymap."
(if (string-match "XEmacs\\|Lucid" emacs-version)
(progn
(setq extent (make-extent s e))
- (setq debian-changelog-ext-list
- (cons extent debian-changelog-ext-list))
+ (push extent debian-changelog-ext-list)
(set-extent-property extent 'highlight t)
(set-extent-property extent 'start-open t)
;; (set-extent-property extent 'balloon-help 'debian-changelog-label-help)
--
2.39.2
>From 28f3a0be5b096ac748c107fb5e02cd2fdc65e8a2 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Sat, 12 Oct 2024 15:18:05 +0200
Subject: [PATCH 15/27] Shorten some constructs with dolist
---
debian-changelog-mode.el | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/debian-changelog-mode.el b/debian-changelog-mode.el
index 3481749..ae0d3f8 100644
--- a/debian-changelog-mode.el
+++ b/debian-changelog-mode.el
@@ -1767,20 +1767,18 @@ match 1 -> package name
Also set keymap."
(interactive)
(save-excursion
- (let ((s)(e)(extent)(local-extent-list debian-changelog-ext-list)
+ (let ((s)(e)(local-extent-list debian-changelog-ext-list)
(inhibit-read-only t)
(modified (buffer-modified-p))) ;put-text-property changing this?
;; Remove the mouse face properties first.
(setq debian-changelog-ext-list nil) ;Reconstructed below...
(if (string-match "XEmacs\\|Lucid" emacs-version)
- (while local-extent-list
- (setq extent (car local-extent-list))
+ (dolist (extent local-extent-list)
(if (or (extent-detached-p extent)
(and (<= (point-min)(extent-start-position extent))
(>= (point-max)(extent-end-position extent))))
(delete-extent extent)
- (push extent debian-changelog-ext-list))
- (setq local-extent-list (cdr local-extent-list)))
+ (push extent debian-changelog-ext-list)))
;; Remove properties for regular emacs
;; FIXME This detroys all mouse-faces and local-maps!
(let ((before-change-functions) (after-change-functions))
--
2.39.2
>From cdb024248df3a152e38b794d42af9e7b6c4a9ab7 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Sat, 12 Oct 2024 15:28:47 +0200
Subject: [PATCH 16/27] Simplify (list 'a 'b) to '(a b)
---
debian-changelog-mode.el | 52 ++++++++++++++++++++--------------------
1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/debian-changelog-mode.el b/debian-changelog-mode.el
index ae0d3f8..4ef8c95 100644
--- a/debian-changelog-mode.el
+++ b/debian-changelog-mode.el
@@ -516,7 +516,7 @@ the bug number."
:options '(turn-on-auto-fill flyspell-mode))
(defcustom debian-changelog-add-version-hook
- (list 'debian-changelog-add-new-upstream-release)
+ '(debian-changelog-add-new-upstream-release)
"Hooks run just before inserting the signature separator \"--\" in a
new version in debian/changelog."
:group 'debian-changelog
@@ -541,7 +541,7 @@ Pass ARGS to `replace-regexp-in-string' (GNU Emacs) or to
;; and arguments are in different order.
;; Patch from Rafael Laboissiere <[email protected]>
;; Closes: #476271
- (apply 'replace-in-string (list (nth 2 args) (nth 0 args) (nth 1 args))))
+ (replace-in-string (nth 2 args) (nth 0 args) (nth 1 args)))
;; Emacs:
(apply 'replace-regexp-in-string args)))
@@ -1564,36 +1564,36 @@ interface to set it, or simply set the variable
;; this is somewhat limiting; I may consider adding my own faces later.
(defvar debian-changelog-font-lock-keywords-1
- (list
- ;; package name line: pkg (1.0-1) unstable; urgency=medium
- '(debian-changelog-fontify-version
+ '(
+ ;; package name line: pkg (1.0-1) unstable; urgency=medium
+ (debian-changelog-fontify-version
(1 font-lock-function-name-face)
(2 font-lock-type-face nil t)
(3 font-lock-string-face nil t)
(4 debian-changelog-warning-face nil t))
- '(debian-changelog-fontify-stable . debian-changelog-warning-face)
- '(debian-changelog-fontify-backports . debian-changelog-warning-face)
- '(debian-changelog-fontify-frozen . font-lock-type-face)
- '(debian-changelog-fontify-unstable . font-lock-string-face)
- '(debian-changelog-fontify-experimental . debian-changelog-warning-face)
- '(debian-changelog-fontify-unreleased . debian-changelog-warning-face)
- '(debian-changelog-fontify-urgency-crit . debian-changelog-warning-face)
- '(debian-changelog-fontify-urgency-high . debian-changelog-warning-face)
- '(debian-changelog-fontify-urgency-med . font-lock-type-face)
- '(debian-changelog-fontify-urgency-low . font-lock-string-face)
- '(debian-changelog-fontify-known-releases . font-lock-string-face)
+ (debian-changelog-fontify-stable . debian-changelog-warning-face)
+ (debian-changelog-fontify-backports . debian-changelog-warning-face)
+ (debian-changelog-fontify-frozen . font-lock-type-face)
+ (debian-changelog-fontify-unstable . font-lock-string-face)
+ (debian-changelog-fontify-experimental . debian-changelog-warning-face)
+ (debian-changelog-fontify-unreleased . debian-changelog-warning-face)
+ (debian-changelog-fontify-urgency-crit . debian-changelog-warning-face)
+ (debian-changelog-fontify-urgency-high . debian-changelog-warning-face)
+ (debian-changelog-fontify-urgency-med . font-lock-type-face)
+ (debian-changelog-fontify-urgency-low . font-lock-string-face)
+ (debian-changelog-fontify-known-releases . font-lock-string-face)
;; bug closers
- '(;"\\(closes:\\) *\\(\\(bug\\)?#? *[0-9]+\\(, *\\(bug\\)?#? *[0-9]+\\)*\\)"
- ;; Process lines that continue on multiple lines - Fred Bothamy
- "\\(closes:\\)[ \t\n]*\\(\\(bug\\)?#? *[0-9]+\\(,[ \t\n]*\\(bug\\)?#? *[0-9]+\\)*\\)"
- (1 font-lock-keyword-face)
- (2 debian-changelog-warning-face))
- '("^\t.*$" . debian-changelog-warning-face)
+ (;"\\(closes:\\) *\\(\\(bug\\)?#? *[0-9]+\\(, *\\(bug\\)?#? *[0-9]+\\)*\\)"
+ ;; Process lines that continue on multiple lines - Fred Bothamy
+ "\\(closes:\\)[ \t\n]*\\(\\(bug\\)?#? *[0-9]+\\(,[ \t\n]*\\(bug\\)?#? *[0-9]+\\)*\\)"
+ (1 font-lock-keyword-face)
+ (2 debian-changelog-warning-face))
+ ("^\t.*$" . debian-changelog-warning-face)
;; maintainer line (enforce 2 space exactly between email and date)
- '("^ -- \\(.+\\) <\\(.+@.+\\)> \\([^ ].+\\)$"
- (1 font-lock-variable-name-face)
- (2 font-lock-variable-name-face)
- (3 font-lock-string-face)))
+ ("^ -- \\(.+\\) <\\(.+@.+\\)> \\([^ ].+\\)$"
+ (1 font-lock-variable-name-face)
+ (2 font-lock-variable-name-face)
+ (3 font-lock-string-face)))
"First level highlighting for `debian-changelog-mode'.")
(defvar debian-changelog-font-lock-keywords-2
--
2.39.2
>From 6415b675873f97d3c72cce359174cf2c3f470c14 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Sat, 12 Oct 2024 15:37:40 +0200
Subject: [PATCH 17/27] Use quasiquote to prevent duplicate submenu definitions
The emacs and xemacs versions were diverging more than necessary.
* one of the best-packaging-practices was wrong
* emacs seems to handle :active like xemacs
Related:
debian-changelog-is-XEmacs is defined twice, with inconsistent definitions
---
debian-changelog-mode.el | 172 ++++++++++++++-------------------------
1 file changed, 63 insertions(+), 109 deletions(-)
diff --git a/debian-changelog-mode.el b/debian-changelog-mode.el
index 4ef8c95..42d80c5 100644
--- a/debian-changelog-mode.el
+++ b/debian-changelog-mode.el
@@ -749,115 +749,69 @@ Upload to %s anyway?")
(not (null (save-match-data (string-match "XEmacs\\|Lucid" emacs-version))))
(= 21 emacs-major-version)))
-(cond
- (debian-changelog-is-XEmacs
- (easy-menu-define
- debian-changelog-menu debian-changelog-mode-map "Debian Changelog Mode Menu"
- '("Changelog"
- ["New Version" debian-changelog-add-version (debian-changelog-finalised-p)]
- ["Add Entry" debian-changelog-add-entry
- (not (debian-changelog-finalised-p))]
- ["Build Open Bug List" debian-changelog-build-open-bug-list]
- ["Close Bug" debian-changelog-close-bug
- (not (debian-changelog-finalised-p))]
- "--"
- ("Set Distribution"
- ["unstable" (debian-changelog-setdistribution "unstable") t]
- ("--")
- ["testing" (debian-changelog-setdistribution "testing") t]
- ["testing-security" (debian-changelog-setdistribution "testing-security") t]
- ("--")
- ["stable" (debian-changelog-setdistribution "stable") t]
- ["stable-security" (debian-changelog-setdistribution "stable-security") t]
- ["stable-proposed-updates" (debian-changelog-setdistribution "stable-proposed-updates") t]
- ("--")
- ["oldstable-security" (debian-changelog-setdistribution "oldstable-security") t]
- ["oldstable-proposed-updates" (debian-changelog-setdistribution "oldstable-proposed-updates") t]
- ("--")
- ["experimental" (debian-changelog-setdistribution "experimental") t]
- ["UNRELEASED" (debian-changelog-setdistribution "UNRELEASED") t])
- ("Set Urgency"
- ["low" (debian-changelog-seturgency "low") t]
- ["medium" (debian-changelog-seturgency "medium") t]
- ["high" (debian-changelog-seturgency "high") t]
- ["critical" (debian-changelog-seturgency "critical") t])
- "--"
- ["Unfinalise" debian-changelog-unfinalise-last-version
- (debian-changelog-finalised-p)]
- ["Finalise" debian-changelog-finalise-last-version
- (not (debian-changelog-finalised-p))]
- ["Finalise+Save" debian-changelog-finalise-and-save
- (not (debian-changelog-finalised-p))]
- "--"
- "Web View"
- ["Best Practices" (browse-url "http://www.debian.org/doc/developers-reference/best-pkging-practices.html#bpp-debian-changelog") t]
- ["Bugs for This Package" (debian-bug-web-bugs) t]
- ["Archived Bugs for This Package" (debian-bug-web-bugs t) t]
- ["Bug Number..." (debian-bug-web-bug) t]
- ["Package Info" (debian-bug-web-packages) t]
- ;; ("Package web pages..."
- ;; ["stable" (debian-bug-web-package "stable") t]
- ;; ["testing" (debian-bug-web-package "testing") t]
- ;; ["unstable" (debian-bug-web-package "unstable") t])
- ["Developer Page for This Package" (debian-bug-web-developer-page) t]
- ["Developer Page for This Maintainer" (debian-changelog-web-developer-page)
- t]
- "--"
- ["Customize" (customize-group "debian-changelog") (fboundp 'customize-group)])))
- (t
- (easy-menu-define
- debian-changelog-menu debian-changelog-mode-map "Debian Changelog Mode Menu"
- '("Changelog"
- ["New Version" debian-changelog-add-version (debian-changelog-finalised-p)]
- ["Add Entry" debian-changelog-add-entry
- (not (debian-changelog-finalised-p))]
- ["Build Open Bug List" debian-changelog-build-open-bug-list]
- ["Close Bug" debian-changelog-close-bug
- (not (debian-changelog-finalised-p))]
- "--"
- ("Set Distribution" :active (not (debian-changelog-finalised-p))
- ["unstable" (debian-changelog-setdistribution "unstable") t]
- ("--")
- ["testing" (debian-changelog-setdistribution "testing") t]
- ["testing-security" (debian-changelog-setdistribution "testing-security") t]
- ("--")
- ["stable" (debian-changelog-setdistribution "stable") t]
- ["stable-security" (debian-changelog-setdistribution "stable-security") t]
- ["stable-proposed-updates" (debian-changelog-setdistribution "stable-proposed-updates") t]
- ("--")
- ["oldstable-security" (debian-changelog-setdistribution "oldstable-security") t]
- ["oldstable-proposed-updates" (debian-changelog-setdistribution "oldstable-proposed-updates") t]
- ("--")
- ["experimental" (debian-changelog-setdistribution "experimental") t]
- ["UNRELEASED" (debian-changelog-setdistribution "UNRELEASED") t])
- ("Set Urgency" :active (not (debian-changelog-finalised-p))
- ["low" (debian-changelog-seturgency "low") t]
- ["medium" (debian-changelog-seturgency "medium") t]
- ["high" (debian-changelog-seturgency "high") t]
- ["critical" (debian-changelog-seturgency "critical") t])
- "--"
- ["Unfinalise" debian-changelog-unfinalise-last-version
- (debian-changelog-finalised-p)]
- ["Finalise" debian-changelog-finalise-last-version
- (not (debian-changelog-finalised-p))]
- ["Finalise+Save" debian-changelog-finalise-and-save
- (not (debian-changelog-finalised-p))]
- "--"
- "Web View"
- ["Best Practices" (browse-url "http://www.debian.org/doc/developers-reference/ch-best-pkging-practices.en.html#s-bpp-debian-changelog") t]
- ["Bugs for This Package" (debian-bug-web-bugs) t]
- ["Archived Bugs for This Package" (debian-bug-web-bugs t) t]
- ["Bug Number..." (debian-bug-web-bug) t]
- ["Package Info" (debian-bug-web-packages) t]
- ("Package web pages..."
- ["stable" (debian-bug-web-package "stable") t]
- ["testing" (debian-bug-web-package "testing") t]
- ["unstable" (debian-bug-web-package "unstable") t])
- ["Developer Page for This Package" (debian-bug-web-developer-page) t]
- ["Developer Page for This Maintainer" (debian-changelog-web-developer-page)
- t]
- "--"
- ["Customize" (customize-group "debian-changelog") (fboundp 'customize-group)]))))
+(easy-menu-define
+ debian-changelog-menu debian-changelog-mode-map "Debian Changelog Mode Menu"
+ `("Changelog"
+ ["New Version" debian-changelog-add-version (debian-changelog-finalised-p)]
+ ["Add Entry" debian-changelog-add-entry
+ (not (debian-changelog-finalised-p))]
+ ["Build Open Bug List" debian-changelog-build-open-bug-list]
+ ["Close Bug" debian-changelog-close-bug
+ (not (debian-changelog-finalised-p))]
+ "--"
+ ("Set Distribution"
+ ,@(unless debian-changelog-is-XEmacs
+ '(:active (not (debian-changelog-finalised-p))))
+ ["unstable" (debian-changelog-setdistribution "unstable") t]
+ ("--")
+ ["testing" (debian-changelog-setdistribution "testing") t]
+ ["testing-security" (debian-changelog-setdistribution "testing-security") t]
+ ("--")
+ ["stable" (debian-changelog-setdistribution "stable") t]
+ ["stable-security" (debian-changelog-setdistribution "stable-security") t]
+ ["stable-proposed-updates" (debian-changelog-setdistribution "stable-proposed-updates") t]
+ ("--")
+ ["oldstable-security" (debian-changelog-setdistribution "oldstable-security") t]
+ ["oldstable-proposed-updates" (debian-changelog-setdistribution "oldstable-proposed-updates") t]
+ ("--")
+ ["experimental" (debian-changelog-setdistribution "experimental") t]
+ ["UNRELEASED" (debian-changelog-setdistribution "UNRELEASED") t])
+ ("Set Urgency"
+ ,@(unless debian-changelog-is-XEmacs
+ '(:active (not (debian-changelog-finalised-p))))
+ ["low" (debian-changelog-seturgency "low") t]
+ ["medium" (debian-changelog-seturgency "medium") t]
+ ["high" (debian-changelog-seturgency "high") t]
+ ["critical" (debian-changelog-seturgency "critical") t])
+ "--"
+ ["Unfinalise" debian-changelog-unfinalise-last-version
+ (debian-changelog-finalised-p)]
+ ["Finalise" debian-changelog-finalise-last-version
+ (not (debian-changelog-finalised-p))]
+ ["Finalise+Save" debian-changelog-finalise-and-save
+ (not (debian-changelog-finalised-p))]
+ "--"
+ "Web View"
+ ["Best Practices"
+ (browse-url
+ ,(if debian-changelog-is-XEmacs
+ "http://www.debian.org/doc/developers-reference/best-pkging-practices.html#bpp-debian-changelog"
+ "http://www.debian.org/doc/developers-reference/ch-best-pkging-practices.en.html#s-bpp-debian-changelog"))
+ t]
+ ["Bugs for This Package" (debian-bug-web-bugs) t]
+ ["Archived Bugs for This Package" (debian-bug-web-bugs t) t]
+ ["Bug Number..." (debian-bug-web-bug) t]
+ ["Package Info" (debian-bug-web-packages) t]
+ ,@(unless debian-changelog-is-XEmacs
+ '("Package web pages..."
+ ["stable" (debian-bug-web-package "stable") t]
+ ["testing" (debian-bug-web-package "testing") t]
+ ["unstable" (debian-bug-web-package "unstable") t]))
+ ["Developer Page for This Package" (debian-bug-web-developer-page) t]
+ ["Developer Page for This Maintainer" (debian-changelog-web-developer-page)
+ t]
+ "--"
+ ["Customize" (customize-group "debian-changelog") (fboundp 'customize-group)]))
;;
;; interactive function to add a new line to the changelog
--
2.39.2
>From b7d25ea65bdc2d560cfce2df2f6f94870de8e035 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Fri, 18 Oct 2024 18:26:45 +0200
Subject: [PATCH 18/27] Stop building an a-list for completing-read
---
debian-bts-control.el | 15 ++++++++-------
debian-changelog-mode.el | 2 +-
debian-control-mode.el | 8 +++-----
3 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/debian-bts-control.el b/debian-bts-control.el
index a701428..0c9cbe9 100644
--- a/debian-bts-control.el
+++ b/debian-bts-control.el
@@ -318,11 +318,12 @@ a negative prefix argument turns it off.
minor-mode-map-alist))
(defvar debian-bts-control-alist
- '(("reassign") ("severity") ("reopen") ("submitter") ("forwarded")
- ("notforwarded") ("retitle") ("clone") ("merge") ("unmerge")
- ("tags") ("package") ("owner") ("noowner") ("found")
- ("notfound") ("fixed") ("notfixed") ("block") ("unblock") ("archive")
- ("unarchive") ("affects") ("forcemerge") ("summary"))
+ ;; The name is historical, this is not an alist.
+ '("reassign" "severity" "reopen" "submitter" "forwarded"
+ "notforwarded" "retitle" "clone" "merge" "unmerge"
+ "tags" "package" "owner" "noowner" "found"
+ "notfound" "fixed" "notfixed" "block" "unblock" "archive"
+ "unarchive" "affects" "forcemerge" "summary")
"List of available commands at [email protected].")
(defun debian-bts-bug-number-at-point ()
@@ -444,7 +445,7 @@ in `debian-bts-control-modes-to-reuse'."
number-default))
(sign (completing-read
(concat verbose "[ + | - | = ] ")
- '(("+") ("-") ("=")) nil nil))
+ '("+" "-" "=") nil nil))
(package (completing-read
(concat verbose "Package affected: ")
(debian-bug-fill-packages-obarray) nil nil)))
@@ -745,7 +746,7 @@ in `debian-bts-control-modes-to-reuse'."
(concat verbose "Bug number")
number-default))
(add (completing-read "+, -, = (default +): "
- '(("+") ("-") ("=")) nil t nil nil "+"))
+ '("+" "-" "=") nil t nil nil "+"))
(tag (completing-read "Tag: " debian-bug-alltags-alist nil t)))
(insert (format "tags %s %s %s\n" bug-number add tag))))
((string-equal "close" action)
diff --git a/debian-changelog-mode.el b/debian-changelog-mode.el
index 42d80c5..ff7472e 100644
--- a/debian-changelog-mode.el
+++ b/debian-changelog-mode.el
@@ -926,7 +926,7 @@ for the debian/changelog file to add the entry to."
(error (substitute-command-keys "most recent version has been finalised - use \\[debian-changelog-unfinalise-last-version] or \\[debian-changelog-add-version]")))
(let ((str (completing-read
"Select urgency: "
- '(("low" 1) ("medium" 2) ("high" 3) ("critical" 4))
+ '("low" "medium" "high" "critical")
nil t nil)))
(unless (equal str "")
(debian-changelog-seturgency str))))
diff --git a/debian-control-mode.el b/debian-control-mode.el
index 6c8afdc..4e5d5b6 100644
--- a/debian-control-mode.el
+++ b/debian-control-mode.el
@@ -439,7 +439,7 @@ It should be immediately followed by a non-slash character.")
(list
binary-p
(completing-read (format "Add %s package field: " (if binary-p "binary" "source"))
- (mapcar #'(lambda (x) (cons x nil)) fields)))))
+ fields))))
(require 'cl-lib)
(let ((fields (if binary
debian-control-binary-fields
@@ -512,8 +512,7 @@ text file."
(interactive
(list (intern
(completing-read "Policy format: "
- (mapcar #'(lambda (x) (cons x 0))
- '("html" "text" "checklist"))
+ '("html" "text" "checklist")
nil t))))
(cl-case format
(text
@@ -570,8 +569,7 @@ text file."
(interactive
(list
(completing-read "View bugs for package: "
- (mapcar #'(lambda (x) (cons x 0))
- (debian-control-mode-bug-package-names))
+ (debian-control-mode-bug-package-names)
nil t)))
(browse-url (concat "http://bugs.debian.org/" package)))
--
2.39.2
>From baabe878a4706ce286dd2076283a5716a9174e35 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Fri, 18 Oct 2024 18:48:10 +0200
Subject: [PATCH 19/27] Trivial simplifications
memq already compares with eq.
(match-string 0) is either Package or Source, there is no need for a
second full regex search.
---
debian-bts-control.el | 3 +--
debian-control-mode.el | 9 ++++-----
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/debian-bts-control.el b/debian-bts-control.el
index 0c9cbe9..f4200ff 100644
--- a/debian-bts-control.el
+++ b/debian-bts-control.el
@@ -360,8 +360,7 @@ in `debian-bts-control-modes-to-reuse'."
(let ((number-default (debian-bts-bug-number-at-point)))
(cond
((or arg
- (and (car (memq t (mapcar #'(lambda (item) (eq item major-mode))
- debian-bts-control-modes-to-reuse)))
+ (and (memq major-mode debian-bts-control-modes-to-reuse)
(not debian-bts-control-minor-mode)))
(debian-bug--set-CC debian-bts-emailaddress
(concat
diff --git a/debian-control-mode.el b/debian-control-mode.el
index 4e5d5b6..5de0013 100644
--- a/debian-control-mode.el
+++ b/debian-control-mode.el
@@ -430,7 +430,7 @@ It should be immediately followed by a non-slash character.")
(beginning-of-line)
(looking-at "^\\(Package\\|Source\\)"))
(re-search-backward "^\\(Package\\|Source\\)" nil t))
- (string-match "Package" (match-string 0))
+ (string-prefix-p "P" (match-string 0))
(error "Couldn't find Package or Source field")))
(fields (if binary-p
debian-control-binary-fields
@@ -525,9 +525,8 @@ text file."
(browse-url
(if (file-exists-p "/usr/share/doc/debian-policy/policy.html/index.html")
"file:///usr/share/doc/debian-policy/policy.html/index.html"
- (prog1
- "http://www.debian.org/doc/debian-policy"
- (message "Note: package `debian-policy' not installed, using web version")))))
+ (message "Note: package `debian-policy' not installed, using web version")
+ "http://www.debian.org/doc/debian-policy")))
(t
(error "Unknown format %s for policy" format))))
@@ -557,7 +556,7 @@ text file."
(while (not (eobp))
(when (looking-at "^\\(Package\\|Source\\):\\s-*\\([-a-zA-Z0-9+.]+?\\)\\s-*$")
(push (concat
- (if (save-match-data (string-match "Source" (match-string 1)))
+ (if (string-prefix-p "S" (match-string 1))
"src:"
"")
(match-string-no-properties 2)) result))
--
2.39.2
>From e5fc8b642e2fe3578b9ebe9950fcdbe108710ae6 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Fri, 18 Oct 2024 18:59:52 +0200
Subject: [PATCH 20/27] Simplify debian-changelog-add-version
---
debian-changelog-mode.el | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/debian-changelog-mode.el b/debian-changelog-mode.el
index ff7472e..14d8380 100644
--- a/debian-changelog-mode.el
+++ b/debian-changelog-mode.el
@@ -980,12 +980,13 @@ If file is empty, create initial entry."
(let ((pkg-name (or (debian-changelog-suggest-package-name)
(read-string "Package name: ")))
(version (or (debian-changelog-suggest-version)
- (read-string "New version (including any revision): "))))
- (if (debian-changelog-experimental-p)
- (insert pkg-name " (" version ") experimental; urgency=medium\n\n * ")
- (insert pkg-name " (" version ") " (car debian-changelog-allowed-distributions) "; urgency=medium\n\n * "))
- (run-hooks 'debian-changelog-add-version-hook)
- (save-excursion (insert "\n\n --\n\n"))))
+ (read-string "New version (including any revision): ")))
+ (distribution (if (debian-changelog-experimental-p)
+ "experimental"
+ (car debian-changelog-allowed-distributions))))
+ (insert pkg-name " (" version ") " distribution "; urgency=medium\n\n * "))
+ (run-hooks 'debian-changelog-add-version-hook)
+ (save-excursion (insert "\n\n --\n\n")))
(defun debian-changelog-experimental-p ()
;; Peter S Galbraith, 04 May 2001
--
2.39.2
>From a4827ddc771a5b51158283f41b5fce8ba90f261a Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Fri, 18 Oct 2024 19:00:50 +0200
Subject: [PATCH 21/27] Simplify debian-changelog-finalised-p
---
debian-changelog-mode.el | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/debian-changelog-mode.el b/debian-changelog-mode.el
index 14d8380..f725fcf 100644
--- a/debian-changelog-mode.el
+++ b/debian-changelog-mode.el
@@ -943,10 +943,9 @@ for the debian/changelog file to add the entry to."
\(ie, has a maintainer name and email address and a release date."
(save-excursion
(goto-char (point-min))
- (unless (re-search-forward "\n\\S-" (point-max) t)
- (goto-char (point-max)))
- (if (re-search-backward "\n --" (point-min) t)
- (forward-char 4)
+ (re-search-forward "\n\\S-" nil 1)
+ (when (re-search-backward "\n --" nil t)
+ (forward-char 4)
;;(beginning-of-line)
;;(insert " --\n\n")
;;(backward-char 2)
--
2.39.2
>From 280daff50ac5cea798a1ec0c52dae87e784bd785 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Fri, 18 Oct 2024 19:02:02 +0200
Subject: [PATCH 22/27] Simplify debian-changelog-highlight-mouse
---
debian-changelog-mode.el | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/debian-changelog-mode.el b/debian-changelog-mode.el
index f725fcf..ae89fde 100644
--- a/debian-changelog-mode.el
+++ b/debian-changelog-mode.el
@@ -1721,7 +1721,7 @@ match 1 -> package name
Also set keymap."
(interactive)
(save-excursion
- (let ((s)(e)(local-extent-list debian-changelog-ext-list)
+ (let ((local-extent-list debian-changelog-ext-list)
(inhibit-read-only t)
(modified (buffer-modified-p))) ;put-text-property changing this?
;; Remove the mouse face properties first.
@@ -1747,21 +1747,21 @@ Also set keymap."
;; Same deal as for font-lock - patch from Fred Bothamy.
"\\(closes:\\)[ \t\n]*\\(\\(bug\\)?#? *[0-9]+\\(,[ \t\n]*\\(bug\\)?#? *[0-9]+\\)*\\)"
nil t)
- (setq s (match-beginning 2))
- (setq e (match-end 2))
- (if (string-match "XEmacs\\|Lucid" emacs-version)
- (progn
- (setq extent (make-extent s e))
- (push extent debian-changelog-ext-list)
- (set-extent-property extent 'highlight t)
- (set-extent-property extent 'start-open t)
- ;; (set-extent-property extent 'balloon-help 'debian-changelog-label-help)
- ;; (set-extent-property extent 'help-echo 'debian-changelog-label-help-echo)
- (set-extent-property extent 'keymap debian-changelog-mouse-keymap))
- (let ((before-change-functions) (after-change-functions))
- (put-text-property s e 'local-map
- debian-changelog-mouse-keymap)
- (put-text-property s e 'mouse-face 'highlight))))
+ (let ((s (match-beginning 2))
+ (e (match-end 2)))
+ (if (string-match "XEmacs\\|Lucid" emacs-version)
+ (let ((extent (make-extent s e)))
+ (push extent debian-changelog-ext-list)
+ (set-extent-property extent 'highlight t)
+ (set-extent-property extent 'start-open t)
+ ;; (set-extent-property extent 'balloon-help 'debian-changelog-label-help)
+ ;; (set-extent-property extent 'help-echo 'debian-changelog-label-help-echo)
+ (set-extent-property extent 'keymap debian-changelog-mouse-keymap))
+ (let ((before-change-functions)
+ (after-change-functions))
+ (put-text-property s e 'local-map
+ debian-changelog-mouse-keymap)
+ (put-text-property s e 'mouse-face 'highlight)))))
(set-buffer-modified-p modified))))
;;;-------------
--
2.39.2
>From 95344a8091f824e6f7c5a846446a31c1e30cfedc Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Fri, 18 Oct 2024 19:08:35 +0200
Subject: [PATCH 23/27] Fix indentation in debian-changelog-font-lock-keyword-1
---
debian-changelog-mode.el | 46 ++++++++++++++++++++--------------------
1 file changed, 23 insertions(+), 23 deletions(-)
diff --git a/debian-changelog-mode.el b/debian-changelog-mode.el
index ae89fde..76bbaab 100644
--- a/debian-changelog-mode.el
+++ b/debian-changelog-mode.el
@@ -1525,29 +1525,29 @@ interface to set it, or simply set the variable
(2 font-lock-type-face nil t)
(3 font-lock-string-face nil t)
(4 debian-changelog-warning-face nil t))
- (debian-changelog-fontify-stable . debian-changelog-warning-face)
- (debian-changelog-fontify-backports . debian-changelog-warning-face)
- (debian-changelog-fontify-frozen . font-lock-type-face)
- (debian-changelog-fontify-unstable . font-lock-string-face)
- (debian-changelog-fontify-experimental . debian-changelog-warning-face)
- (debian-changelog-fontify-unreleased . debian-changelog-warning-face)
- (debian-changelog-fontify-urgency-crit . debian-changelog-warning-face)
- (debian-changelog-fontify-urgency-high . debian-changelog-warning-face)
- (debian-changelog-fontify-urgency-med . font-lock-type-face)
- (debian-changelog-fontify-urgency-low . font-lock-string-face)
- (debian-changelog-fontify-known-releases . font-lock-string-face)
- ;; bug closers
- (;"\\(closes:\\) *\\(\\(bug\\)?#? *[0-9]+\\(, *\\(bug\\)?#? *[0-9]+\\)*\\)"
- ;; Process lines that continue on multiple lines - Fred Bothamy
- "\\(closes:\\)[ \t\n]*\\(\\(bug\\)?#? *[0-9]+\\(,[ \t\n]*\\(bug\\)?#? *[0-9]+\\)*\\)"
- (1 font-lock-keyword-face)
- (2 debian-changelog-warning-face))
- ("^\t.*$" . debian-changelog-warning-face)
- ;; maintainer line (enforce 2 space exactly between email and date)
- ("^ -- \\(.+\\) <\\(.+@.+\\)> \\([^ ].+\\)$"
- (1 font-lock-variable-name-face)
- (2 font-lock-variable-name-face)
- (3 font-lock-string-face)))
+ (debian-changelog-fontify-stable . debian-changelog-warning-face)
+ (debian-changelog-fontify-backports . debian-changelog-warning-face)
+ (debian-changelog-fontify-frozen . font-lock-type-face)
+ (debian-changelog-fontify-unstable . font-lock-string-face)
+ (debian-changelog-fontify-experimental . debian-changelog-warning-face)
+ (debian-changelog-fontify-unreleased . debian-changelog-warning-face)
+ (debian-changelog-fontify-urgency-crit . debian-changelog-warning-face)
+ (debian-changelog-fontify-urgency-high . debian-changelog-warning-face)
+ (debian-changelog-fontify-urgency-med . font-lock-type-face)
+ (debian-changelog-fontify-urgency-low . font-lock-string-face)
+ (debian-changelog-fontify-known-releases . font-lock-string-face)
+ ;; bug closers
+ (;"\\(closes:\\) *\\(\\(bug\\)?#? *[0-9]+\\(, *\\(bug\\)?#? *[0-9]+\\)*\\)"
+ ;; Process lines that continue on multiple lines - Fred Bothamy
+ "\\(closes:\\)[ \t\n]*\\(\\(bug\\)?#? *[0-9]+\\(,[ \t\n]*\\(bug\\)?#? *[0-9]+\\)*\\)"
+ (1 font-lock-keyword-face)
+ (2 debian-changelog-warning-face))
+ ("^\t.*$" . debian-changelog-warning-face)
+ ;; maintainer line (enforce 2 space exactly between email and date)
+ ("^ -- \\(.+\\) <\\(.+@.+\\)> \\([^ ].+\\)$"
+ (1 font-lock-variable-name-face)
+ (2 font-lock-variable-name-face)
+ (3 font-lock-string-face)))
"First level highlighting for `debian-changelog-mode'.")
(defvar debian-changelog-font-lock-keywords-2
--
2.39.2
>From 5fdaca54f90893d4a5f1200ecaafc4f4a8ac9751 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Fri, 18 Oct 2024 19:09:44 +0200
Subject: [PATCH 24/27] readme-debian-date-string: replace an unneeded let*
with let
---
readme-debian.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/readme-debian.el b/readme-debian.el
index 162dc4f..bdc4c25 100644
--- a/readme-debian.el
+++ b/readme-debian.el
@@ -54,8 +54,8 @@
;; this function could be simpler if xemacs supported %z, but
;; it doesn't, so we're shelling out to invoke date -R to obtain
;; Debian-policy-compliant date string.
- (let* ((date-program "date -R")
- (system-time-locale "C"))
+ (let ((date-program "date -R")
+ (system-time-locale "C"))
(if (featurep 'xemacs)
(replace-in-string (exec-to-string date-program) "\n" "")
;; if it's not xemacs, just use format-time-string
--
2.39.2
>From e49f463584daaf7dc9330149db44390f0a9b3739 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Fri, 18 Oct 2024 19:12:40 +0200
Subject: [PATCH 25/27] Simplify some uses of looking-at
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Especially, use point-at-[be]ol eobp bolp… that are guaranteed with
both emacs and xemacs.
---
debian-control-mode.el | 46 +++++++++++++-----------------------------
readme-debian.el | 24 +++++++++++-----------
2 files changed, 26 insertions(+), 44 deletions(-)
diff --git a/debian-control-mode.el b/debian-control-mode.el
index 5de0013..952bc31 100644
--- a/debian-control-mode.el
+++ b/debian-control-mode.el
@@ -128,16 +128,6 @@
;; XEmacs compatibility
(eval-and-compile
- (unless (fboundp 'line-beginning-position)
- (defun line-beginning-position ()
- (save-excursion
- (beginning-of-line)
- (point))))
- (unless (fboundp 'line-end-position)
- (defun line-end-position ()
- (save-excursion
- (end-of-line)
- (point))))
(unless (fboundp 'match-string-no-properties)
(defalias 'match-string-no-properties 'match-string)))
@@ -340,27 +330,19 @@ It should be immediately followed by a non-slash character.")
(goto-char beg)
(beginning-of-line)
(while (< (point) end)
- (cond ((looking-at (concat "^\\(Source:\\)\\s-*"
- debian-control-package-name-regexp
- "\\s-*$"))
- (add-text-properties
- (match-beginning 2) (match-end 2)
- `(mouse-face
- highlight
- debian-control-mode-package ,(match-string 2)
- help-echo "C-mouse-2: View bugs for this source package"
- keymap ,debian-control-mode-package-name-keymap)))
- ((looking-at (concat "^\\(Package:\\)\\s-*"
- debian-control-package-name-regexp
- "\\s-*$"))
- (add-text-properties
- (match-beginning 2) (match-end 2)
- `(mouse-face
- highlight
- debian-control-mode-package ,(match-string 2)
- help-echo "C-mouse-2: View bugs for this binary package"
- keymap ,debian-control-mode-package-name-keymap)))
- (t nil))
+ (when (looking-at (concat "^\\(Source\\|Package\\):\\s-*"
+ debian-control-package-name-regexp
+ "\\s-*$"))
+ (add-text-properties
+ (match-beginning 2) (match-end 2)
+ `(mouse-face
+ highlight
+ debian-control-mode-package ,(match-string 2)
+ help-echo ,(format "C-mouse-2: View bugs for this %s package"
+ (if (string-prefix-p "S" (match-string 1))
+ "source"
+ "binary"))
+ keymap ,debian-control-mode-package-name-keymap)))
(forward-line 1)))
(set-match-data data)
(set-buffer-modified-p modified)))))
@@ -396,7 +378,7 @@ It should be immediately followed by a non-slash character.")
(beginning-of-line)
(looking-at debian-control-field-regexp))
(setq beg (match-end 0)
- end (line-end-position))
+ end (point-at-eol))
;; Otherwise, we're looking at a description; handle filling
;; areas separated with "." specially
(setq beg (save-excursion
diff --git a/readme-debian.el b/readme-debian.el
index bdc4c25..c05c656 100644
--- a/readme-debian.el
+++ b/readme-debian.el
@@ -66,18 +66,18 @@
Automatically invoked when saving file."
(save-excursion
(goto-char (point-min))
- (if (re-search-forward "^ -- " nil t)
- (delete-region (progn (beginning-of-line) (point)) (progn (end-of-line) (point)))
- (goto-char (point-max))
- (if (bolp)
- (insert "\n")
- (insert "\n\n")))
- (insert (concat
- " -- "
- debian-changelog-full-name
- " <" debian-changelog-mailing-address ">, "
- (readme-debian-date-string)))
- (if (and (= (point)(point-max)) (not (bolp)))
+ (cond
+ ((re-search-forward "^ -- " nil 1)
+ (delete-region (point-at-bol) (point-at-eol)))
+ ((bolp)
+ (insert "\n"))
+ (t
+ (insert "\n\n")))
+ (insert " -- "
+ debian-changelog-full-name
+ " <" debian-changelog-mailing-address ">, "
+ (readme-debian-date-string))
+ (if (and (eobp) (not (bolp)))
(insert "\n"))))
(defvar readme-debian-mode-map
--
2.39.2
>From 76a9fc6f158365581c296e46c32de4f5c461a1a7 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Fri, 18 Oct 2024 19:22:37 +0200
Subject: [PATCH 26/27] debian-control-mode-add-field: simplify, remove a
variable
---
debian-control-mode.el | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/debian-control-mode.el b/debian-control-mode.el
index 952bc31..6b2c486 100644
--- a/debian-control-mode.el
+++ b/debian-control-mode.el
@@ -441,23 +441,22 @@ It should be immediately followed by a non-slash character.")
(point))))
(save-restriction
(narrow-to-region beg end)
- (let ((curfields (let ((result nil))
- (goto-char (point-min))
- (while (not (eobp))
- (when (looking-at debian-control-field-regexp)
- (push (cons (seq-subseq
- ;; Text properties are evil
- (match-string-no-properties 1)
- 0
- ;; Strip off the ':'
- (- (match-end 1)
- (match-beginning 1)
- 1))
- (match-beginning 0))
- result))
- (forward-line 1))
- result))
- (x nil))
+ (let ((curfields nil) x)
+ ;; Populate curfields
+ (goto-char (point-min))
+ (while (not (eobp))
+ (when (looking-at debian-control-field-regexp)
+ (push (cons (seq-subseq
+ ;; Text properties are evil
+ (match-string-no-properties 1)
+ 0
+ ;; Strip off the ':'
+ (- (match-end 1)
+ (match-beginning 1)
+ 1))
+ (match-beginning 0))
+ curfields))
+ (forward-line 1))
;; If the field is already present, just jump to it
(if (setq x (assoc field curfields))
(goto-char (cdr x))
--
2.39.2
>From f3217839897853a885a85efa4e2017c0b58c3f36 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Fri, 18 Oct 2024 22:11:31 +0200
Subject: [PATCH 27/27] dpkg-dev-el: replace an incorrect let with let*
---
dpkg-dev-el.el | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dpkg-dev-el.el b/dpkg-dev-el.el
index 9fd0665..70e3473 100644
--- a/dpkg-dev-el.el
+++ b/dpkg-dev-el.el
@@ -113,10 +113,10 @@
If [package] is a debian native (no separate changelog.Debian) then answer
`utf-8', otherwise remove ourselves from `file-coding-system-alist' and see
what other rules say."
- (let ((filename (if (consp (cadr args))
- (car (cadr args)) ;; ("filename" . buffer) in emacs 22
- (cadr args))) ;; "filename" in emacs 21
- (dirname (file-name-directory filename)))
+ (let* ((filename (if (consp (cadr args))
+ (car (cadr args)) ;; ("filename" . buffer) in emacs 22
+ (cadr args))) ;; "filename" in emacs 21
+ (dirname (file-name-directory filename)))
(if (file-exists-p (concat dirname "changelog.Debian.gz"))
(let ((file-coding-system-alist
(remove '("/usr/share/doc/[^/]+/changelog\\'"
--
2.39.2
--- End Message ---