Browse Source

Remove useless (t nil) sexps at the end of some (cond ...) constructs

* org.el (org-compute-latex-and-specials-regexp)
(org-paste-subtree, org-sort-entries, org-store-link)
(org-open-at-point, org-file-remote-p, org-add-log-setup)
(org-set-tags-to, org-fast-tag-selection)
(org-diary-sexp-entry): Ditto.

* org-agenda.el (org-agenda-get-blocks, org-cmp-priority)
(org-cmp-effort, org-cmp-todo-state, org-cmp-alpha)
(org-cmp-tag, org-cmp-time): Remove useless (t nil) sexps at
the end of (cond ...) constructs.

* org-mobile.el (org-mobile-create-index-file): Ditto.

* org-lparse.el (org-lparse-format-table-row): Ditto.

* org-list.el (org-sort-list): Ditto.

* org-id.el (org-id-get): Ditto.

* org-html.el (org-export-html-preprocess): Ditto.

* org-exp.el (org-default-export-plist)
(org-table-clean-before-export): Ditto.

(t nil) in (cond (...) (...) (t nil)) has no other meaning that to
remind the developer that the cond sexp returns nil in case no condition
is matched.  For several (cond ...) constructs this is obvious from reading
the code.  For others, the reminder might be useful and we leave it.

See the discussion about this on emacs-devel:
http://thread.gmane.org/gmane.emacs.devel/152664
Bastien Guerry 12 years ago
parent
commit
655da8d1d3
8 changed files with 28 additions and 56 deletions
  1. 9 18
      lisp/org-agenda.el
  2. 3 6
      lisp/org-exp.el
  3. 1 2
      lisp/org-html.el
  4. 1 2
      lisp/org-id.el
  5. 1 2
      lisp/org-list.el
  6. 1 2
      lisp/org-lparse.el
  7. 1 2
      lisp/org-mobile.el
  8. 11 22
      lisp/org.el

+ 9 - 18
lisp/org-agenda.el

