aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2016-01-25 10:11:31 -0500
committerStefan Monnier2016-01-25 10:11:31 -0500
commit1203e8aecb7f49621af52cc13bc0e4427545dd4f (patch)
tree2ed4d622865d7485dcdd61f87795575f00574994
parentbb1bfb7123ff7149f47cdb64570d353e4918bd57 (diff)
downloademacs-1203e8aecb7f49621af52cc13bc0e4427545dd4f.tar.gz
emacs-1203e8aecb7f49621af52cc13bc0e4427545dd4f.zip
* lisp/org: Fix some compiler warnings
* lisp/org/ob-core.el (org-babel-check-confirm-evaluate) (org-babel-map-src-blocks): Don't emit warnings if added vars are not used. (*this*): Declare as dyn-bound. (org-babel-expand-src-block, org-babel-load-in-session) (org-babel-switch-to-session-with-code, org-babel-get-rownames): Mark unused args. (org-babel-combine-header-arg-lists): Remove unused var `args'. (org-babel-find-named-block): Remove unused var `msg'. * lisp/org/org-src.el (org-inhibit-startup, org-src-fontify-natively): Declare as dyn-bound. (org-edit-src-code): Remove unused var `lfmt'. (org-edit-fixed-width-region): Remove unused var `preserve-indentation'.
-rw-r--r--lisp/org/ob-core.el31
-rw-r--r--lisp/org/org-src.el7
2 files changed, 26 insertions, 12 deletions
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el
index ff83162a2d8..d0a0d9b6d55 100644
--- a/lisp/org/ob-core.el
+++ b/lisp/org/ob-core.el
@@ -309,6 +309,8 @@ name of the code block."
309 org-confirm-babel-evaluate))) 309 org-confirm-babel-evaluate)))
310 (code-block (if ,info (format " %s " ,lang) " ")) 310 (code-block (if ,info (format " %s " ,lang) " "))
311 (block-name (if ,name (format " (%s) " ,name) " "))) 311 (block-name (if ,name (format " (%s) " ,name) " ")))
312 ;; Silence byte-compiler is `body' doesn't use those vars.
313 (ignore noeval query)
312 ,@body))) 314 ,@body)))
313 315
314(defsubst org-babel-check-evaluate (info) 316(defsubst org-babel-check-evaluate (info)
@@ -546,6 +548,8 @@ multiple blocks are being executed (e.g., in chained execution
546through use of the :var header argument) this marker points to 548through use of the :var header argument) this marker points to
547the outer-most code block.") 549the outer-most code block.")
548 550
551(defvar *this*)
552
549;;;###autoload 553;;;###autoload
550(defun org-babel-execute-src-block (&optional arg info params) 554(defun org-babel-execute-src-block (&optional arg info params)
551 "Execute the current source code block. 555 "Execute the current source code block.
@@ -589,7 +593,8 @@ block."
589 (end-of-line 1) (forward-char 1) 593 (end-of-line 1) (forward-char 1)
590 (let ((result (org-babel-read-result))) 594 (let ((result (org-babel-read-result)))
591 (message (replace-regexp-in-string 595 (message (replace-regexp-in-string
592 "%" "%%" (format "%S" result))) result))) 596 "%" "%%" (format "%S" result)))
597 result)))
593 ((org-babel-confirm-evaluate 598 ((org-babel-confirm-evaluate
594 (let ((i info)) (setf (nth 2 i) merged-params) i)) 599 (let ((i info)) (setf (nth 2 i) merged-params) i))
595 (let* ((lang (nth 0 info)) 600 (let* ((lang (nth 0 info))
@@ -685,7 +690,7 @@ org-babel-expand-body:lang function."
685 "\n"))) 690 "\n")))
686 691
687;;;###autoload 692;;;###autoload
688(defun org-babel-expand-src-block (&optional arg info params) 693(defun org-babel-expand-src-block (&optional _arg info params)
689 "Expand the current source code block. 694 "Expand the current source code block.
690Expand according to the source code block's header 695Expand according to the source code block's header
691arguments and pop open the results in a preview buffer." 696arguments and pop open the results in a preview buffer."
@@ -739,8 +744,7 @@ arguments and pop open the results in a preview buffer."
739 (let ((results (copy-sequence original))) 744 (let ((results (copy-sequence original)))
740 (dolist (new-list others) 745 (dolist (new-list others)
741 (dolist (arg-pair new-list) 746 (dolist (arg-pair new-list)
742 (let ((header (car arg-pair)) 747 (let ((header (car arg-pair)))
743 (args (cdr arg-pair)))
744 (setq results 748 (setq results
745 (cons arg-pair (org-remove-if 749 (cons arg-pair (org-remove-if
746 (lambda (pair) (equal header (car pair))) 750 (lambda (pair) (equal header (car pair)))
@@ -827,7 +831,7 @@ arguments and pop open the results in a preview buffer."
827(add-hook 'org-tab-first-hook 'org-babel-header-arg-expand) 831(add-hook 'org-tab-first-hook 'org-babel-header-arg-expand)
828 832
829;;;###autoload 833;;;###autoload
830(defun org-babel-load-in-session (&optional arg info) 834(defun org-babel-load-in-session (&optional _arg info)
831 "Load the body of the current source-code block. 835 "Load the body of the current source-code block.
832Evaluate the header arguments for the source block before 836Evaluate the header arguments for the source block before
833entering the session. After loading the body this pops open the 837entering the session. After loading the body this pops open the
@@ -896,7 +900,7 @@ with a prefix argument then this is passed on to
896(defvar org-src-window-setup) 900(defvar org-src-window-setup)
897 901
898;;;###autoload 902;;;###autoload
899(defun org-babel-switch-to-session-with-code (&optional arg info) 903(defun org-babel-switch-to-session-with-code (&optional arg _info)
900 "Switch to code buffer and display session." 904 "Switch to code buffer and display session."
901 (interactive "P") 905 (interactive "P")
902 (let ((swap-windows 906 (let ((swap-windows
@@ -1021,7 +1025,13 @@ end-body --------- point at the end of the body"
1021 (body (match-string 5)) 1025 (body (match-string 5))
1022 (beg-body (match-beginning 5)) 1026 (beg-body (match-beginning 5))
1023 (end-body (match-end 5))) 1027 (end-body (match-end 5)))
1024 ,@body 1028 ;; Silence byte-compiler in case `body' doesn't use all
1029 ;; those variables.
1030 (ignore full-block beg-block end-block lang
1031 beg-lang end-lang switches beg-switches
1032 end-switches header-args beg-header-args
1033 end-header-args body beg-body end-body)
1034 ,@body
1025 (goto-char end-block))))) 1035 (goto-char end-block)))))
1026 (unless visited-p (kill-buffer to-be-removed)) 1036 (unless visited-p (kill-buffer to-be-removed))
1027 (goto-char point)))) 1037 (goto-char point))))
@@ -1532,7 +1542,7 @@ Note: this function removes any hlines in TABLE."
1532 (rownames (funcall (lambda () 1542 (rownames (funcall (lambda ()
1533 (let ((tp table)) 1543 (let ((tp table))
1534 (mapcar 1544 (mapcar
1535 (lambda (row) 1545 (lambda (_row)
1536 (prog1 1546 (prog1
1537 (pop (car tp)) 1547 (pop (car tp))
1538 (setq tp (cdr tp)))) 1548 (setq tp (cdr tp))))
@@ -1686,7 +1696,7 @@ NAME, or nil if no such block exists. Set match data according to
1686org-babel-named-src-block-regexp." 1696org-babel-named-src-block-regexp."
1687 (save-excursion 1697 (save-excursion
1688 (let ((case-fold-search t) 1698 (let ((case-fold-search t)
1689 (regexp (org-babel-named-src-block-regexp-for-name name)) msg) 1699 (regexp (org-babel-named-src-block-regexp-for-name name)))
1690 (goto-char (point-min)) 1700 (goto-char (point-min))
1691 (when (or (re-search-forward regexp nil t) 1701 (when (or (re-search-forward regexp nil t)
1692 (re-search-backward regexp nil t)) 1702 (re-search-backward regexp nil t))
@@ -1724,7 +1734,8 @@ buffer or nil if no such result exists."
1724 (catch 'is-a-code-block 1734 (catch 'is-a-code-block
1725 (when (re-search-forward 1735 (when (re-search-forward
1726 (concat org-babel-result-regexp 1736 (concat org-babel-result-regexp
1727 "[ \t]" (regexp-quote name) "[ \t]*[\n\f\v\r]") nil t) 1737 "[ \t]" (regexp-quote name) "[ \t]*[\n\f\v\r]")
1738 nil t)
1728 (when (and (string= "name" (downcase (match-string 1))) 1739 (when (and (string= "name" (downcase (match-string 1)))
1729 (or (beginning-of-line 1) 1740 (or (beginning-of-line 1)
1730 (looking-at org-babel-src-block-regexp) 1741 (looking-at org-babel-src-block-regexp)
diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el
index 8e06aaa04c6..f0d393f8e8b 100644
--- a/lisp/org/org-src.el
+++ b/lisp/org/org-src.el
@@ -232,6 +232,8 @@ There is a mode hook, and keybindings for `org-edit-src-exit' and
232`org-edit-src-save'") 232`org-edit-src-save'")
233 233
234(defvar org-edit-src-code-timer nil) 234(defvar org-edit-src-code-timer nil)
235(defvar org-inhibit-startup)
236
235(defun org-edit-src-code (&optional context code edit-buffer-name) 237(defun org-edit-src-code (&optional context code edit-buffer-name)
236 "Edit the source CODE block at point. 238 "Edit the source CODE block at point.
237The code is copied to a separate buffer and the appropriate mode 239The code is copied to a separate buffer and the appropriate mode
@@ -265,7 +267,7 @@ the display of windows containing the Org buffer and the code buffer."
265 ;; just one empty line, i.e. beg == end. 267 ;; just one empty line, i.e. beg == end.
266 (end (copy-marker (make-marker) t)) 268 (end (copy-marker (make-marker) t))
267 (allow-write-back-p (null code)) 269 (allow-write-back-p (null code))
268 block-nindent total-nindent ovl lang lang-f single lfmt buffer msg 270 block-nindent total-nindent ovl lang lang-f single buffer msg
269 begline markline markcol line col transmitted-variables) 271 begline markline markcol line col transmitted-variables)
270 (setq beg (move-marker beg (nth 0 info)) 272 (setq beg (move-marker beg (nth 0 info))
271 end (move-marker end (nth 1 info)) 273 end (move-marker end (nth 1 info))
@@ -471,7 +473,6 @@ the fragment in the Org-mode buffer."
471 (org-mode-p (derived-mode-p 'org-mode)) 473 (org-mode-p (derived-mode-p 'org-mode))
472 (beg (make-marker)) 474 (beg (make-marker))
473 (end (make-marker)) 475 (end (make-marker))
474 (preserve-indentation org-src-preserve-indentation)
475 block-nindent ovl beg1 end1 code begline buffer) 476 block-nindent ovl beg1 end1 code begline buffer)
476 (beginning-of-line 1) 477 (beginning-of-line 1)
477 (if (looking-at "[ \t]*[^:\n \t]") 478 (if (looking-at "[ \t]*[^:\n \t]")
@@ -928,6 +929,8 @@ fontification of code blocks see `org-src-fontify-block' and
928 '(font-lock-fontified t fontified t font-lock-multiline t)) 929 '(font-lock-fontified t fontified t font-lock-multiline t))
929 (set-buffer-modified-p modified))))) 930 (set-buffer-modified-p modified)))))
930 931
932(defvar org-src-fontify-natively)
933
931(defun org-src-fontify-block () 934(defun org-src-fontify-block ()
932 "Fontify code block at point." 935 "Fontify code block at point."
933 (interactive) 936 (interactive)