From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [elpa] externals/ebdb f7b50402cf: Final round of compiler quieting Date: Mon, 23 Oct 2023 22:40:24 -0400 Message-ID: References: <169810882764.9789.14002053467217676494@vcs2.savannah.gnu.org> <20231024005348.35660C09BE2@vcs2.savannah.gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34677"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eric Abrahamsen To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 24 04:41:52 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qv7Md-0008q6-VA for ged-emacs-devel@m.gmane-mx.org; Tue, 24 Oct 2023 04:41:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qv7LS-0001Rv-F0; Mon, 23 Oct 2023 22:40:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qv7LR-0001Rm-Kv for emacs-devel@gnu.org; Mon, 23 Oct 2023 22:40:37 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qv7LP-0004IH-1W for emacs-devel@gnu.org; Mon, 23 Oct 2023 22:40:37 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id E993480257; Mon, 23 Oct 2023 22:40:32 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1698115230; bh=UbI/abBtCqXuJc87xfwOMgGUDCLd7jXhlBxBrV4uoXE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=VyYKIRaWhjg6Fi9x9NADDPhHSJZeAdpBZY+vJTnfPcLqQGI0h5MIWLfmfT1Iskn9K gsvivMUIar1zjltA/8hJNl8m2SO4H38vilmkX55iTu91tqPsad6ijJuZeCxYwbjvM+ j/OGNgom+B8xOmRqmuGFSTrOLd9Nev7DZ+J2k+sE/O3MpzV3N5GoAWbwM8y79/9XVo Yn7MgMem6n2lDz4GZaJ2AT2a3Puz79L5zFRD4hItHLKGeEy/VmfxKRGKCAOOzPPr32 DsD2DsqvFS1JewzRmecUGTSOjqYaXJ4cMmiN6xERplUkHMUzMxvRidfueTz0/jRFYi K0QdQYzetKusQ== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id EA30B80361; Mon, 23 Oct 2023 22:40:30 -0400 (EDT) Original-Received: from pastel (unknown [45.72.216.111]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C23EE120392; Mon, 23 Oct 2023 22:40:30 -0400 (EDT) In-Reply-To: <20231024005348.35660C09BE2@vcs2.savannah.gnu.org> (Eric Abrahamsen's message of "Mon, 23 Oct 2023 20:53:47 -0400 (EDT)") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:311742 Archived-At: --=-=-= Content-Type: text/plain > Not all the way there, but I don't know what to do about the format > complaints. The suspect that problem is that your definition of `ebdb-add-to-list` duplicates its argument, so (ebdb-add-to-list X (format FOO BAR)) becomes (when (format FOO BAR) (push (format FOO BAR) X)) Since `format` always returns a string, the `when` can be optimized away so the above becomes: (progn (format FOO BAR) (push (format FOO BAR) X)) Beside the useless call to `format` there are other minor problems with this definition of `ebdb-add-to-list`, such as the fact that its arguments are not evaluated in the expected order (left to right), and the fact that the second argument gets evaluated twice, so: (ebdb-add-to-list (progn (message "hello") 'x) (progn (message "world") 3)) ends up adding 3 to x and emitting world world hello instead of hello world But the more serious problem is that `ebdb-add-to-list` is defined as a function yet it can't work as a function because its first argument is expected to be a "place" not a value. So you have to define it as a macro rather than a (define-inline) function. Also, personally I'd recommend you rename the to use a word like "push" (and to switch its args) rather than `add-to-list`, so the reader can guess that it takes an place, like `(cl-)push(new)`, rather than a symbol, like `add-to-list`. Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=ebdb.patch diff --git a/ebdb-complete.el b/ebdb-complete.el index 444af05c30..220de71602 100644 --- a/ebdb-complete.el +++ b/ebdb-complete.el @@ -81,7 +81,7 @@ (define-obsolete-function-alias 'ebdb-complete-quit-window - 'ebdb-complete-bury-ebdb-buffer "1.0.0") + #'ebdb-complete-bury-ebdb-buffer "1.0.0") (defun ebdb-complete-bury-ebdb-buffer () "Hide EBDB buffer and switch to message buffer. @@ -107,7 +107,7 @@ Before switch, this command will do some clean jobs." (define-obsolete-function-alias 'ebdb-complete-push-mail-and-quit-window - 'ebdb-complete-push-mail-and-bury-ebdb-buffer "1.0.0") + #'ebdb-complete-push-mail-and-bury-ebdb-buffer "1.0.0") (defun ebdb-complete-push-mail-and-bury-ebdb-buffer () "Push email-address to Message window and hide EBDB buffer." @@ -201,18 +201,18 @@ when in message body, this command will indent regular text." (defun ebdb-complete-keybinding-setup () "Setup ebdb-complete Keybindings." - (define-key ebdb-mode-map "q" 'ebdb-complete-bury-ebdb-buffer) - (define-key ebdb-mode-map "\C-c\C-c" 'ebdb-complete-push-mail) - (define-key ebdb-mode-map (kbd "RET") 'ebdb-complete-push-mail-and-bury-ebdb-buffer)) + (define-key ebdb-mode-map "q" #'ebdb-complete-bury-ebdb-buffer) + (define-key ebdb-mode-map "\C-c\C-c" #'ebdb-complete-push-mail) + (define-key ebdb-mode-map (kbd "RET") #'ebdb-complete-push-mail-and-bury-ebdb-buffer)) ;;;###autoload (defun ebdb-complete-enable () "Enable ebdb-complete, it will rebind TAB key in `message-mode-map'." (interactive) (require 'message) - (add-hook 'ebdb-mode-hook 'ebdb-complete-keybinding-setup) - (define-key message-mode-map "\t" 'ebdb-complete-message-tab) - (define-key mail-mode-map "\t" 'ebdb-complete-message-tab) + (add-hook 'ebdb-mode-hook #'ebdb-complete-keybinding-setup) + (define-key message-mode-map "\t" #'ebdb-complete-message-tab) + (define-key mail-mode-map "\t" #'ebdb-complete-message-tab) (message "ebdb-complete: Override EBDB keybindings: `q', `C-c C-c' and `RET'")) (provide 'ebdb-complete) diff --git a/ebdb-i18n.el b/ebdb-i18n.el index 49175d264e..5f24f3d7bf 100644 --- a/ebdb-i18n.el +++ b/ebdb-i18n.el @@ -51,8 +51,7 @@ (defcustom ebdb-i18n-ignorable-scripts '(latin) "A list of script types that should be considered \"standard\". That is, no special handling will be done for them." - :type '(repeat :tag "Script type" symbol) - :group 'ebdb-i18n) + :type '(repeat :tag "Script type" symbol)) (defcustom ebdb-i18ngroup-countries-pref-scripts nil "An alist equivalent to `ebdb-i18n-countries', but in alternate scripts. @@ -66,8 +65,7 @@ Any country name listed here will be offered along with the English version for completion, and will be preferred over the English version for display." - :type '(repeat (cons string string)) - :group 'ebdb-i18n) + :type '(repeat (cons string string))) ;; defvars come first to pacify compiler. diff --git a/ebdb-message.el b/ebdb-message.el index a32ae4e63c..7073dea3c0 100644 --- a/ebdb-message.el +++ b/ebdb-message.el @@ -64,7 +64,6 @@ configurations. Note that this should be a different symbol from that used in Gnus's article-reading config." - :group 'ebdb-mua-message :type '(choice (const nil) (symbol :tag "Window config name"))) @@ -167,7 +166,7 @@ Also fires when postponing a draft." #'ebdb-message-complete-mail-cleanup nil t))) ('nil nil) - (_ (define-key mail-mode-map "\M-\t" 'ebdb-complete-mail))) + (_ (define-key mail-mode-map "\M-\t" #'ebdb-complete-mail))) (when ebdb-message-window-configuration (add-to-list 'gnus-window-to-buffer diff --git a/ebdb-mhe.el b/ebdb-mhe.el index 57268fb718..9bc9c5450b 100644 --- a/ebdb-mhe.el +++ b/ebdb-mhe.el @@ -28,7 +28,6 @@ (require 'mh-e) (if (fboundp 'mh-version) (require 'mh-comp)) ; For mh-e 4.x -(require 'advice) (defgroup ebdb-mua-mhe nil "EBDB customizations for mhe." @@ -144,16 +143,16 @@ Returns the empty string if HEADER is not in the message." (ebdb-load)) (define-key mh-folder-mode-map ";" ebdb-mua-keymap) (when ebdb-complete-mail - (define-key mh-letter-mode-map "\M-;" 'ebdb-complete-mail) - (define-key mh-letter-mode-map "\e\t" 'ebdb-complete-mail))) + (define-key mh-letter-mode-map "\M-;" #'ebdb-complete-mail) + (define-key mh-letter-mode-map "\e\t" #'ebdb-complete-mail))) ;;;###autoload (defun ebdb-mhe-auto-update () (ebdb-mua-auto-update ebdb-mhe-auto-update-p)) -(add-hook 'mh-show-hook 'ebdb-mhe-auto-update) +(add-hook 'mh-show-hook #'ebdb-mhe-auto-update) -(add-hook 'mh-folder-mode-hook 'ebdb-insinuate-mh) +(add-hook 'mh-folder-mode-hook #'ebdb-insinuate-mh) (provide 'ebdb-mhe) ;;; ebdb-mhe.el ends here diff --git a/ebdb-rmail.el b/ebdb-rmail.el index b86d12cb15..4a4ed59675 100644 --- a/ebdb-rmail.el +++ b/ebdb-rmail.el @@ -90,9 +90,9 @@ the value of `ebdb-default-window-size'." (defun ebdb-rmail-auto-update () (ebdb-mua-auto-update ebdb-rmail-auto-update-p)) -(add-hook 'rmail-mode-hook 'ebdb-insinuate-rmail) +(add-hook 'rmail-mode-hook #'ebdb-insinuate-rmail) -(add-hook 'rmail-show-message-hook 'ebdb-rmail-auto-update) +(add-hook 'rmail-show-message-hook #'ebdb-rmail-auto-update) (provide 'ebdb-rmail) ;;; ebdb-rmail.el ends here diff --git a/ebdb-vm.el b/ebdb-vm.el index cdac018046..d7cbfd0cf2 100644 --- a/ebdb-vm.el +++ b/ebdb-vm.el @@ -118,26 +118,22 @@ the value of `ebdb-default-window-size'." (defcustom ebdb/vm-auto-folder-headers '("From:" "To:" "CC:") "The headers used by `ebdb/vm-auto-folder'. The order in this list is the order how matching will be performed." - :group 'ebdb-mua-vm :type '(repeat (string :tag "header name"))) ;;;###autoload (defcustom ebdb/vm-auto-folder-field "vm-folder" "The xfield which `ebdb/vm-auto-folder' searches for." - :group 'ebdb-mua-vm :type 'symbol) ;;;###autoload (defcustom ebdb/vm-virtual-folder-field "vm-virtual" "The xfield which `ebdb/vm-virtual-folder' searches for." - :group 'ebdb-mua-vm :type 'symbol) ;;;###autoload (defcustom ebdb/vm-virtual-real-folders nil "Real folders used for defining virtual folders. If nil use `vm-primary-inbox'." - :group 'ebdb-mua-vm :type '(choice (const :tag "Use vm-primary-inbox" nil) (repeat (string :tag "Real folder")))) @@ -255,7 +251,6 @@ Its elements may be strings used both as the field value to check for and as the label to apply to the message. If an element is a cons pair (VALUE . LABEL), VALUE is the field value to search for and LABEL is the label to apply." - :group 'ebdb-mua-vm :type '(repeat string)) (defcustom ebdb/vm-auto-add-label-field 'ebdb-mail-alias-field @@ -263,7 +258,6 @@ to search for and LABEL is the label to apply." This is either a single EBDB field or a list of fields that `ebdb/vm-auto-add-label' uses to check for labels to apply to a message. Defaults to `ebdb-mail-alias-field' which defaults to `mail-alias'." - :group 'ebdb-mua-vm :type '(choice symbol (repeat symbol))) (defun ebdb/vm-auto-add-label (record) @@ -310,7 +304,7 @@ from different senders." ebdb/vm-auto-add-label-list)))) (if labels (vm-add-message-labels - (mapconcat 'identity labels " ") 1))))) + (mapconcat #'identity labels " ") 1))))) @@ -372,11 +366,11 @@ from different senders." (unless ebdb-db-list (ebdb-load)) (define-key vm-mode-map ";" ebdb-mua-keymap) - (define-key vm-mode-map "/" 'ebdb) + (define-key vm-mode-map "/" #'ebdb) ;; `mail-mode-map' is the parent of `vm-mail-mode-map'. ;; So the following is also done by `ebdb-insinuate-mail'. (if (and ebdb-complete-mail (boundp 'vm-mail-mode-map)) - (define-key vm-mail-mode-map "\M-\t" 'ebdb-complete-mail)) + (define-key vm-mail-mode-map "\M-\t" #'ebdb-complete-mail)) ;; Set up user field for use in `vm-summary-format' ;; (1) Big solution: use whole name diff --git a/ebdb.el b/ebdb.el index e4861c2756..d73f82752a 100644 --- a/ebdb.el +++ b/ebdb.el @@ -916,17 +916,19 @@ You really should not disable debugging. But it will speed things up." ;; directly. But presumably we could replace all the object-* ;; functions with the ebdb-* inlines. -(define-inline ebdb-add-to-list (list-var element) +(defmacro ebdb-add-to-list (list-var element) ;Rename to *push* and swap args? "Add ELEMENT to the value of LIST-VAR if it isn't there yet and non-nil. The test for presence of ELEMENT is done with `equal'." - (inline-quote (when ,element (cl-pushnew ,element ,list-var :test #'equal)))) + (macroexp-let2 nil element element + `(when ,element (cl-pushnew ,element ,list-var :test #'equal)))) -(define-inline ebdb-remove-from-list (list-var element) +(defmacro ebdb-remove-from-list (list-var element) ;Rename and swap args? "Remove ELEMENT from LIST-VAR, if present. Test for presence is done with `equal'." - (inline-quote (when (and ,element ,list-var) - (setf ,list-var - (delete ,element ,list-var))))) + (macroexp-let2 nil element element + `(when ,element + ,(gv-letplace (getter setter) list-var + (funcall setter `(delete ,element ,getter)))))) ;;; Struct and object definitions. --=-=-=--