[PATCH] Silencing the compiler for `backward-delete-char'

Arash Esbati <[email protected]> Thu, 16 Mar 2023 11:35:27 +0100
Newsgroups gmane.emacs.bbdb.user
Message-ID <[email protected]>
--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi,

please find attached a small change silencing the compiler warning:

In bbdb-display-record-one-line:
bbdb.el:4046:10: Warning: =E2=80=98backward-delete-char=E2=80=99 is for int=
eractive use only;
    use =E2=80=98delete-char=E2=80=99 instead.

--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Silence-the-compiler-for-backward-delete-char.patch

From 412def20fe8a6c7f733f37eeabaf8d861267cdfc Mon Sep 17 00:00:00 2001
From: Arash Esbati <[email protected]>
Date: Thu, 16 Mar 2023 11:21:50 +0100
Subject: [PATCH] Silence the compiler for `backward-delete-char'

* lisp/bbdb.el (bbdb-display-record-one-line): Use `delete-char'
instead of `backward-delete-char' which is intended for
interactive use only.
---
 lisp/bbdb.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/bbdb.el b/lisp/bbdb.el
index e18c54b..0f0744d 100644
--- a/lisp/bbdb.el
+++ b/lisp/bbdb.el
@@ -4043,7 +4043,7 @@ FIELD-LIST is the list of actually displayed FIELDS."
                     `(xfields ,xfield)))))))
     ;; delete the trailing "; "
     (if (looking-back "; " nil)
-        (backward-delete-char 2))
+        (delete-char -2))
     (insert "\n")))
 
 (defun bbdb-display-record-multi-line (record layout field-list)
-- 
2.40.0


--=-=-=
Content-Type: text/plain


I'm also attaching a follow up to my suggestion in this message[1]
reg. bbdb-anniv.el.  The new change also changes the given example and
removes the entry for `nnimap-split-rule' which was declared obsolete in
2010.  Please decide yourself which change is more appropriate.

--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=0001-Silence-the-compiler.patch

From cf4a05ad93deb84fa7c17b1edbc51b00c24d0a90 Mon Sep 17 00:00:00 2001
From: Arash Esbati <[email protected]>
Date: Thu, 16 Mar 2023 11:04:54 +0100
Subject: [PATCH] Silence the compiler

* lisp/bbdb-anniv.el (bbdb-anniv-diary-entries): Remove
unnecessary quoting of opening paren.
Fix unescaped single quotes.

* lisp/bbdb-gnus-aux.el (bbdb/gnus-nnimap-folder-list-from-bbdb):
Remove unnecessary quoting of opening paren.
Fix unescaped single quotes.
Replace example code using a select method and server variables
instead of hard-coding with `setq'.
Delete entry for `nnimap-split-rule' which was declared obsolete
in 2010 and is finally removed in Emacs 29.
---
 lisp/bbdb-anniv.el    |  2 +-
 lisp/bbdb-gnus-aux.el | 26 +++++++++++++-------------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/lisp/bbdb-anniv.el b/lisp/bbdb-anniv.el
index 99f8521..22022a4 100644
--- a/lisp/bbdb-anniv.el
+++ b/lisp/bbdb-anniv.el
@@ -77,7 +77,7 @@ as format string."
 This obeys `calendar-date-style' via `diary-date-forms'.
 To enable this feature, put the following into your .emacs:
 
- \(add-hook 'diary-list-entries-hook 'bbdb-anniv-diary-entries)"
+  (add-hook \\='diary-list-entries-hook \\='bbdb-anniv-diary-entries)"
   ;; Loop over NUMBER dates starting from ORGINAL-DATE.
   (let* ((num-date (1- (calendar-absolute-from-gregorian original-date)))
          (end-date (+ num-date number)))
diff --git a/lisp/bbdb-gnus-aux.el b/lisp/bbdb-gnus-aux.el
index f2050d8..d8397c9 100644
--- a/lisp/bbdb-gnus-aux.el
+++ b/lisp/bbdb-gnus-aux.el
@@ -318,31 +318,31 @@ determine the group and spooling priority for a single address."
 ;;
 ;;;###autoload
 (defun bbdb/gnus-nnimap-folder-list-from-bbdb ()
-  "Return a list of \( \"From\" mail-regexp imap-folder-name\) tuples
+  "Return a list of (\"From\" mail-regexp imap-folder-name) tuples
 based on the contents of the bbdb.
 
-The folder-name is the value of the 'imap attribute of the BBDB record;
+The folder-name is the value of the \\='imap attribute of the BBDB record;
 the mail-regexp consists of all the mail addresses for the BBDB record
-concatenated with OR.  Records without an 'imap attribute are ignored.
+concatenated with OR.  Records without an \\='imap attribute are ignored.
 
-Here  is an example of a relevant BBDB record:
+Here is an example of a relevant BBDB record:
 
-Uwe Brauer
-           mail: [email protected]
-           imap: testimap
+  Uwe Brauer
+             mail: [email protected]
+             imap: testimap
 
 This function uses `regexp-opt' to generate the mail-regexp which automatically
 `regexp-quote's its arguments.  Please note: in order that this will work with
 the `nnimap-split-fancy' method you have to use macros, that is your setting
 will look like:
 
-\(setq nnimap-split-rule  'nnimap-split-fancy
-       nnimap-split-inbox \"INBOX\"
-       nnimap-split-fancy
-       `\(| ,@\(bbdb/gnus-nnimap-folder-list-from-bbdb\)
-            ... \)\)
+  (setq gnus-secondary-select-methods
+        \\=`((nnimap \"imap.example.com\")
+          (nnimap-split-inbox \"INBOX\")
+          (| ,@(bbdb/gnus-nnimap-folder-list-from-bbdb)
+             ... )))
 
-Note that `\( is the backquote, NOT the quote '\(."
+Note that \\=`( is the backquote, NOT the quote \\='(."
 
   (let (;; the value of the 'imap attribute of a bbdb record
         folder-attr
-- 
2.40.0


--=-=-=
Content-Type: text/plain


Best, Arash

Footnotes:
[1]  https://lists.nongnu.org/archive/html/bbdb-user/2022-07/msg00009.html


--=-=-=--