Browse Source

Use ‘eq’ instead of ‘equal’ for symbols

* lisp/ob-C.el (org-babel-C-val-to-C-type):
* lisp/ob-core.el (org-babel-get-colnames):
(org-babel-disassemble-tables):
* lisp/ob-lua.el (org-babel-lua-var-to-lua):
(org-babel-lua-table-or-string):
* lisp/ob-python.el (org-babel-python-var-to-python):
(org-babel-python-table-or-string):
* lisp/ob-ruby.el (org-babel-ruby-var-to-ruby):
(org-babel-ruby-table-or-string):
* lisp/ob-shell.el (org-babel-sh-var-to-string):
* lisp/ob-sqlite.el (org-babel-sqlite-table-or-scalar):
* lisp/org-agenda.el (org-agenda-prepare-window):
(org-compile-prefix-format):
* lisp/org-bibtex.el (org-bibtex-headline):
* lisp/org-capture.el (org-capture):
* lisp/org-colview.el (org-columns-next-allowed-value):
* lisp/org-mhe.el (org-mhe-store-link):
(org-mhe-get-message-real-folder):
(org-mhe-get-message-folder):
(org-mhe-get-message-num):
(org-mhe-get-header):
(org-mhe-follow-link):
* lisp/org-table.el (org-define-lookup-function):
* lisp/org.el (format-spec):
* lisp/ox-odt.el (org-odt--translate-description-lists):
* lisp/ox-publish.el (org-publish-compare-directory-files):
Use `eq' instead of `equal' when comparing to symbols.
* lisp/org-timer.el (org-timer-set-mode-line):
* lisp/org-capture.el (org-capture-finalize):
Use `cl-case' instead of `(cond ((eq x 'foo) ...) ...)'.
Aaron Ecay 2 years ago
parent
commit
140aacbf2f

+ 7 - 7
lisp/ob-C.el

@@ -305,7 +305,7 @@ FORMAT can be either a format string or a function which is called with VAL."
 	    (`floatp '("double" "%f"))
 	    (`stringp
 	     (list
-	      (if (equal org-babel-c-variant 'd) "string" "const char*")
+	      (if (eq org-babel-c-variant 'd) "string" "const char*")
 	      "\"%s\""))
 	    (_ (error "unknown type %S" basetype)))))
     (cond
@@ -317,25 +317,25 @@ FORMAT can be either a format string or a function which is called with VAL."
 	  (cons
 	   (format "[%d][%d]" (length val) (length (car val)))
 	   (concat
-	    (if (equal org-babel-c-variant 'd) "[\n" "{\n")
+	    (if (eq org-babel-c-variant 'd) "[\n" "{\n")
 	    (mapconcat
 	     (lambda (v)
 	       (concat
-		(if (equal org-babel-c-variant 'd) " [" " {")
+		(if (eq org-babel-c-variant 'd) " [" " {")
 		(mapconcat (lambda (w) (format ,(cadr type) w)) v ",")
-		(if (equal org-babel-c-variant 'd) "]" "}")))
+		(if (eq org-babel-c-variant 'd) "]" "}")))
 	     val
 	     ",\n")
-	    (if (equal org-babel-c-variant 'd) "\n]" "\n}"))))))
+	    (if (eq org-babel-c-variant 'd) "\n]" "\n}"))))))
      ((or (listp val) (vectorp val)) ;; a list declared in the #+begin_src line
       `(,(car type)
 	(lambda (val)
 	  (cons
 	   (format "[%d]" (length val))
 	   (concat
-	    (if (equal org-babel-c-variant 'd) "[" "{")
+	    (if (eq org-babel-c-variant 'd) "[" "{")
 	    (mapconcat (lambda (v) (format ,(cadr type) v)) val ",")
-	    (if (equal org-babel-c-variant 'd) "]" "}"))))))
+	    (if (eq org-babel-c-variant 'd) "]" "}"))))))
      (t ;; treat unknown types as string
       type))))
 

+ 1 - 1
lisp/ob-calc.el

@@ -95,7 +95,7 @@
 
 (defun org-babel-calc-maybe-resolve-var (el)
   (if (consp el)
-      (if (and (equal 'var (car el)) (member (cadr el) org--var-syms))
+      (if (and (eq 'var (car el)) (member (cadr el) org--var-syms))
 	  (progn
 	    (calc-recall (cadr el))
 	    (prog1 (calc-top 1)

+ 2 - 2
lisp/ob-core.el

@@ -1552,7 +1552,7 @@ shown below.
 Return a cons cell, the `car' of which contains the TABLE less
 colnames, and the `cdr' of which contains a list of the column
 names."
-  (if (equal 'hline (nth 1 table))
+  (if (eq 'hline (nth 1 table))
       (cons (cddr table) (car table))
     (cons (cdr table) (car table))))
 
@@ -1610,7 +1610,7 @@ of the vars, cnames and rnames."
       (lambda (var)
         (when (listp (cdr var))
           (when (and (not (equal colnames "no"))
-                     (or colnames (and (equal (nth 1 (cdr var)) 'hline)
+                     (or colnames (and (eq (nth 1 (cdr var)) 'hline)
                                        (not (member 'hline (cddr (cdr var)))))))
             (let ((both (org-babel-get-colnames (cdr var))))
               (setq cnames (cons (cons (car var) (cdr both))

+ 3 - 3
lisp/ob-lua.el

@@ -146,7 +146,7 @@ specifying a variable of the same value."
              "="
              (org-babel-lua-var-to-lua (cdr var)))
           (concat "{" (mapconcat #'org-babel-lua-var-to-lua var ", ") "}")))
-    (if (equal var 'hline)
+    (if (eq var 'hline)
         org-babel-lua-hline-to
       (format
        (if (and (stringp var) (string-match "[\n\r]" var)) "\"\"%S\"\"" "%S")
@@ -158,8 +158,8 @@ If the results look like a list or tuple, then convert them into an
 Emacs-lisp table, otherwise return the results as a string."
   (let ((res (org-babel-script-escape results)))
     (if (listp res)
-        (mapcar (lambda (el) (if (equal el 'None)
-                            org-babel-lua-None-to el))
+        (mapcar (lambda (el) (if (eq el 'None)
+				 org-babel-lua-None-to el))
                 res)
       res)))
 

+ 2 - 2
lisp/ob-python.el

@@ -133,7 +133,7 @@ Convert an elisp value, VAR, into a string of python source code
 specifying a variable of the same value."
   (if (listp var)
       (concat "[" (mapconcat #'org-babel-python-var-to-python var ", ") "]")
-    (if (equal var 'hline)
+    (if (eq var 'hline)
 	org-babel-python-hline-to
       (format
        (if (and (stringp var) (string-match "[\n\r]" var)) "\"\"%S\"\"" "%S")
@@ -145,7 +145,7 @@ If the results look like a list or tuple, then convert them into an
 Emacs-lisp table, otherwise return the results as a string."
   (let ((res (org-babel-script-escape results)))
     (if (listp res)
-        (mapcar (lambda (el) (if (equal el 'None)
+        (mapcar (lambda (el) (if (eq el 'None)
                             org-babel-python-None-to el))
                 res)
       res)))

+ 3 - 3
lisp/ob-ruby.el

@@ -129,7 +129,7 @@ Convert an elisp value into a string of ruby source code
 specifying a variable of the same value."
   (if (listp var)
       (concat "[" (mapconcat #'org-babel-ruby-var-to-ruby var ", ") "]")
-    (if (equal var 'hline)
+    (if (eq var 'hline)
 	org-babel-ruby-hline-to
       (format "%S" var))))
 
@@ -139,8 +139,8 @@ If RESULTS look like a table, then convert them into an
 Emacs-lisp table, otherwise return the results as a string."
   (let ((res (org-babel-script-escape results)))
     (if (listp res)
-        (mapcar (lambda (el) (if (equal el 'nil)
-                            org-babel-ruby-nil-to el))
+        (mapcar (lambda (el) (if (not el)
+				 org-babel-ruby-nil-to el))
                 res)
       res)))
 

+ 1 - 1
lisp/ob-shell.el

@@ -168,7 +168,7 @@ var of the same value."
   "Convert an elisp value to a string."
   (let ((echo-var (lambda (v) (if (stringp v) v (format "%S" v)))))
     (cond
-     ((and (listp var) (or (listp (car var)) (equal (car var) 'hline)))
+     ((and (listp var) (or (listp (car var)) (eq (car var) 'hline)))
       (orgtbl-to-generic var  (list :sep (or sep "\t") :fmt echo-var
 				    :hline hline)))
      ((listp var)

+ 1 - 1
lisp/ob-sqlite.el

@@ -139,7 +139,7 @@ This function is called by `org-babel-execute-src-block'."
 	   (equal 1 (length (car result))))
       (org-babel-read (caar result))
     (mapcar (lambda (row)
-	      (if (equal 'hline row)
+	      (if (eq 'hline row)
 		  'hline
 		(mapcar #'org-babel-string-read row))) result)))
 

+ 9 - 9
lisp/org-agenda.el

@@ -3613,16 +3613,16 @@ FILTER-ALIST is an alist of filters we need to apply when
      ((equal (current-buffer) abuf) nil)
      (awin (select-window awin))
      ((not (setq wconf (current-window-configuration))))
-     ((equal org-agenda-window-setup 'current-window)
+     ((eq org-agenda-window-setup 'current-window)
       (pop-to-buffer-same-window abuf))
-     ((equal org-agenda-window-setup 'other-window)
+     ((eq org-agenda-window-setup 'other-window)
       (org-switch-to-buffer-other-window abuf))
-     ((equal org-agenda-window-setup 'other-frame)
+     ((eq org-agenda-window-setup 'other-frame)
       (switch-to-buffer-other-frame abuf))
      ((eq org-agenda-window-setup 'only-window)
       (delete-other-windows)
       (pop-to-buffer-same-window abuf))
-     ((equal org-agenda-window-setup 'reorganize-frame)
+     ((eq org-agenda-window-setup 'reorganize-frame)
       (delete-other-windows)
       (org-switch-to-buffer-other-window abuf)))
     (setq org-agenda-tag-filter (cdr (assq 'tag filter-alist)))
@@ -6719,12 +6719,12 @@ and stored in the variable `org-prefix-format-compiled'."
 	    c (or (match-string 3 s) "")
 	    opt (match-beginning 1)
 	    start (1+ (match-beginning 0)))
-      (if (equal var 'time) (setq org-prefix-has-time t))
-      (if (equal var 'tag)  (setq org-prefix-has-tag  t))
-      (if (equal var 'effort) (setq org-prefix-has-effort t))
-      (if (equal var 'breadcrumbs) (setq org-prefix-has-breadcrumbs t))
+      (if (eq var 'time) (setq org-prefix-has-time t))
+      (if (eq var 'tag)  (setq org-prefix-has-tag  t))
+      (if (eq var 'effort) (setq org-prefix-has-effort t))
+      (if (eq var 'breadcrumbs) (setq org-prefix-has-breadcrumbs t))
       (setq f (concat "%" (match-string 2 s) "s"))
-      (when (equal var 'category)
+      (when (eq var 'category)
 	(setq org-prefix-category-length
 	      (floor (abs (string-to-number (match-string 2 s)))))
 	(setq org-prefix-category-max-length

+ 1 - 1
lisp/org-bibtex.el

@@ -371,7 +371,7 @@ and `org-exclude-tags-from-inheritence'."
 			       (mapcar
 				(lambda (field)
 				  (let ((value (or (org-bibtex-get (funcall from field))
-						   (and (equal :title field)
+						   (and (eq :title field)
 							(nth 4 (org-heading-components))))))
 				    (when value (cons (funcall from field) value))))
 				(funcall flatten

+ 4 - 4
lisp/org-capture.el

@@ -625,7 +625,7 @@ of the day at point (if any) or the current HH:MM time."
 	    (org-capture-insert-template-here)
 	  (condition-case error
 	      (org-capture-place-template
-	       (equal (car (org-capture-get :target)) 'function))
+	       (eq (car (org-capture-get :target)) 'function))
 	    ((error quit)
 	     (if (and (buffer-base-buffer (current-buffer))
 		      (string-prefix-p "CAPTURE-" (buffer-name)))
@@ -799,10 +799,10 @@ captured item after finalizing."
     ;; Special cases
     (cond
      (abort-note
-      (cond
-       ((equal abort-note 'clean)
+      (cl-case abort-note
+       ('clean
 	(message "Capture process aborted and target buffer cleaned up"))
-       ((equal abort-note 'dirty)
+       ('dirty
 	(error "Capture process aborted, but target buffer could not be cleaned up correctly"))))
      (stay-with-capture
       (org-capture-goto-last-stored)))

+ 1 - 1
lisp/org-colview.el

@@ -679,7 +679,7 @@ an integer, select that value."
 	     (t (car allowed))))
 	   (action (lambda () (org-entry-put pom key new))))
       (cond
-       ((equal major-mode 'org-agenda-mode)
+       ((eq major-mode 'org-agenda-mode)
 	(org-columns--call action)
 	;; The following let preserves the current format, and makes
 	;; sure that in only a single file things need to be updated.

+ 9 - 9
lisp/org-mhe.el

@@ -79,8 +79,8 @@ supported by MH-E."
 ;; Implementation
 (defun org-mhe-store-link ()
   "Store a link to an MH-E folder or message."
-  (when (or (equal major-mode 'mh-folder-mode)
-	    (equal major-mode 'mh-show-mode))
+  (when (or (eq major-mode 'mh-folder-mode)
+	    (eq major-mode 'mh-show-mode))
     (save-window-excursion
       (let* ((from (org-mhe-get-header "From:"))
 	     (to (org-mhe-get-header "To:"))
@@ -111,7 +111,7 @@ supported by MH-E."
 So if you use sequences, it will now work."
   (save-excursion
     (let* ((folder
-	    (if (equal major-mode 'mh-folder-mode)
+	    (if (eq major-mode 'mh-folder-mode)
 		mh-current-folder
 	      ;; Refer to the show buffer
 	      mh-show-folder-buffer))
@@ -123,7 +123,7 @@ So if you use sequences, it will now work."
       ;; mh-index-data is always nil in a show buffer.
       (if (and (boundp 'mh-index-folder)
 	       (string= mh-index-folder (substring folder 0 end-index)))
-	  (if (equal major-mode 'mh-show-mode)
+	  (if (eq major-mode 'mh-show-mode)
 	      (save-window-excursion
 		(let (pop-up-frames)
 		  (when (buffer-live-p (get-buffer folder))
@@ -149,7 +149,7 @@ So if you use sequences, it will now work."
   "Return the name of the current message folder.
 Be careful if you use sequences."
   (save-excursion
-    (if (equal major-mode 'mh-folder-mode)
+    (if (eq major-mode 'mh-folder-mode)
 	mh-current-folder
       ;; Refer to the show buffer
       mh-show-folder-buffer)))
@@ -158,7 +158,7 @@ Be careful if you use sequences."
   "Return the number of the current message.
 Be careful if you use sequences."
   (save-excursion
-    (if (equal major-mode 'mh-folder-mode)
+    (if (eq major-mode 'mh-folder-mode)
 	(mh-get-msg-num nil)
       ;; Refer to the show buffer
       (mh-show-buffer-message-number))))
@@ -173,12 +173,12 @@ you have a better idea of how to do this then please let us know."
 	 (header-field))
     (with-current-buffer buffer
       (mh-display-msg num folder)
-      (if (equal major-mode 'mh-folder-mode)
+      (if (eq major-mode 'mh-folder-mode)
 	  (mh-header-display)
 	(mh-show-header-display))
       (set-buffer buffer)
       (setq header-field (mh-get-header-field header))
-      (if (equal major-mode 'mh-folder-mode)
+      (if (eq major-mode 'mh-folder-mode)
 	  (mh-show)
 	(mh-show-show))
       (org-trim header-field))))
@@ -197,7 +197,7 @@ folders."
   (if (not article)
       (mh-visit-folder (mh-normalize-folder-name folder))
     (mh-search-choose)
-    (if (equal mh-searcher 'pick)
+    (if (eq mh-searcher 'pick)
 	(progn
 	  (setq article (org-add-angle-brackets article))
 	  (mh-search folder (list "--message-id" article))

+ 2 - 2
lisp/org-table.el

@@ -5444,8 +5444,8 @@ distinguished from a plain table name or ID."
 
 (defmacro org-define-lookup-function (mode)
   (let ((mode-str (symbol-name mode))
-	(first-p (equal mode 'first))
-	(all-p (equal mode 'all)))
+	(first-p (eq mode 'first))
+	(all-p (eq mode 'all)))
     (let ((plural-str (if all-p "s" "")))
       `(defun ,(intern (format "org-lookup-%s" mode-str)) (val s-list r-list &optional predicate)
 	 ,(format "Find %s occurrence%s of VAL in S-LIST; return corresponding element%s of R-LIST.

+ 5 - 4
lisp/org-timer.el

@@ -35,6 +35,7 @@
 
 ;;; Code:
 
+(require 'cl-lib)
 (require 'org-clock)
 
 (declare-function org-agenda-error "org-agenda" ())
@@ -342,8 +343,8 @@ VALUE can be `on', `off', or `paused'."
     (or (memq 'org-timer-mode-line-string frame-title-format)
 	(setq frame-title-format
 	      (append frame-title-format '(org-timer-mode-line-string)))))
-  (cond
-   ((equal value 'off)
+  (cl-case value
+   ('off
     (when org-timer-mode-line-timer
       (cancel-timer org-timer-mode-line-timer)
       (setq org-timer-mode-line-timer nil))
@@ -356,11 +357,11 @@ VALUE can be `on', `off', or `paused'."
       (setq frame-title-format
 	    (delq 'org-timer-mode-line-string frame-title-format)))
     (force-mode-line-update))
-   ((equal value 'paused)
+   ('paused
     (when org-timer-mode-line-timer
       (cancel-timer org-timer-mode-line-timer)
       (setq org-timer-mode-line-timer nil)))
-   ((equal value 'on)
+   ('on
     (when (or (eq org-timer-display 'mode-line)
 	      (eq org-timer-display 'both))
       (or global-mode-string (setq global-mode-string '("")))

+ 1 - 1
lisp/org.el

@@ -77,7 +77,7 @@
 (require 'find-func)
 (require 'format-spec)
 
-(or (equal this-command 'eval-buffer)
+(or (eq this-command 'eval-buffer)
     (condition-case nil
 	(load (concat (file-name-directory load-file-name)
 		      "org-loaddefs.el")

+ 1 - 1
lisp/ox-odt.el

@@ -3827,7 +3827,7 @@ contextual information."
   ;;
   (org-element-map tree 'plain-list
     (lambda (el)
-      (when (equal (org-element-property :type el) 'descriptive)
+      (when (eq (org-element-property :type el) 'descriptive)
 	(org-element-set-element
 	 el
 	 (apply 'org-element-adopt-elements

+ 2 - 2
lisp/ox-publish.el

@@ -436,10 +436,10 @@ This splices all the components into the list."
         ;; a is directory, b not:
         (cond
          ((and (file-directory-p a) (not (file-directory-p b)))
-          (setq retval (equal org-publish-sitemap-sort-folders 'first)))
+          (setq retval (eq org-publish-sitemap-sort-folders 'first)))
 	 ;; a is not a directory, but b is:
          ((and (not (file-directory-p a)) (file-directory-p b))
-          (setq retval (equal org-publish-sitemap-sort-folders 'last))))))
+          (setq retval (eq org-publish-sitemap-sort-folders 'last))))))
     retval))
 
 (defun org-publish-get-base-files-1