0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 21:07:54 +00:00

Backport commit 1203e8a from Emacs

* lisp/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'.

* lisp/org-src.el (org-inhibit-startup):
Declare as dyn-bound.

lisp/org: Fix some compiler warnings
1203e8aecb7f49621af52cc13bc0e4427545dd4f
Stefan Monnier
Mon Jan 25 10:11:31 2016 -0500
This commit is contained in:
Stefan Monnier 2016-01-25 10:11:31 -05:00 committed by Kyle Meyer
parent 7b9f2fba66
commit 12189858e8
2 changed files with 21 additions and 9 deletions

View file

@ -317,6 +317,8 @@ name of the code block."
org-confirm-babel-evaluate)))
(code-block (if ,info (format " %s " ,lang) " "))
(block-name (if ,name (format " (%s) " ,name) " ")))
;; Silence byte-compiler is `body' doesn't use those vars.
(ignore noeval query)
,@body)))
(defsubst org-babel-check-evaluate (info)
@ -613,6 +615,8 @@ multiple blocks are being executed (e.g., in chained execution
through use of the :var header argument) this marker points to
the outer-most code block.")
(defvar *this*)
;;;###autoload
(defun org-babel-execute-src-block (&optional arg info params)
"Execute the current source code block.
@ -660,7 +664,8 @@ block."
(skip-chars-forward " \t")
(let ((result (org-babel-read-result)))
(message (replace-regexp-in-string
"%" "%%" (format "%S" result))) result)))
"%" "%%" (format "%S" result)))
result)))
((org-babel-confirm-evaluate
(let ((i info)) (setf (nth 2 i) merged-params) i))
(let* ((lang (nth 0 info))
@ -756,7 +761,7 @@ org-babel-expand-body:lang function."
"\n")))
;;;###autoload
(defun org-babel-expand-src-block (&optional arg info params)
(defun org-babel-expand-src-block (&optional _arg info params)
"Expand the current source code block.
Expand according to the source code block's header
arguments and pop open the results in a preview buffer."
@ -809,8 +814,7 @@ arguments and pop open the results in a preview buffer."
(let ((results (copy-sequence original)))
(dolist (new-list others)
(dolist (arg-pair new-list)
(let ((header (car arg-pair))
(args (cdr arg-pair)))
(let ((header (car arg-pair)))
(setq results
(cons arg-pair (org-remove-if
(lambda (pair) (equal header (car pair)))
@ -903,7 +907,7 @@ arguments and pop open the results in a preview buffer."
(add-hook 'org-tab-first-hook 'org-babel-header-arg-expand)
;;;###autoload
(defun org-babel-load-in-session (&optional arg info)
(defun org-babel-load-in-session (&optional _arg info)
"Load the body of the current source-code block.
Evaluate the header arguments for the source block before
entering the session. After loading the body this pops open the
@ -972,7 +976,7 @@ with a prefix argument then this is passed on to
(defvar org-src-window-setup)
;;;###autoload
(defun org-babel-switch-to-session-with-code (&optional arg info)
(defun org-babel-switch-to-session-with-code (&optional arg _info)
"Switch to code buffer and display session."
(interactive "P")
(let ((swap-windows
@ -1098,7 +1102,13 @@ end-body --------- point at the end of the body"
(body (match-string 5))
(beg-body (match-beginning 5))
(end-body (match-end 5)))
,@body
;; Silence byte-compiler in case `body' doesn't use all
;; those variables.
(ignore full-block beg-block end-block lang
beg-lang end-lang switches beg-switches
end-switches header-args beg-header-args
end-header-args body beg-body end-body)
,@body
(goto-char end-block)))))
(unless visited-p (kill-buffer to-be-removed))
(goto-char point))))
@ -1625,7 +1635,7 @@ Note: this function removes any hlines in TABLE."
(rownames (funcall (lambda ()
(let ((tp table))
(mapcar
(lambda (row)
(lambda (_row)
(prog1
(pop (car tp))
(setq tp (cdr tp))))
@ -1803,7 +1813,8 @@ buffer or nil if no such result exists."
(catch 'is-a-code-block
(when (re-search-forward
(concat org-babel-result-regexp
"[ \t]" (regexp-quote name) "[ \t]*[\n\f\v\r]") nil t)
"[ \t]" (regexp-quote name) "[ \t]*[\n\f\v\r]")
nil t)
(when (and (string= "name" (downcase (match-string 1)))
(or (beginning-of-line 1)
(looking-at org-babel-src-block-regexp)

View file

@ -54,6 +54,7 @@
(declare-function org-trim "org" (s))
(defvar org-element-all-elements)
(defvar org-inhibit-startup)
(defcustom org-edit-src-turn-on-auto-save nil
"Non-nil means turn `auto-save-mode' on when editing a source block.