[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnorb ceb5c8c: Fix some warnings and lexical-binding bu
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnorb ceb5c8c: Fix some warnings and lexical-binding bugs |
Date: |
Thu, 15 Apr 2021 13:09:48 -0400 (EDT) |
branch: externals/gnorb
commit ceb5c8c9b6041cdab9cc6607c3dac223d6dd09b9
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
Fix some warnings and lexical-binding bugs
* gnorb-utils.el (org-capture-entry): Declare var.
* gnorb-org.el: Remove redundant `:group` args.
* gnorb-gnus.el (crm-separator): Declare var.
(gnorb-summary-minor-mode): Avoid pre-Emacs-21 calling convention of
`define-minor-mode`.
* gnorb-bbdb.el (crm-separator, crm-local-completion-map): Declare vars.
(gnorb-bbdb-configure-posting-styles): Use lexical-binding.
(gnorb-bbdb-tag-agenda): Prefer `derived-mode-p`.
(gnorb-bbdb-open-link): New function, extracted from
`gnorb-bbdb-mouse-open-link`.
(gnorb-bbdb-mouse-open-link, gnorb-bbdb-RET-open-link): Redefine as
obsolete aliases.
---
gnorb-bbdb.el | 37 ++++++++++++++++++-------------------
gnorb-gnus.el | 28 +++++++++++++++-------------
gnorb-org.el | 22 +++++++---------------
gnorb-utils.el | 6 ++++--
4 files changed, 44 insertions(+), 49 deletions(-)
diff --git a/gnorb-bbdb.el b/gnorb-bbdb.el
index e961152..a21f8d6 100644
--- a/gnorb-bbdb.el
+++ b/gnorb-bbdb.el
@@ -1,6 +1,6 @@
;;; gnorb-bbdb.el --- The BBDB-centric functions of gnorb -*-
lexical-binding: t -*-
-;; Copyright (C) 2018-2020 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
;; Author: Eric Abrahamsen <eric@ericabrahamsen.net>
@@ -170,6 +170,9 @@ be composed, just as in `gnus-posting-styles'."
(lambda (record indent)
(gnorb-bbdb-display-org-tags record indent))))
+(defvar crm-separator)
+(defvar crm-local-completion-map)
+
(defun gnorb-bbdb-read-org-tags (&optional init)
"Read Org mode tags, with `completing-read-multiple'."
(if (string< "24.3" (substring emacs-version 0 4))
@@ -316,7 +319,7 @@ is non-nil (as in interactive calls) be verbose."
((boundp value)
(symbol-value value))))
((listp value)
- (eval value))))
+ (eval value t))))
;; Post-processing for the signature posting-style:
(and (eq element 'signature) filep
message-signature-directory
@@ -400,13 +403,13 @@ prefix operates on all currently visible records. If you
want
both, use \"C-u\" before the \"*\"."
(interactive (list (bbdb-do-records)))
(require 'org-agenda)
- (unless (and (eq major-mode 'bbdb-mode)
+ (unless (and (derived-mode-p 'bbdb-mode)
(equal (buffer-name) bbdb-buffer-name))
(error "Only works in the BBDB buffer"))
(setq records (bbdb-record-list records))
(let ((tag-string
(mapconcat
- 'identity
+ #'identity
(delete-dups
(cl-mapcan
(lambda (r)
@@ -470,8 +473,8 @@ layout type."
(val (bbdb-record-xfield record gnorb-bbdb-messages-field))
(map (make-sparse-keymap))
(count 1)) ; one-indexed to fit with prefix arg to
`gnorb-bbdb-open-link'
- (define-key map [mouse-1] 'gnorb-bbdb-mouse-open-link)
- (define-key map (kbd "<RET>") 'gnorb-bbdb-RET-open-link)
+ (define-key map [mouse-1] #'gnorb-bbdb-open-link)
+ (define-key map (kbd "<RET>") #'gnorb-bbdb-open-link)
(when val
(when (eq format 'multi)
(bbdb-display-text (format (format " %%%ds: " (- indent 3))
@@ -551,7 +554,7 @@ that contact will start collecting links to messages."
(user-error "This function only works with the git version of BBDB"))
(let (msg-list target-msg)
(if (not (memq gnorb-bbdb-messages-field
- (mapcar 'car (bbdb-record-xfields record))))
+ (mapcar #'car (bbdb-record-xfields record))))
(when (y-or-n-p
(format "Start collecting message links for %s?"
(bbdb-record-name record)))
@@ -570,17 +573,13 @@ that contact will start collecting links to messages."
(org-gnus-follow-link (gnorb-bbdb-link-group target-msg)
(gnorb-bbdb-link-id target-msg))))))
-(defun gnorb-bbdb-mouse-open-link (event)
- (interactive "e")
- (mouse-set-point event)
- (let ((rec (bbdb-current-record))
- (num (get-text-property (point) 'gnorb-bbdb-link-count)))
- (if (not num)
- (user-error "No link under point")
- (gnorb-bbdb-open-link rec num))))
+(define-obsolete-function-alias 'gnorb-bbdb-mouse-open-link
#'gnorb-bbdb-open-link "Apr 2021")
+(define-obsolete-function-alias 'gnorb-bbdb-RET-open-link
+ #'gnorb-bbdb-open-link "Apr 2021")
-(defun gnorb-bbdb-RET-open-link ()
- (interactive)
+(defun gnorb-bbdb-open-link (&optional event)
+ (interactive (list last-nonmenu-event))
+ (posn-set-point (event-end event))
(let ((rec (bbdb-current-record))
(num (get-text-property (point) 'gnorb-bbdb-link-count)))
(if (not num)
@@ -604,7 +603,7 @@ to a message into the record's `gnorb-bbdb-messages-field'."
(let* ((val (bbdb-record-xfield record gnorb-bbdb-messages-field))
(art-no (gnus-summary-article-number))
(heads (gnus-summary-article-header art-no))
- (date (apply 'encode-time
+ (date (apply #'encode-time
(parse-time-string (mail-header-date heads))))
(subject (mail-header-subject heads))
(id (mail-header-id heads))
@@ -631,7 +630,7 @@ to a message into the record's `gnorb-bbdb-messages-field'."
(delq nil val))
(bbdb-change-record record))))))
-(add-hook 'bbdb-notice-record-hook 'gnorb-bbdb-store-message-link)
+(add-hook 'bbdb-notice-record-hook #'gnorb-bbdb-store-message-link)
(provide 'gnorb-bbdb)
;;; gnorb-bbdb.el ends here
diff --git a/gnorb-gnus.el b/gnorb-gnus.el
index f34c816..46f5c92 100644
--- a/gnorb-gnus.el
+++ b/gnorb-gnus.el
@@ -1,6 +1,6 @@
;;; gnorb-gnus.el --- The gnus-centric fuctions of gnorb -*- lexical-binding:
t -*-
-;; Copyright (C) 2018-2020 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
;; Author: Eric Abrahamsen <eric@ericabrahamsen.net>
@@ -760,6 +760,8 @@ sender:google.com subject:\"your search results\""
(gnorb-gnus-nnir-registry-search artlist)))
(message "No results found"))))
+(defvar crm-separator)
+
;;;###autoload
(defun gnorb-gnus-tag-message (arg &optional tags)
"Tag message or messages with TAGS.
@@ -808,7 +810,7 @@ exclude. See Info node `(org)Matching tags and
properties'."
(tagged-messages (registry-search gnus-registry-db
:regex `((org-tags ".+"))
:member `((group
,gnus-newsgroup-name))))
- (old (sort (mapcar 'car gnus-newsgroup-data) '<))
+ (old (sort (mapcar #'car gnus-newsgroup-data) #'<))
selected-messages)
;; Funcall the matcher with t, (list of tags), and 1.
(dolist (m tagged-messages)
@@ -833,7 +835,7 @@ SHOW-ALL (interactively, the prefix arg) is non-nil, insert
all
messages; otherwise only insert messages that are tracked by a
heading in a non-DONE state."
(interactive "P")
- (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
+ (let ((old (sort (mapcar #'car gnus-newsgroup-data) '<))
(tracked-messages
(registry-search gnus-registry-db
:regex `((gnorb-ids ".+"))
@@ -993,7 +995,7 @@ Gnorb-tracked messages.
While active, this mode provides some Gnorb-specific commands,
and also advises Gnus' reply-related commands in order to
continue to provide tracking of sent messages."
- nil " Gnorb" gnorb-summary-minor-mode-map
+ :lighter " Gnorb"
(setq gnorb-gnus-attachment-file-list
;; Copy the list of attached files from the nnir-tmp-buffer to
;; this summary buffer.
@@ -1003,10 +1005,10 @@ continue to provide tracking of sent messages."
(define-key gnorb-summary-minor-mode-map
[remap gnus-summary-exit]
- 'gnorb-summary-exit)
+ #'gnorb-summary-exit)
(define-key gnorb-summary-minor-mode-map (kbd "C-c d")
- 'gnorb-summary-disassociate-message)
+ #'gnorb-summary-disassociate-message)
;; All this is pretty horrible, but it's the only way to get sane
;; behavior, there are no appropriate hooks, and I want to avoid
@@ -1014,31 +1016,31 @@ continue to provide tracking of sent messages."
(define-key gnorb-summary-minor-mode-map
[remap gnus-summary-very-wide-reply-with-original]
- 'gnorb-summary-very-wide-reply-with-original)
+ #'gnorb-summary-very-wide-reply-with-original)
(define-key gnorb-summary-minor-mode-map
[remap gnus-summary-wide-reply-with-original]
- 'gnorb-summary-wide-reply-with-original)
+ #'gnorb-summary-wide-reply-with-original)
(define-key gnorb-summary-minor-mode-map
[remap gnus-summary-reply]
- 'gnorb-summary-reply)
+ #'gnorb-summary-reply)
(define-key gnorb-summary-minor-mode-map
[remap gnus-summary-very-wide-reply]
- 'gnorb-summary-very-wide-reply)
+ #'gnorb-summary-very-wide-reply)
(define-key gnorb-summary-minor-mode-map
[remap gnus-summary-reply-with-original]
- 'gnorb-summary-reply-with-original)
+ #'gnorb-summary-reply-with-original)
(define-key gnorb-summary-minor-mode-map
[remap gnus-summary-wide-reply]
- 'gnorb-summary-wide-reply)
+ #'gnorb-summary-wide-reply)
(define-key gnorb-summary-minor-mode-map
[remap gnus-summary-mail-forward]
- 'gnorb-summary-mail-forward)
+ #'gnorb-summary-mail-forward)
(defun gnorb-summary-wide-reply (&optional yank)
(interactive
diff --git a/gnorb-org.el b/gnorb-org.el
index 77594d8..44f7763 100644
--- a/gnorb-org.el
+++ b/gnorb-org.el
@@ -1,6 +1,6 @@
;;; gnorb-org.el --- The Org-centric functions of gnorb -*- lexical-binding: t
-*-
-;; Copyright (C) 2018-2020 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
;; Author: Eric Abrahamsen <eric@ericabrahamsen.net>
@@ -314,7 +314,7 @@ headings."
(message-goto-to)
(when messages
(insert ", "))
- (insert (mapconcat 'identity mails ", ")))
+ (insert (mapconcat #'identity mails ", ")))
;; Commenting this out because
;; `gnorb-gnus-check-outgoing-headers' is set unconditionally in the
;; `message-send-hook, so this should be redundant. Also, we've
@@ -489,28 +489,24 @@ composed. FILE is a file to attach to the message."
"A plist of export parameters corresponding to the EXT-PLIST
argument to the export functions, for use when exporting to
text."
- :group 'gnorb-org
:type 'boolean)
(defcustom gnorb-org-email-subtree-file-parameters nil
"A plist of export parameters corresponding to the EXT-PLIST
argument to the export functions, for use when exporting to a
file."
- :group 'gnorb-org
:type 'boolean)
(defcustom gnorb-org-email-subtree-text-options '(nil t nil t)
"A list of ts and nils corresponding to Org's export options,
to be used when exporting to text. The options, in order, are
async, subtreep, visible-only, and body-only."
- :group 'gnorb-org
:type 'list)
(defcustom gnorb-org-email-subtree-file-options '(nil t nil nil)
"A list of ts and nils corresponding to Org's export options,
to be used when exporting to a file. The options, in order, are
async, subtreep, visible-only, and body-only."
- :group 'gnorb-org
:type 'list)
(defcustom gnorb-org-export-extensions
@@ -527,7 +523,6 @@ async, subtreep, visible-only, and body-only."
"Correspondence between export backends and their
respective (usual) file extensions. Ugly way to do it, but what
the hey..."
- :group 'gnorb-org
:type '(repeat
(list symbol string)))
@@ -572,7 +567,7 @@ default set of parameters."
gnorb-org-email-subtree-file-options))
(result
(if (equal f-or-t "text")
- (apply 'org-export-to-buffer
+ (apply #'org-export-to-buffer
`(,backend-symbol
"*Gnorb Export*"
,@opts
@@ -586,7 +581,7 @@ default set of parameters."
(apply #'org-odt-export-to-odt
(append (cl-subseq gnorb-org-email-subtree-file-options
0 3)
(list gnorb-org-email-subtree-file-parameters)))
- (apply 'org-export-to-file
+ (apply #'org-export-to-file
`(,backend-symbol
,(org-export-output-file-name
(cl-second (assoc backend-symbol
gnorb-org-export-extensions))
@@ -603,7 +598,6 @@ default set of parameters."
"Should the capture process store a link to the gnus message or
BBDB record under point, even if it's not part of the template?
You'll probably end up needing it, anyway."
- :group 'gnorb-org
:type 'boolean)
(defun gnorb-org-capture-function ()
@@ -671,7 +665,7 @@ captured from onto the Org heading being captured.
(gnus-summary-update-article art-no)))))
-(add-hook 'org-capture-mode-hook 'gnorb-org-capture-function)
+(add-hook 'org-capture-mode-hook #'gnorb-org-capture-function)
(defvar org-note-abort)
@@ -689,7 +683,7 @@ captured from onto the Org heading being captured.
(setq abort-note 'dirty))))))
(add-hook 'org-capture-prepare-finalize-hook
- 'gnorb-org-capture-abort-cleanup)
+ #'gnorb-org-capture-abort-cleanup)
;;; Agenda/BBDB popup stuff
@@ -700,12 +694,10 @@ captured from onto the Org heading being captured.
Records are considered matching if they have an `org-tags' field
matching the current Agenda search. The name of that field can be
customized with `gnorb-bbdb-org-tag-field'."
- :group 'gnorb-org
:type 'boolean)
(defcustom gnorb-org-bbdb-popup-layout 'pop-up-multi-line
"Default BBDB buffer layout for automatic Org Agenda display."
- :group 'gnorb-org
:type '(choice (const one-line)
(const multi-line)
(const full-multi-line)
@@ -790,7 +782,7 @@ search."
(message "No relevant BBDB records")))))
(if (featurep 'gnorb-bbdb)
- (add-hook 'org-agenda-finalize-hook 'gnorb-org-popup-bbdb))
+ (add-hook 'org-agenda-finalize-hook #'gnorb-org-popup-bbdb))
;;; Groups from the gnorb gnus server backend
diff --git a/gnorb-utils.el b/gnorb-utils.el
index 3d27852..77d4573 100644
--- a/gnorb-utils.el
+++ b/gnorb-utils.el
@@ -1,6 +1,6 @@
;;; gnorb-utils.el --- Common utilities for all gnorb stuff -*-
lexical-binding: t -*-
-;; Copyright (C) 2018-2020 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
;; Author: Eric Abrahamsen <eric@ericabrahamsen.net>
@@ -317,6 +317,8 @@ numbers (no upper bound)."
(when-let ((win (get-buffer-window gnorb-select-choice-buffer)))
(quit-window win))))))
+(defvar org-capture-entry)
+
(defun gnorb-trigger-todo-action (_arg &optional id)
"Do the actual restore action. Two main things here. First: if
we were in the agenda when this was called, then keep us in the
@@ -635,7 +637,7 @@ registry be in use, and should be called after the call to
(defun gnorb-install-defaults ()
"Set up sane Gnorb customizations and keybindings."
(interactive)
- (global-set-key (kbd "C-c A") 'gnorb-restore-layout)
+ (global-set-key (kbd "C-c A") #'gnorb-restore-layout)
(eval-after-load "gnorb-bbdb"
'(progn
(define-key bbdb-mode-map (kbd "C-c S") #'gnorb-bbdb-mail-search)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/gnorb ceb5c8c: Fix some warnings and lexical-binding bugs,
Stefan Monnier <=