@@ -5718,8 +5718,7 @@ FRACTION is what fraction of the head-warning time has passed."
                                      ((= d1 d0)
                                      ((= d1 d0)
 				      (concat "<" start-time ">"))
 				      (concat "<" start-time ">"))
 				     ((= d2 d0)
 				     ((= d2 d0)
-				      (concat "<" end-time ">"))
-				     (t nil))
+				      (concat "<" end-time ">")))
 			       remove-re))))
 			       remove-re))))
 		(org-add-props txt props
 		(org-add-props txt props
 		  'org-marker marker 'org-hd-marker hdmarker
 		  'org-marker marker 'org-hd-marker hdmarker
@@ -6178,8 +6177,7 @@ could bind the variable in the options section of a custom command.")
   (let ((pa (or (get-text-property 1 'priority a) 0))
   (let ((pa (or (get-text-property 1 'priority a) 0))
 	(pb (or (get-text-property 1 'priority b) 0)))
 	(pb (or (get-text-property 1 'priority b) 0)))
     (cond ((> pa pb) +1)
     (cond ((> pa pb) +1)
-	  ((< pa pb) -1)
-	  (t nil))))
+	  ((< pa pb) -1))))
 
 
 (defsubst org-cmp-effort (a b)
 (defsubst org-cmp-effort (a b)
   "Compare the effort values of string A and B."
   "Compare the effort values of string A and B."
@@ -6187,16 +6185,14 @@ could bind the variable in the options section of a custom command.")
 	 (ea (or (get-text-property 1 'effort-minutes a) def))
 	 (ea (or (get-text-property 1 'effort-minutes a) def))
 	 (eb (or (get-text-property 1 'effort-minutes b) def)))
 	 (eb (or (get-text-property 1 'effort-minutes b) def)))
     (cond ((> ea eb) +1)
     (cond ((> ea eb) +1)
-	  ((< ea eb) -1)
-	  (t nil))))
+	  ((< ea eb) -1))))
 
 
 (defsubst org-cmp-category (a b)
 (defsubst org-cmp-category (a b)
   "Compare the string values of categories of strings A and B."
   "Compare the string values of categories of strings A and B."
   (let ((ca (or (get-text-property 1 'org-category a) ""))
   (let ((ca (or (get-text-property 1 'org-category a) ""))
 	(cb (or (get-text-property 1 'org-category b) "")))
 	(cb (or (get-text-property 1 'org-category b) "")))
     (cond ((string-lessp ca cb) -1)
     (cond ((string-lessp ca cb) -1)
-	  ((string-lessp cb ca) +1)
-	  (t nil))))
+	  ((string-lessp cb ca) +1))))
 
 
 (defsubst org-cmp-todo-state (a b)
 (defsubst org-cmp-todo-state (a b)
   "Compare the todo states of strings A and B."
   "Compare the todo states of strings A and B."
@@ -6218,8 +6214,7 @@ could bind the variable in the options section of a custom command.")
     (cond ((and donepa (not donepb)) -1)
     (cond ((and donepa (not donepb)) -1)
 	  ((and (not donepa) donepb) +1)
 	  ((and (not donepa) donepb) +1)
 	  ((< la lb) -1)
 	  ((< la lb) -1)
-	  ((< lb la) +1)
-	  (t nil))))
+	  ((< lb la) +1))))
 
 
 (defsubst org-cmp-alpha (a b)
 (defsubst org-cmp-alpha (a b)
   "Compare the headlines, alphabetically."
   "Compare the headlines, alphabetically."
@@ -6240,8 +6235,7 @@ could bind the variable in the options section of a custom command.")
     (cond ((not ta) +1)
     (cond ((not ta) +1)
 	  ((not tb) -1)
 	  ((not tb) -1)
 	  ((string-lessp ta tb) -1)
 	  ((string-lessp ta tb) -1)
-	  ((string-lessp tb ta) +1)
-	  (t nil))))
+	  ((string-lessp tb ta) +1))))
 
 
 (defsubst org-cmp-tag (a b)
 (defsubst org-cmp-tag (a b)
   "Compare the string values of the first tags of A and B."
   "Compare the string values of the first tags of A and B."
@@ -6250,8 +6244,7 @@ could bind the variable in the options section of a custom command.")
     (cond ((not ta) +1)
     (cond ((not ta) +1)
 	  ((not tb) -1)
 	  ((not tb) -1)
 	  ((string-lessp ta tb) -1)
 	  ((string-lessp ta tb) -1)
-	  ((string-lessp tb ta) +1)
-	  (t nil))))
+	  ((string-lessp tb ta) +1))))
 
 
 (defsubst org-cmp-time (a b)
 (defsubst org-cmp-time (a b)
   "Compare the time-of-day values of strings A and B."
   "Compare the time-of-day values of strings A and B."
@@ -6259,16 +6252,14 @@ could bind the variable in the options section of a custom command.")
 	 (ta (or (get-text-property 1 'time-of-day a) def))
 	 (ta (or (get-text-property 1 'time-of-day a) def))
 	 (tb (or (get-text-property 1 'time-of-day b) def)))
 	 (tb (or (get-text-property 1 'time-of-day b) def)))
     (cond ((< ta tb) -1)
     (cond ((< ta tb) -1)
-	  ((< tb ta) +1)
-	  (t nil))))
+	  ((< tb ta) +1))))
 
 
 (defsubst org-cmp-habit-p (a b)
 (defsubst org-cmp-habit-p (a b)
   "Compare the todo states of strings A and B."
   "Compare the todo states of strings A and B."
   (let ((ha (get-text-property 1 'org-habit-p a))
   (let ((ha (get-text-property 1 'org-habit-p a))
 	(hb (get-text-property 1 'org-habit-p b)))
 	(hb (get-text-property 1 'org-habit-p b)))
     (cond ((and ha (not hb)) -1)
     (cond ((and ha (not hb)) -1)
-	  ((and (not ha) hb) +1)
-	  (t nil))))
+	  ((and (not ha) hb) +1))))
 
 
 (defsubst org-em (x y list) (or (memq x list) (memq y list)))
 (defsubst org-em (x y list) (or (memq x list) (memq y list)))
 
 

+ 3 - 6
lisp/org-exp.el

@@ -731,8 +731,7 @@ Each element is a list of 3 items:
       (setq s (nth 2 e)
       (setq s (nth 2 e)
 	    v (cond
 	    v (cond
 	       ((assq s letbind) (nth 1 (assq s letbind)))
 	       ((assq s letbind) (nth 1 (assq s letbind)))
-	       ((boundp s) (symbol-value s))
-	       (t nil))
+	       ((boundp s) (symbol-value s)))
 	    rtn (cons (car e) (cons v rtn))))
 	    rtn (cons (car e) (cons v rtn))))
     rtn))
     rtn))
 
 
@@ -3260,8 +3259,7 @@ If yes remove the column and the special lines."
 			 (mapcar (lambda (x)
 			 (mapcar (lambda (x)
 				   (cond ((member x '("<" "&lt;")) :start)
 				   (cond ((member x '("<" "&lt;")) :start)
 					 ((member x '(">" "&gt;")) :end)
 					 ((member x '(">" "&gt;")) :end)
-					 ((member x '("<>" "&lt;&gt;")) :startend)
-					 (t nil)))
+					 ((member x '("<>" "&lt;&gt;")) :startend)))
 				 (org-split-string x "[ \t]*|[ \t]*")))
 				 (org-split-string x "[ \t]*|[ \t]*")))
 		   nil)
 		   nil)
 		  ((org-table-cookie-line-p x)
 		  ((org-table-cookie-line-p x)
@@ -3282,8 +3280,7 @@ If yes remove the column and the special lines."
 		     (mapcar (lambda (x)
 		     (mapcar (lambda (x)
 			       (cond ((member x '("<" "&lt;")) :start)
 			       (cond ((member x '("<" "&lt;")) :start)
 				     ((member x '(">" "&gt;")) :end)
 				     ((member x '(">" "&gt;")) :end)
-				     ((member x '("<>" "&lt;&gt;")) :startend)
-				     (t nil)))
+				     ((member x '("<>" "&lt;&gt;")) :startend)))
 			     (cdr (org-split-string x "[ \t]*|[ \t]*"))))
 			     (cdr (org-split-string x "[ \t]*|[ \t]*"))))
 	       nil)
 	       nil)
 	      ((org-table-cookie-line-p x)
 	      ((org-table-cookie-line-p x)

+ 1 - 2
lisp/org-html.el

@@ -698,8 +698,7 @@ The default is an extended format of the ISO 8601 specification."
       ((eq (plist-get parameters :LaTeX-fragments) 'mathjax ) 'mathjax)
       ((eq (plist-get parameters :LaTeX-fragments) 'mathjax ) 'mathjax)
       ((eq (plist-get parameters :LaTeX-fragments) t        ) 'mathjax)
       ((eq (plist-get parameters :LaTeX-fragments) t        ) 'mathjax)
       ((eq (plist-get parameters :LaTeX-fragments) 'imagemagick) 'imagemagick)
       ((eq (plist-get parameters :LaTeX-fragments) 'imagemagick) 'imagemagick)
-      ((eq (plist-get parameters :LaTeX-fragments) 'dvipng  ) 'dvipng)
-      (t nil))))
+      ((eq (plist-get parameters :LaTeX-fragments) 'dvipng  ) 'dvipng))))
   (goto-char (point-min))
   (goto-char (point-min))
   (let (label l1)
   (let (label l1)
     (while (re-search-forward "\\\\ref{\\([^{}\n]+\\)}" nil t)
     (while (re-search-forward "\\\\ref{\\([^{}\n]+\\)}" nil t)

+ 1 - 2
lisp/org-id.el

@@ -216,8 +216,7 @@ In any case, the ID of the entry is returned."
 	(setq id (org-id-new prefix))
 	(setq id (org-id-new prefix))
 	(org-entry-put pom "ID" id)
 	(org-entry-put pom "ID" id)
 	(org-id-add-location id (buffer-file-name (buffer-base-buffer)))
 	(org-id-add-location id (buffer-file-name (buffer-base-buffer)))
-	id)
-       (t nil)))))
+	id)))))
 
 
 ;;;###autoload
 ;;;###autoload
 (defun org-id-get-with-outline-path-completion (&optional targets)
 (defun org-id-get-with-outline-path-completion (&optional targets)

+ 1 - 2
lisp/org-list.el

@@ -2822,8 +2822,7 @@ COMPARE-FUNC to compare entries."
 	     (sort-func (cond
 	     (sort-func (cond
 			 ((= dcst ?a) 'string<)
 			 ((= dcst ?a) 'string<)
 			 ((= dcst ?f) compare-func)
 			 ((= dcst ?f) compare-func)
-			 ((= dcst ?t) '<)
-			 (t nil)))
+			 ((= dcst ?t) '<)))
 	     (next-record (lambda ()
 	     (next-record (lambda ()
 			    (skip-chars-forward " \r\t\n")
 			    (skip-chars-forward " \r\t\n")
 			    (beginning-of-line)))
 			    (beginning-of-line)))

+ 1 - 2
lisp/org-lparse.el

@@ -1929,8 +1929,7 @@ See `org-xhtml-entity-format-callbacks-alist' for more information."
 		  (cond
 		  (cond
 		   ((string= align "l") "left")
 		   ((string= align "l") "left")
 		   ((string= align "r") "right")
 		   ((string= align "r") "right")
-		   ((string= align "c") "center")
-		   (t nil))))))))
+		   ((string= align "c") "center"))))))))
   (incf org-lparse-table-rownum)
   (incf org-lparse-table-rownum)
   (let ((i -1))
   (let ((i -1))
     (org-lparse-format
     (org-lparse-format

+ 1 - 2
lisp/org-mobile.el

@@ -451,8 +451,7 @@ agenda view showing the flagged items."
 			      ((eq (car x) :startgroup) "{")
 			      ((eq (car x) :startgroup) "{")
 			      ((eq (car x) :endgroup) "}")
 			      ((eq (car x) :endgroup) "}")
 			      ((eq (car x) :newline) nil)
 			      ((eq (car x) :newline) nil)
-			      ((listp x) (car x))
-			      (t nil)))
+			      ((listp x) (car x))))
 		      def-tags))
 		      def-tags))
       (setq def-tags (delq nil def-tags))
       (setq def-tags (delq nil def-tags))
       (setq tags (org-delete-all def-tags tags))
       (setq tags (org-delete-all def-tags tags))

+ 11 - 22
lisp/org.el

@@ -5773,8 +5773,7 @@ by a #."
 	   ((equal org-export-with-sub-superscripts '{})
 	   ((equal org-export-with-sub-superscripts '{})
 	    (list org-match-substring-with-braces-regexp))
 	    (list org-match-substring-with-braces-regexp))
 	   (org-export-with-sub-superscripts
 	   (org-export-with-sub-superscripts
-	    (list org-match-substring-regexp))
-	   (t nil)))
+	    (list org-match-substring-regexp))))
 	 (re-latex
 	 (re-latex
 	  (if org-export-with-LaTeX-fragments
 	  (if org-export-with-LaTeX-fragments
 	      (mapcar (lambda (x) (nth 1 x)) latexs)))
 	      (mapcar (lambda (x) (nth 1 x)) latexs)))
@@ -7920,8 +7919,7 @@ the inserted text when done."
 			      (- (match-end 1) (match-beginning 1)))
 			      (- (match-end 1) (match-beginning 1)))
 			     ((and (bolp)
 			     ((and (bolp)
 				   (looking-at org-outline-regexp))
 				   (looking-at org-outline-regexp))
-			      (- (match-end 0) (point) 1))
-			     (t nil)))
+			      (- (match-end 0) (point) 1))))
 	  (previous-level (save-excursion
 	  (previous-level (save-excursion
 			    (condition-case nil
 			    (condition-case nil
 				(progn
 				(progn
@@ -8373,8 +8371,7 @@ WITH-CASE, the sorting considers case as well."
          (cond
          (cond
           ((= dcst ?a) 'string<)
           ((= dcst ?a) 'string<)
           ((= dcst ?f) compare-func)
           ((= dcst ?f) compare-func)
-          ((member dcst '(?p ?t ?s ?d ?c)) '<)
-          (t nil)))))
+          ((member dcst '(?p ?t ?s ?d ?c)) '<)))))
     (run-hooks 'org-after-sorting-entries-or-items-hook)
     (run-hooks 'org-after-sorting-entries-or-items-hook)
     (message "Sorting entries...done")))
     (message "Sorting entries...done")))
 
 
@@ -8961,8 +8958,7 @@ For file links, arg negates `org-context-in-file-links'."
 	   (setq txt (cond
 	   (setq txt (cond
 		      ((org-at-heading-p) nil)
 		      ((org-at-heading-p) nil)
 		      ((org-region-active-p)
 		      ((org-region-active-p)
-		       (buffer-substring (region-beginning) (region-end)))
-		      (t nil)))
+		       (buffer-substring (region-beginning) (region-end)))))
 	   (when (or (null txt) (string-match "\\S-" txt))
 	   (when (or (null txt) (string-match "\\S-" txt))
 	     (setq cpltxt
 	     (setq cpltxt
 		   (concat cpltxt "::"
 		   (concat cpltxt "::"
@@ -9924,15 +9920,13 @@ application the system uses for this file type."
 	    (let ((cmd `(org-link-search
 	    (let ((cmd `(org-link-search
 			 ,path
 			 ,path
 			 ,(cond ((equal arg '(4)) ''occur)
 			 ,(cond ((equal arg '(4)) ''occur)
-				((equal arg '(16)) ''org-occur)
-				(t nil))
+				((equal arg '(16)) ''org-occur))
 			 ,pos)))
 			 ,pos)))
 	      (condition-case nil (let ((org-link-search-inhibit-query t))
 	      (condition-case nil (let ((org-link-search-inhibit-query t))
 				    (eval cmd))
 				    (eval cmd))
 		(error (progn (widen) (eval cmd))))))
 		(error (progn (widen) (eval cmd))))))
 
 
-	   (t
-	    (browse-url-at-point)))))))
+	   (t (browse-url-at-point)))))))
     (move-marker org-open-link-marker nil)
     (move-marker org-open-link-marker nil)
     (run-hook-with-args 'org-follow-link-hook)))
     (run-hook-with-args 'org-follow-link-hook)))
 
 
@@ -10559,8 +10553,7 @@ on the system \"/user@host:\"."
          (tramp-handle-file-remote-p file))
          (tramp-handle-file-remote-p file))
         ((and (boundp 'ange-ftp-name-format)
         ((and (boundp 'ange-ftp-name-format)
               (string-match (car ange-ftp-name-format) file))
               (string-match (car ange-ftp-name-format) file))
-         t)
-        (t nil)))
+         t)))
 
 
 
 
 ;;;; Refiling
 ;;;; Refiling
@@ -12538,8 +12531,7 @@ EXTRA is additional text that will be inserted into the notes buffer."
   (let* ((org-log-into-drawer (org-log-into-drawer))
   (let* ((org-log-into-drawer (org-log-into-drawer))
 	 (drawer (cond ((stringp org-log-into-drawer)
 	 (drawer (cond ((stringp org-log-into-drawer)
 			org-log-into-drawer)
 			org-log-into-drawer)
-		       (org-log-into-drawer "LOGBOOK")
-		       (t nil))))
+		       (org-log-into-drawer "LOGBOOK"))))
     (save-restriction
     (save-restriction
       (save-excursion
       (save-excursion
 	(when findpos
 	(when findpos
@@ -13646,8 +13638,7 @@ If DATA is nil or the empty string, any tags will be removed."
 	  (concat ":" (mapconcat 'identity (org-split-string data ":+") ":")
 	  (concat ":" (mapconcat 'identity (org-split-string data ":+") ":")
 		  ":"))
 		  ":"))
 	 ((listp data)
 	 ((listp data)
-	  (concat ":" (mapconcat 'identity data ":") ":"))
-	 (t nil)))
+	  (concat ":" (mapconcat 'identity data ":") ":"))))
   (when data
   (when data
     (save-excursion
     (save-excursion
       (org-back-to-heading t)
       (org-back-to-heading t)
@@ -13963,8 +13954,7 @@ Returns the new tags string, or nil to not change the current settings."
 				   ((not (assoc tg table))
 				   ((not (assoc tg table))
 				    (org-get-todo-face tg))
 				    (org-get-todo-face tg))
 				   ((member tg current) c-face)
 				   ((member tg current) c-face)
-				   ((member tg inherited) i-face)
-				   (t nil))))
+				   ((member tg inherited) i-face))))
 	  (if (and (= cnt 0) (not ingroup)) (insert "  "))
 	  (if (and (= cnt 0) (not ingroup)) (insert "  "))
 	  (insert "[" c "] " tg (make-string
 	  (insert "[" c "] " tg (make-string
 				 (- fwidth 4 (length tg)) ?\ ))
 				 (- fwidth 4 (length tg)) ?\ ))
@@ -16211,8 +16201,7 @@ D may be an absolute day number, or a calendar-type list (month day year)."
 		(stringp (cdr result))) (cdr result))
 		(stringp (cdr result))) (cdr result))
 	  ((and (consp result)
 	  ((and (consp result)
 		(stringp (car result))) result)
 		(stringp (car result))) result)
-	  (result entry)
-          (t nil))))
+	  (result entry))))
 
 
 (defun org-diary-to-ical-string (frombuf)
 (defun org-diary-to-ical-string (frombuf)
   "Get iCalendar entries from diary entries in buffer FROMBUF.
   "Get iCalendar entries from diary entries in buffer FROMBUF.