emacs-diffs
[Top][All Lists]
Advanced

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

master 80c9871: Use lexical-binding in a few more scattered files


From: Stefan Monnier
Subject: master 80c9871: Use lexical-binding in a few more scattered files
Date: Tue, 9 Feb 2021 13:27:24 -0500 (EST)

branch: master
commit 80c9871428aca6927b3723d1808497e8cb78e17b
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    Use lexical-binding in a few more scattered files
    
    * lisp/registry.el: Use lexical-binding.
    (registry-reindex): Remove unused var `values`.
    
    * lisp/cedet/pulse.el: Use lexical-binding.
    
    * lisp/cedet/semantic/idle.el: Use lexical-binding.
    (semantic-idle-core-handler): Remove unused var `safe`.
    (ede-auto-add-method): Declare var.
    (define-semantic-idle-service): Use `declare`.  Remove unused var `setup`.
    (pulse-flag): Declare var.
    
    * lisp/net/ldap.el: Use lexical-binding.
    (ldap-search-internal): Remove unused var `proc`.
    
    * lisp/net/mairix.el: Use lexical-binding.
    Remove redundant `:group` args.
    (mairix-widget-create-query): Remove unnused var `allwidgets`.
---
 lisp/cedet/pulse.el         |   4 +-
 lisp/cedet/semantic/idle.el |  30 ++++-----
 lisp/net/ldap.el            |  10 +--
 lisp/net/mairix.el          | 145 ++++++++++++++++++++------------------------
 lisp/registry.el            |  33 +++++-----
 5 files changed, 103 insertions(+), 119 deletions(-)

diff --git a/lisp/cedet/pulse.el b/lisp/cedet/pulse.el
index aef4fc8..3257feb 100644
--- a/lisp/cedet/pulse.el
+++ b/lisp/cedet/pulse.el
@@ -1,6 +1,6 @@
-;;; pulse.el --- Pulsing Overlays
+;;; pulse.el --- Pulsing Overlays  -*- lexical-binding: t; -*-
 
-;;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Version: 1.0
diff --git a/lisp/cedet/semantic/idle.el b/lisp/cedet/semantic/idle.el
index 9f1bcfa..29cc818 100644
--- a/lisp/cedet/semantic/idle.el
+++ b/lisp/cedet/semantic/idle.el
@@ -1,4 +1,4 @@
-;;; idle.el --- Schedule parsing tasks in idle time
+;;; idle.el --- Schedule parsing tasks in idle time  -*- lexical-binding: t; 
-*-
 
 ;; Copyright (C) 2003-2006, 2008-2021 Free Software Foundation, Inc.
 
@@ -222,18 +222,18 @@ And also manages services that depend on tag values."
                                             (and (buffer-file-name b)
                                                  b))
                                         (buffer-list)))))
-          safe ;; This safe is not used, but could be.
+          ;; safe ;; This safe is not used, but could be.
            others
           mode)
       (when (semantic-idle-scheduler-enabled-p)
         (save-excursion
           ;; First, reparse the current buffer.
-          (setq mode major-mode
-                safe (semantic-safe "Idle Parse Error: %S"
-                      ;(error "Goofy error 1")
-                      (semantic-idle-scheduler-refresh-tags)
-                      )
-               )
+          (setq mode major-mode)
+          ;; (setq safe
+         (semantic-safe "Idle Parse Error: %S"
+                                        ;(error "Goofy error 1")
+                        (semantic-idle-scheduler-refresh-tags))
+
           ;; Now loop over other buffers with same major mode, trying to
           ;; update them as well.  Stop on keypress.
           (dolist (b buffers)
@@ -430,6 +430,8 @@ datasets."
       (message "Long Work Idle Timer...%s" exit-type)))
   )
 
+(defvar ede-auto-add-method)
+
 (defun semantic-idle-scheduler-work-parse-neighboring-files ()
   "Parse all the files in similar directories to buffers being edited."
   ;; Let's tell EDE to ignore all the files we're about to load
@@ -564,11 +566,12 @@ DOC will be a documentation string describing FORMS.
 FORMS will be called during idle time after the current buffer's
 semantic tag information has been updated.
 This routine creates the following functions and variables:"
+  (declare (indent 1) (debug (&define name stringp def-body)))
   (let ((global (intern (concat "global-" (symbol-name name) "-mode")))
        (mode   (intern (concat (symbol-name name) "-mode")))
        (hook   (intern (concat (symbol-name name) "-mode-hook")))
        (map    (intern (concat (symbol-name name) "-mode-map")))
-       (setup  (intern (concat (symbol-name name) "-mode-setup")))
+       ;; (setup       (intern (concat (symbol-name name) "-mode-setup")))
        (func   (intern (concat (symbol-name name) "-idle-function"))))
 
     `(progn
@@ -618,11 +621,6 @@ turned on in every Semantic-supported buffer.")
         ,(concat "Perform idle activity for the minor mode `"
                  (symbol-name mode) "'.")
         ,@forms))))
