Browse Source

ox-*: single-armed “if” -> “when”

* lisp/ox-html.el (org-html-htmlize-generate-css):
(org-html-template, org-html-final-function):
* lisp/ox-publish.el (org-publish-cache-set-file-property):
* lisp/ox-texinfo.el (org-texinfo-quote-block): Transform ‘if’ with no
else to ‘when’.
Aaron Ecay 6 years ago
parent
commit
673165c035
3 changed files with 16 additions and 16 deletions
  1. 13 13
      lisp/ox-html.el
  2. 1 1
      lisp/ox-publish.el
  3. 2 2
      lisp/ox-texinfo.el

+ 13 - 13
lisp/ox-html.el

@@ -1764,12 +1764,12 @@ produce code that uses these same face definitions."
       (htmlize-region (point-min) (point-max))))
   (pop-to-buffer-same-window "*html*")
   (goto-char (point-min))
-  (if (re-search-forward "<style" nil t)
-      (delete-region (point-min) (match-beginning 0)))
-  (if (re-search-forward "</style>" nil t)
-      (delete-region (1+ (match-end 0)) (point-max)))
+  (when (re-search-forward "<style" nil t)
+    (delete-region (point-min) (match-beginning 0)))
+  (when (re-search-forward "</style>" nil t)
+    (delete-region (1+ (match-end 0)) (point-max)))
   (beginning-of-line 1)
-  (if (looking-at " +") (replace-match ""))
+  (when (looking-at " +") (replace-match ""))
   (goto-char (point-min)))
 
 (defun org-html--make-string (n string)
@@ -2097,12 +2097,12 @@ holding export options."
    ;; Postamble.
    (org-html--build-pre/postamble 'postamble info)
    ;; Possibly use the Klipse library live code blocks.
-   (if (plist-get info :html-klipsify-src)
-       (concat "<script>" (plist-get info :html-klipse-selection-script)
-	       "</script><script src=\""
-	       org-html-klipse-js
-	       "\"></script><link rel=\"stylesheet\" type=\"text/css\" href=\""
-	       org-html-klipse-css "\"/>"))
+   (when (plist-get info :html-klipsify-src)
+     (concat "<script>" (plist-get info :html-klipse-selection-script)
+	     "</script><script src=\""
+	     org-html-klipse-js
+	     "\"></script><link rel=\"stylesheet\" type=\"text/css\" href=\""
+	     org-html-klipse-css "\"/>"))
    ;; Closing document.
    "</body>\n</html>"))
 
@@ -3716,8 +3716,8 @@ contextual information."
   (with-temp-buffer
     (insert contents)
     (set-auto-mode t)
-    (if (plist-get info :html-indent)
-	(indent-region (point-min) (point-max)))
+    (when (plist-get info :html-indent)
+      (indent-region (point-min) (point-max)))
     (buffer-substring-no-properties (point-min) (point-max))))
 
 

+ 1 - 1
lisp/ox-publish.el

@@ -1321,7 +1321,7 @@ the file including them will be republished as well."
 Use cache file of PROJECT-NAME.  If the entry does not exist, it
 will be created.  Return VALUE."
   ;; Evtl. load the requested cache file:
-  (if project-name (org-publish-initialize-cache project-name))
+  (when project-name (org-publish-initialize-cache project-name))
   (let ((pl (org-publish-cache-get filename)))
     (if pl (progn (plist-put pl property value) value)
       (org-publish-cache-get-file-property

+ 2 - 2
lisp/ox-texinfo.el

@@ -1342,8 +1342,8 @@ CONTENTS holds the contents of the block.  INFO is a plist
 holding contextual information."
   (let* ((title (org-element-property :name quote-block))
 	 (start-quote (concat "@quotation"
-			      (if title
-				  (format " %s" title)))))
+			      (when title
+				(format " %s" title)))))
     (format "%s\n%s@end quotation" start-quote contents)))
 
 ;;;; Radio Target