1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2025-01-15 17:00:45 +00:00

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
This commit is contained in:
Bastien Guerry 2012-08-19 14:42:54 +02:00
parent a3c4e10ac1
commit 655da8d1d3
8 changed files with 28 additions and 56 deletions

View File

@ -5718,8 +5718,7 @@ FRACTION is what fraction of the head-warning time has passed."
((= d1 d0)
(concat "<" start-time ">"))
((= d2 d0)
(concat "<" end-time ">"))
(t nil))
(concat "<" end-time ">")))
remove-re))))
(org-add-props txt props
'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))
(pb (or (get-text-property 1 'priority b) 0)))
(cond ((> pa pb) +1)
((< pa pb) -1)
(t nil))))
((< pa pb) -1))))
(defsubst org-cmp-effort (a 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))
(eb (or (get-text-property 1 'effort-minutes b) def)))
(cond ((> ea eb) +1)
((< ea eb) -1)
(t nil))))
((< ea eb) -1))))
(defsubst org-cmp-category (a b)
"Compare the string values of categories of strings A and B."
(let ((ca (or (get-text-property 1 'org-category a) ""))
(cb (or (get-text-property 1 'org-category b) "")))
(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)
"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)
((and (not donepa) donepb) +1)
((< la lb) -1)
((< lb la) +1)
(t nil))))
((< lb la) +1))))
(defsubst org-cmp-alpha (a b)
"Compare the headlines, alphabetically."
@ -6240,8 +6235,7 @@ could bind the variable in the options section of a custom command.")
(cond ((not ta) +1)
((not 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)
"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)
((not 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)
"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))
(tb (or (get-text-property 1 'time-of-day b) def)))
(cond ((< ta tb) -1)
((< tb ta) +1)
(t nil))))
((< tb ta) +1))))
(defsubst org-cmp-habit-p (a b)
"Compare the todo states of strings A and B."
(let ((ha (get-text-property 1 'org-habit-p a))
(hb (get-text-property 1 'org-habit-p b)))
(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)))

View File

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

View File

@ -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) t ) 'mathjax)
((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))
(let (label l1)
(while (re-search-forward "\\\\ref{\\([^{}\n]+\\)}" nil t)

View File

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

View File

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

View File

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

View File

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

View File

@ -5773,8 +5773,7 @@ by a #."
((equal org-export-with-sub-superscripts '{})
(list org-match-substring-with-braces-regexp))
(org-export-with-sub-superscripts
(list org-match-substring-regexp))
(t nil)))
(list org-match-substring-regexp))))
(re-latex
(if org-export-with-LaTeX-fragments
(mapcar (lambda (x) (nth 1 x)) latexs)))
@ -7920,8 +7919,7 @@ the inserted text when done."
(- (match-end 1) (match-beginning 1)))
((and (bolp)
(looking-at org-outline-regexp))
(- (match-end 0) (point) 1))
(t nil)))
(- (match-end 0) (point) 1))))
(previous-level (save-excursion
(condition-case nil
(progn
@ -8373,8 +8371,7 @@ WITH-CASE, the sorting considers case as well."
(cond
((= dcst ?a) 'string<)
((= 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)
(message "Sorting entries...done")))
@ -8961,8 +8958,7 @@ For file links, arg negates `org-context-in-file-links'."
(setq txt (cond
((org-at-heading-p) nil)
((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))
(setq cpltxt
(concat cpltxt "::"
@ -9924,15 +9920,13 @@ application the system uses for this file type."
(let ((cmd `(org-link-search
,path
,(cond ((equal arg '(4)) ''occur)
((equal arg '(16)) ''org-occur)
(t nil))
((equal arg '(16)) ''org-occur))
,pos)))
(condition-case nil (let ((org-link-search-inhibit-query t))
(eval cmd))
(error (progn (widen) (eval cmd))))))
(t
(browse-url-at-point)))))))
(t (browse-url-at-point)))))))
(move-marker org-open-link-marker nil)
(run-hook-with-args 'org-follow-link-hook)))
@ -10559,8 +10553,7 @@ on the system \"/user@host:\"."
(tramp-handle-file-remote-p file))
((and (boundp 'ange-ftp-name-format)
(string-match (car ange-ftp-name-format) file))
t)
(t nil)))
t)))
;;;; 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))
(drawer (cond ((stringp org-log-into-drawer)
org-log-into-drawer)
(org-log-into-drawer "LOGBOOK")
(t nil))))
(org-log-into-drawer "LOGBOOK"))))
(save-restriction
(save-excursion
(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 ":+") ":")
":"))
((listp data)
(concat ":" (mapconcat 'identity data ":") ":"))
(t nil)))
(concat ":" (mapconcat 'identity data ":") ":"))))
(when data
(save-excursion
(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))
(org-get-todo-face tg))
((member tg current) c-face)
((member tg inherited) i-face)
(t nil))))
((member tg inherited) i-face))))
(if (and (= cnt 0) (not ingroup)) (insert " "))
(insert "[" c "] " tg (make-string
(- 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))
((and (consp result)
(stringp (car result))) result)
(result entry)
(t nil))))
(result entry))))
(defun org-diary-to-ical-string (frombuf)
"Get iCalendar entries from diary entries in buffer FROMBUF.