-(put 'define-semantic-idle-service 'lisp-indent-function 1)
-(add-hook 'edebug-setup-hook
-          (lambda ()
-           (def-edebug-spec define-semantic-idle-service
-             (&define name stringp def-body))))
 
 ;;; SUMMARY MODE
 ;;
@@ -821,6 +819,8 @@ turned on in every Semantic-supported buffer."
 (make-obsolete-variable 'semantic-idle-symbol-highlight-face
     "customize the face `semantic-idle-symbol-highlight' instead" "24.4" 'set)
 
+(defvar pulse-flag)
+
 (defun semantic-idle-symbol-maybe-highlight (tag)
   "Perhaps add highlighting to the symbol represented by TAG.
 TAG was found as the symbol under point.  If it happens to be
@@ -1231,7 +1231,7 @@ shortened at the beginning."
   )
 
 (defun semantic-idle-breadcrumbs--format-linear
-  (tag-list &optional max-length)
+  (tag-list &optional _max-length)
   "Format TAG-LIST as a linear list, starting with the outermost tag.
 MAX-LENGTH is not used."
   (require 'semantic/analyze/fcn)
diff --git a/lisp/net/ldap.el b/lisp/net/ldap.el
index 0476835..7997bf3 100644
--- a/lisp/net/ldap.el
+++ b/lisp/net/ldap.el
@@ -1,4 +1,4 @@
-;;; ldap.el --- client interface to LDAP for Emacs
+;;; ldap.el --- client interface to LDAP for Emacs  -*- lexical-binding: t; -*-
 
 ;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
 
@@ -418,12 +418,12 @@ RFC2798 Section 9.1.1")
   (encode-coding-string str ldap-coding-system))
 
 (defun ldap-decode-address (str)
-  (mapconcat 'ldap-decode-string
+  (mapconcat #'ldap-decode-string
             (split-string str "\\$")
             "\n"))
 
 (defun ldap-encode-address (str)
-  (mapconcat 'ldap-encode-string
+  (mapconcat #'ldap-encode-string
             (split-string str "\n")
             "$"))
 
@@ -601,7 +601,7 @@ an alist of attribute/value pairs."
        (sizelimit (plist-get search-plist 'sizelimit))
        (withdn (plist-get search-plist 'withdn))
        (numres 0)
-       arglist dn name value record result proc)
+       arglist dn name value record result)
     (if (or (null filter)
            (equal "" filter))
        (error "No search filter"))
@@ -671,7 +671,7 @@ an alist of attribute/value pairs."
                                   " bind distinguished name (binddn)"))
                  (error "Failed ldapsearch invocation: %s \"%s\""
                         ldap-ldapsearch-prog
-                        (mapconcat 'identity proc-args "\" \""))))))
+                        (mapconcat #'identity proc-args "\" \""))))))
        (apply #'call-process ldap-ldapsearch-prog
               ;; Ignore stderr, which can corrupt results
               nil (list buf nil) nil
diff --git a/lisp/net/mairix.el b/lisp/net/mairix.el
index 08edb44..024d118 100644
--- a/lisp/net/mairix.el
+++ b/lisp/net/mairix.el
@@ -1,4 +1,4 @@
-;;; mairix.el --- Mairix interface for Emacs
+;;; mairix.el --- Mairix interface for Emacs  -*- lexical-binding: t; -*-
 
 ;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
 
@@ -83,55 +83,46 @@
 
 (defcustom mairix-file-path "~/"
   "Path where output files produced by Mairix should be stored."
-  :type 'directory
-  :group 'mairix)
+  :type 'directory)
 
 (defcustom mairix-search-file "mairixsearch.mbox"
   "Name of the default file for storing the searches.
 Note that this will be prefixed by `mairix-file-path'."
-  :type 'string
-  :group 'mairix)
+  :type 'string)
 
 (defcustom mairix-command "mairix"
   "Command for calling mairix.
 You can add further options here if you want to, but better use
 `mairix-update-options' instead."
-  :type 'string
-  :group 'mairix)
+  :type 'string)
 
 (defcustom mairix-output-buffer "*mairix output*"
   "Name of the buffer for the output of the mairix binary."
-  :type 'string
-  :group 'mairix)
+  :type 'string)
 
 (defcustom mairix-customize-query-buffer "*mairix query*"
   "Name of the buffer for customizing a search query."
-  :type 'string
-  :group 'mairix)
+  :type 'string)
 
 (defcustom mairix-saved-searches-buffer "*mairix searches*"
   "Name of the buffer for displaying saved searches."
-  :type 'string
-  :group 'mairix)
+  :type 'string)
 
 (defcustom mairix-update-options '("-F" "-Q")
   "Options when calling mairix for updating the database.
 The default is \"-F\" and \"-Q\" for making updates faster.  You
 should call mairix without these options from time to
 time (e.g. via cron job)."
-  :type '(repeat string)
-  :group 'mairix)
+  :type '(repeat string))
 
 (defcustom mairix-search-options '("-Q")
   "Options when calling mairix for searching.
 The default is \"-Q\" for making searching faster."
-  :type '(repeat string)
-  :group 'mairix)
+  :type '(repeat string))
 
 (defcustom mairix-synchronous-update nil
   "Defines if Emacs should wait for the mairix database update."
-  :type 'boolean
-  :group 'mairix)
+  :type 'boolean)
 
 (defcustom mairix-saved-searches nil
   "Saved mairix searches.
@@ -144,8 +135,7 @@ threads (nil or t).  Note that the file will be prefixed by
                       (choice :tag "File"
                               (const :tag "default")
                               file)
-                      (boolean :tag "Threads")))
-  :group 'mairix)
+                      (boolean :tag "Threads"))))
 
 (defcustom mairix-mail-program 'rmail
   "Mail program used to display search results.
@@ -153,8 +143,7 @@ Currently RMail, Gnus (mbox), and VM are supported.  If you 
use Gnus
 with maildir, use nnmairix.el instead."
   :type '(choice (const :tag "RMail" rmail)
                 (const :tag "Gnus mbox" gnus)
-                (const :tag "VM" vm))
-  :group 'mairix)
+                (const :tag "VM" vm)))
 
 (defcustom mairix-display-functions
   '((rmail mairix-rmail-display)
@@ -166,8 +155,7 @@ This is an alist where each entry consists of a symbol from
 displaying the search results.  The function will be called with
 the mailbox file produced by mairix as the single argument."
   :type '(repeat (list (symbol :tag "Mail program")
-                      (function)))
-  :group 'mairix)
+                      (function))))
 
 (defcustom mairix-get-mail-header-functions
   '((rmail mairix-rmail-fetch-field)
@@ -184,15 +172,13 @@ won't work."
   :type '(repeat (list (symbol :tag "Mail program")
                       (choice :tag "Header function"
                               (const :tag "none")
-                              function)))
-  :group 'mairix)
+                              function))))
 
 (defcustom mairix-widget-select-window-function
   (lambda () (select-window (get-largest-window)))
   "Function for selecting the window for customizing the mairix query.
 The default chooses the largest window in the current frame."
-  :type 'function
-  :group 'mairix)
+  :type 'function)
 
 ;; Other variables
 
@@ -466,18 +452,18 @@ MVALUES may contain values from current article."
   ;; generate Buttons
   (widget-create 'push-button
                 :notify
-                (lambda (&rest ignore)
+                (lambda (&rest _)
                   (mairix-widget-send-query mairix-widgets))
                 "Send Query")
   (widget-insert "   ")
   (widget-create 'push-button
                 :notify
-                (lambda (&rest ignore)
+                (lambda (&rest _)
                   (mairix-widget-save-search mairix-widgets))
                 "Save search")
   (widget-insert "   ")
   (widget-create 'push-button
-                :notify (lambda (&rest ignore)
+                :notify (lambda (&rest _)
                           (kill-buffer mairix-customize-query-buffer))
                 "Cancel")
   (use-local-map widget-keymap)
@@ -502,7 +488,7 @@ Mairix will be called asynchronously unless
                                 (cdr commandsplit)
                                 mairix-update-options))
            (setq args (append args mairix-update-options)))
-         (apply 'call-process args))
+         (apply #'call-process args))
       (progn
        (message "Updating mairix database...")
        (setq args (append (list "mairixupdate" (get-buffer-create 
mairix-output-buffer)
@@ -511,8 +497,8 @@ Mairix will be called asynchronously unless
            (setq args (append args (cdr commandsplit) mairix-update-options))
          (setq args (append args mairix-update-options)))
        (set-process-sentinel
-        (apply 'start-process args)
-        'mairix-sentinel-mairix-update-finished)))))
+        (apply #'start-process args)
+        #'mairix-sentinel-mairix-update-finished)))))
 
 
 ;;;; Helper functions
@@ -557,7 +543,7 @@ whole threads.  Function returns t if messages were found."
             mairix-file-path))
           file))
     (setq rval
-         (apply 'call-process
+         (apply #'call-process
                 (append args (list "-o" file) query)))
     (if (zerop rval)
        (with-current-buffer mairix-output-buffer
@@ -582,7 +568,7 @@ whole threads.  Function returns t if messages were found."
       (setq header (replace-match "," t t header)))
   header))
 
-(defun mairix-sentinel-mairix-update-finished (proc status)
+(defun mairix-sentinel-mairix-update-finished (_proc status)
   "Sentinel for mairix update process PROC with STATUS."
   (if (equal status "finished\n")
       (message "Updating mairix database... done")
@@ -642,51 +628,50 @@ See %s for details" mairix-output-buffer)))
       (when (not (zerop (length flag)))
        (push (concat "F:" flag) query)))
     ;; return query string
-    (mapconcat 'identity query " ")))
+    (mapconcat #'identity query " ")))
 
 (defun mairix-widget-create-query (&optional values)
   "Create widgets for creating mairix queries.
 Fill in VALUES if based on an article."
-  (let (allwidgets)
-    (when (get-buffer mairix-customize-query-buffer)
-      (kill-buffer mairix-customize-query-buffer))
-    (switch-to-buffer mairix-customize-query-buffer)
-    (kill-all-local-variables)
-    (erase-buffer)
-    (widget-insert
-     "Specify your query for Mairix using check boxes for activating 
fields.\n\n")
-    (widget-insert
-     (concat "Use ~word        to match messages "
-            (propertize "not" 'face 'italic)
-            " containing the word)\n"
-            "    substring=   to match words containing the substring\n"
-            "    substring=N  to match words containing the substring, 
allowing\n"
-            "                  up to N errors(missing/extra/different 
letters)\n"
-            "    ^substring=  to match the substring at the beginning of a 
word.\n"))
-    (widget-insert
-     (format-message
-      "Whitespace will be converted to `,' (i.e. AND).  Use `/' for OR.\n\n"))
-    (setq mairix-widgets (mairix-widget-build-editable-fields values))
-    (when (member 'flags mairix-widget-other)
-      (widget-insert "\nFlags:\n      Seen:     ")
-      (mairix-widget-add "seen"
-                          'menu-choice
-                          :value "ignore"
-                          '(item "yes") '(item "no") '(item "ignore"))
-      (widget-insert "      Replied:  ")
-      (mairix-widget-add "replied"
-                          'menu-choice
-                          :value "ignore"
-                          '(item "yes") '(item "no") '(item "ignore"))
-      (widget-insert "      Ticked:   ")
-      (mairix-widget-add "flagged"
-                          'menu-choice
-                          :value "ignore"
-                          '(item "yes") '(item "no") '(item "ignore")))
-    (when (member 'threads mairix-widget-other)
-      (widget-insert "\n")
-      (mairix-widget-add "Threads" 'checkbox nil))
-      (widget-insert " Show full threads\n\n")))
+  (when (get-buffer mairix-customize-query-buffer)
+    (kill-buffer mairix-customize-query-buffer))
+  (switch-to-buffer mairix-customize-query-buffer)
+  (kill-all-local-variables)
+  (erase-buffer)
+  (widget-insert
+   "Specify your query for Mairix using check boxes for activating 
fields.\n\n")
+  (widget-insert
+   (concat "Use ~word        to match messages "
+          (propertize "not" 'face 'italic)
+          " containing the word)\n"
+          "    substring=   to match words containing the substring\n"
+          "    substring=N  to match words containing the substring, 
allowing\n"
+          "                  up to N errors(missing/extra/different letters)\n"
+          "    ^substring=  to match the substring at the beginning of a 
word.\n"))
+  (widget-insert
+   (format-message
+    "Whitespace will be converted to `,' (i.e. AND).  Use `/' for OR.\n\n"))
+  (setq mairix-widgets (mairix-widget-build-editable-fields values))
+  (when (member 'flags mairix-widget-other)
+    (widget-insert "\nFlags:\n      Seen:     ")
+    (mairix-widget-add "seen"
+                      'menu-choice
+                      :value "ignore"
+                      '(item "yes") '(item "no") '(item "ignore"))
+    (widget-insert "      Replied:  ")
+    (mairix-widget-add "replied"
+                      'menu-choice
+                      :value "ignore"
+                      '(item "yes") '(item "no") '(item "ignore"))
+    (widget-insert "      Ticked:   ")
+    (mairix-widget-add "flagged"
+                      'menu-choice
+                      :value "ignore"
+                      '(item "yes") '(item "no") '(item "ignore")))
+  (when (member 'threads mairix-widget-other)
+    (widget-insert "\n")
+    (mairix-widget-add "Threads" 'checkbox nil))
+  (widget-insert " Show full threads\n\n"))
 
 (defun mairix-widget-build-editable-fields (values)
   "Build editable field widgets in `nnmairix-widget-fields-list'.
@@ -703,7 +688,7 @@ VALUES may contain values for editable fields from current 
article."
            (concat "c" field)
            (widget-create 'checkbox
                           :tag field
-                          :notify (lambda (widget &rest ignore)
+                          :notify (lambda (widget &rest _ignore)
                                     (mairix-widget-toggle-activate widget))
                           nil)))
          (list
@@ -727,7 +712,7 @@ VALUES may contain values for editable fields from current 
article."
   "Add a widget NAME with optional ARGS."
   (push
    (list name
-        (apply 'widget-create args))
+        (apply #'widget-create args))
    mairix-widgets))
 
 (defun mairix-widget-toggle-activate (widget)
diff --git a/lisp/registry.el b/lisp/registry.el
index a5c30f2..258f7fc 100644
--- a/lisp/registry.el
+++ b/lisp/registry.el
@@ -1,4 +1,4 @@
-;;; registry.el --- Track and remember data items by various fields
+;;; registry.el --- Track and remember data items by various fields  -*- 
lexical-binding: t; -*-
 
 ;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
 
@@ -128,7 +128,7 @@
          :type hash-table
          :documentation "The data hash table.")))
 
-(cl-defmethod initialize-instance :before ((this registry-db) slots)
+(cl-defmethod initialize-instance :before ((_this registry-db) slots)
   "Check whether a registry object needs to be upgraded."
   ;; Hardcoded upgrade routines.  Version 0.1 to 0.2 requires the
   ;; :max-soft slot to disappear, and the :max-hard slot to be renamed
@@ -212,7 +212,7 @@ When SET is not nil, set it for VAL (use t for an empty 
list)."
                       (:regex
                        (string-match (car vals)
                                      (mapconcat
-                                      'prin1-to-string
+                                      #'prin1-to-string
                                       (cdr-safe (assoc key entry))
                                       "\0"))))
               vals (cdr-safe vals)))
@@ -247,7 +247,7 @@ Updates the secondary ('tracked') indices as well.
 With assert non-nil, errors out if the key does not exist already."
   (let* ((data (oref db data))
         (keys (or keys
-                  (apply 'registry-search db spec)))
+                  (apply #'registry-search db spec)))
         (tracked (oref db tracked)))
 
     (dolist (key keys)
@@ -308,19 +308,18 @@ Errors out if the key exists already."
   (let ((count 0)
        (expected (* (length (oref db tracked)) (registry-size db))))
     (dolist (tr (oref db tracked))
-      (let (values)
-       (maphash
-        (lambda (key v)
-          (cl-incf count)
-          (when (and (< 0 expected)
-                     (= 0 (mod count 1000)))
-            (message "reindexing: %d of %d (%.2f%%)"
-                     count expected (/ (* 100.0 count) expected)))
-          (dolist (val (cdr-safe (assq tr v)))
-            (let ((value-keys (registry-lookup-secondary-value db tr val)))
-              (push key value-keys)
-              (registry-lookup-secondary-value db tr val value-keys))))
-        (oref db data))))))
+      (maphash
+       (lambda (key v)
+        (cl-incf count)
+        (when (and (< 0 expected)
+                   (= 0 (mod count 1000)))
+          (message "reindexing: %d of %d (%.2f%%)"
+                   count expected (/ (* 100.0 count) expected)))
+        (dolist (val (cdr-safe (assq tr v)))
+          (let ((value-keys (registry-lookup-secondary-value db tr val)))
+            (push key value-keys)
+            (registry-lookup-secondary-value db tr val value-keys))))
+       (oref db data)))))
 
 (cl-defmethod registry-prune ((db registry-db) &optional sortfunc)
   "Prune the registry-db object DB.



reply via email to

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