summaryrefslogtreecommitdiff
path: root/lisp/org
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2016-01-25 10:11:31 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2016-01-25 10:11:31 -0500
commit1203e8aecb7f49621af52cc13bc0e4427545dd4f (patch)
tree2ed4d622865d7485dcdd61f87795575f00574994 /lisp/org
parentbb1bfb7123ff7149f47cdb64570d353e4918bd57 (diff)
downloademacs-1203e8aecb7f49621af52cc13bc0e4427545dd4f.tar.gz
emacs-1203e8aecb7f49621af52cc13bc0e4427545dd4f.tar.bz2
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'.
Diffstat (limited to 'lisp/org')
-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."
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)
@@ -546,6 +548,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.
@@ -589,7 +593,8 @@ block."
(end-of-line 1) (forward-char 1)
(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))
@@ -685,7 +690,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."
@@ -739,8 +744,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)))
@@ -827,7 +831,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
@@ -896,7 +900,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
@@ -1021,7 +1025,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))))
@@ -1532,7 +1542,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))))
@@ -1686,7 +1696,7 @@ NAME, or nil if no such block exists. Set match data according to
org-babel-named-src-block-regexp."
(save-excursion
(let ((case-fold-search t)
- (regexp (org-babel-named-src-block-regexp-for-name name)) msg)
+ (regexp (org-babel-named-src-block-regexp-for-name name)))
(goto-char (point-min))
(when (or (re-search-forward regexp nil t)
(re-search-backward regexp nil t))
@@ -1724,7 +1734,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)
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
`org-edit-src-save'")
(defvar org-edit-src-code-timer nil)
+(defvar org-inhibit-startup)
+
(defun org-edit-src-code (&optional context code edit-buffer-name)
"Edit the source CODE block at point.
The 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."
;; just one empty line, i.e. beg == end.
(end (copy-marker (make-marker) t))
(allow-write-back-p (null code))
- block-nindent total-nindent ovl lang lang-f single lfmt buffer msg
+ block-nindent total-nindent ovl lang lang-f single buffer msg
begline markline markcol line col transmitted-variables)
(setq beg (move-marker beg (nth 0 info))
end (move-marker end (nth 1 info))
@@ -471,7 +473,6 @@ the fragment in the Org-mode buffer."
(org-mode-p (derived-mode-p 'org-mode))
(beg (make-marker))
(end (make-marker))
- (preserve-indentation org-src-preserve-indentation)
block-nindent ovl beg1 end1 code begline buffer)
(beginning-of-line 1)
(if (looking-at "[ \t]*[^:\n \t]")
@@ -928,6 +929,8 @@ fontification of code blocks see `org-src-fontify-block' and
'(font-lock-fontified t fontified t font-lock-multiline t))
(set-buffer-modified-p modified)))))
+(defvar org-src-fontify-natively)
+
(defun org-src-fontify-block ()
"Fontify code block at point."
(interactive)