Commit 2fbc1934 authored by Juanma Barranquero's avatar Juanma Barranquero
Browse files

Convert some .el files to lexical scoping.

* bs.el (bs-refresh, bs-sort-buffer-interns-are-last)
  (bs--get-marked-string, bs--get-modified-string)
  (bs--get-readonly-string, bs--get-size-string, bs--get-name)
  (bs--get-mode-name, bs--get-file-name): Mark unused arguments.
  (bs--configuration-name-for-prefix-arg): Rename argument PREFIX-ARG.

* ehelp.el (electric-help-execute-extended)
  (electric-help-ctrl-x-prefix):
* hexl.el (hexl-revert-buffer-function):
* linum.el (linum-after-change, linum-after-scroll):
* emacs-lisp/re-builder.el (reb-auto-update): Mark unused arguments.

* help-fns.el (help-describe-category-set): Remove unused ERR variable.
parent 6a56b5bd
2011-04-04 Juanma Barranquero <lekktu@gmail.com>
Convert to lexical-binding.
* bs.el (bs-refresh, bs-sort-buffer-interns-are-last)
(bs--get-marked-string, bs--get-modified-string)
(bs--get-readonly-string, bs--get-size-string, bs--get-name)
(bs--get-mode-name, bs--get-file-name): Mark unused arguments.
(bs--configuration-name-for-prefix-arg): Rename argument PREFIX-ARG.
* ehelp.el (electric-help-execute-extended)
(electric-help-ctrl-x-prefix):
* hexl.el (hexl-revert-buffer-function):
* linum.el (linum-after-change, linum-after-scroll):
* emacs-lisp/re-builder.el (reb-auto-update): Mark unused arguments.
* help-fns.el (help-describe-category-set): Remove unused ERR variable.
2011-04-04 Daiki Ueno <ueno@unixuser.org>
 
* epa-dired.el:
......@@ -262,7 +280,7 @@
2011-03-31 Tassilo Horn <tassilo@member.fsf.org>
 
* net/rcirc.el (rcirc-handler-001): Only authenticate, if there's
an entry for that server in rcirc-authinfo. (Bug#8385)
an entry for that server in rcirc-authinfo. (Bug#8385)
 
2011-03-31 Glenn Morris <rgm@gnu.org>
 
......
;;; bs.el --- menu for selecting and displaying buffers
;;; bs.el --- menu for selecting and displaying buffers -*- lexical-binding: t -*-
;; Copyright (C) 1998-2011 Free Software Foundation, Inc.
;; Author: Olaf Sylvester <Olaf.Sylvester@netsurf.de>
......@@ -693,7 +693,7 @@ Refresh whole Buffer Selection Menu."
(call-interactively 'bs-set-configuration)
(bs--redisplay t))
(defun bs-refresh (&rest ignored)
(defun bs-refresh (&rest _ignored)
"Refresh whole Buffer Selection Menu.
Arguments are IGNORED (for `revert-buffer')."
(interactive)
......@@ -1017,7 +1017,7 @@ A value of t means BUFFER belongs to no file.
A value of nil means BUFFER belongs to a file."
(not (buffer-file-name buffer)))
(defun bs-sort-buffer-interns-are-last (b1 b2)
(defun bs-sort-buffer-interns-are-last (_b1 b2)
"Function for sorting internal buffers at the end of all buffers."
(string-match-p "^\\*" (buffer-name b2)))
......@@ -1262,7 +1262,7 @@ or a string."
fun)
(t (apply fun args))))
(defun bs--get-marked-string (start-buffer all-buffers)
(defun bs--get-marked-string (start-buffer _all-buffers)
"Return a string which describes whether current buffer is marked.
START-BUFFER is the buffer where we started buffer selection.
ALL-BUFFERS is the list of buffers appearing in Buffer Selection Menu.
......@@ -1287,25 +1287,25 @@ The result string is one of `bs-string-current', `bs-string-current-marked',
(t
bs-string-show-always)))
(defun bs--get-modified-string (start-buffer all-buffers)
(defun bs--get-modified-string (_start-buffer _all-buffers)
"Return a string which describes whether current buffer is modified.
START-BUFFER is the buffer where we started buffer selection.
ALL-BUFFERS is the list of buffers appearing in Buffer Selection Menu."
(if (buffer-modified-p) "*" " "))
(defun bs--get-readonly-string (start-buffer all-buffers)
(defun bs--get-readonly-string (_start-buffer _all-buffers)
"Return a string which describes whether current buffer is read only.
START-BUFFER is the buffer where we started buffer selection.
ALL-BUFFERS is the list of buffers appearing in Buffer Selection Menu."
(if buffer-read-only "%" " "))
(defun bs--get-size-string (start-buffer all-buffers)
(defun bs--get-size-string (_start-buffer _all-buffers)
"Return a string which describes the size of current buffer.
START-BUFFER is the buffer where we started buffer selection.
ALL-BUFFERS is the list of buffers appearing in Buffer Selection Menu."
(int-to-string (buffer-size)))
(defun bs--get-name (start-buffer all-buffers)
(defun bs--get-name (_start-buffer _all-buffers)
"Return name of current buffer for Buffer Selection Menu.
The name of current buffer gets additional text properties
for mouse highlighting.
......@@ -1315,13 +1315,13 @@ ALL-BUFFERS is the list of buffers appearing in Buffer Selection Menu."
'help-echo "mouse-2: select this buffer, mouse-3: select in other frame"
'mouse-face 'highlight))
(defun bs--get-mode-name (start-buffer all-buffers)
(defun bs--get-mode-name (start-buffer _all-buffers)
"Return the name of mode of current buffer for Buffer Selection Menu.
START-BUFFER is the buffer where we started buffer selection.
ALL-BUFFERS is the list of buffers appearing in Buffer Selection Menu."
(format-mode-line mode-name nil nil start-buffer))
(defun bs--get-file-name (start-buffer all-buffers)
(defun bs--get-file-name (_start-buffer _all-buffers)
"Return string for column 'File' in Buffer Selection Menu.
This is the variable `buffer-file-name' of current buffer.
If not visiting a file, `list-buffers-directory' is returned instead.
......@@ -1420,18 +1420,18 @@ for buffer selection."
(bs-show-in-buffer liste)
(bs-message-without-log "%s" (bs--current-config-message)))))
(defun bs--configuration-name-for-prefix-arg (prefix-arg)
"Convert prefix argument PREFIX-ARG to a name of a buffer configuration.
If PREFIX-ARG is nil return `bs-default-configuration'.
If PREFIX-ARG is an integer return PREFIX-ARG element of `bs-configurations'.
(defun bs--configuration-name-for-prefix-arg (prefix)
"Convert prefix argument PREFIX to a name of a buffer configuration.
If PREFIX is nil return `bs-default-configuration'.
If PREFIX is an integer return PREFIX element of `bs-configurations'.
Otherwise return `bs-alternative-configuration'."
(cond ;; usually activation
((null prefix-arg)
((null prefix)
bs-default-configuration)
;; call with integer as prefix argument
((integerp prefix-arg)
(if (and (< 0 prefix-arg) (<= prefix-arg (length bs-configurations)))
(car (nth (1- prefix-arg) bs-configurations))
((integerp prefix)
(if (and (< 0 prefix) (<= prefix (length bs-configurations)))
(car (nth (1- prefix) bs-configurations))
bs-default-configuration))
;; call by prefix argument C-u
(t bs-alternative-configuration)))
......
;;; ehelp.el --- bindings for electric-help mode
;;; ehelp.el --- bindings for electric-help mode -*- lexical-binding: t -*-
;; Copyright (C) 1986, 1995, 2000-2011 Free Software Foundation, Inc.
......@@ -347,14 +347,14 @@ will select it.)"
;; This is to be bound to M-x in ehelp mode. Retains ehelp buffer and then
;; continues with execute-extended-command.
(defun electric-help-execute-extended (prefixarg)
(defun electric-help-execute-extended (_prefixarg)
(interactive "p")
(setq electric-help-form-to-execute '(execute-extended-command nil))
(electric-help-retain))
;; This is to be buond to C-x in ehelp mode. Retains ehelp buffer and then
;; continues with ctrl-x prefix.
(defun electric-help-ctrl-x-prefix (prefixarg)
(defun electric-help-ctrl-x-prefix (_prefixarg)
(interactive "p")
(setq electric-help-form-to-execute '(progn (message nil) (setq unread-command-char ?\C-x)))
(electric-help-retain))
......
;;; re-builder.el --- building Regexps with visual feedback
;;; re-builder.el --- building Regexps with visual feedback -*- lexical-binding: t -*-
;; Copyright (C) 1999-2011 Free Software Foundation, Inc.
......@@ -506,7 +506,7 @@ If SUBEXP is non-nil mark only the corresponding sub-expressions."
(reb-update-regexp)
(reb-update-overlays subexp))
(defun reb-auto-update (beg end lenold &optional force)
(defun reb-auto-update (_beg _end _lenold &optional force)
"Called from `after-update-functions' to update the display.
BEG, END and LENOLD are passed in from the hook.
An actual update is only done if the regexp has changed or if the
......
;;; help-fns.el --- Complex help functions
;;; help-fns.el --- Complex help functions -*- lexical-binding: t -*-
;; Copyright (C) 1985-1986, 1993-1994, 1998-2011
;; Free Software Foundation, Inc.
......@@ -879,7 +879,7 @@ BUFFER defaults to the current buffer."
(insert (cond
((null value) "default")
((char-table-p value) "deeper char-table ...")
(t (condition-case err
(t (condition-case nil
(category-set-mnemonics value)
(error "invalid"))))))
......
;;; hexl.el --- edit a file in a hex dump format using the hexl filter
;;; hexl.el --- edit a file in a hex dump format using the hexl filter -*- lexical-binding: t -*-
;; Copyright (C) 1989, 1994, 1998, 2001-2011 Free Software Foundation, Inc.
......@@ -355,7 +355,7 @@ You can use \\[hexl-find-file] to visit a file in Hexl mode.
(hexl-mode--setq-local 'require-final-newline nil)
(hexl-mode--setq-local 'font-lock-defaults '(hexl-font-lock-keywords t))
(hexl-mode--setq-local 'revert-buffer-function
......@@ -437,7 +437,7 @@ and edit the file in `hexl-mode'."
(if (not (eq major-mode 'hexl-mode))
(hexl-mode)))
(defun hexl-revert-buffer-function (ignore-auto noconfirm)
(defun hexl-revert-buffer-function (_ignore-auto _noconfirm)
(let ((coding-system-for-read 'no-conversion)
revert-buffer-function)
;; Call the original `revert-buffer' without code conversion; also
......@@ -492,7 +492,7 @@ With arg, don't unhexlify buffer."
;; since some of them may affect the minor modes.
(dolist (mm mms)
(funcall (car mm) (if (cdr mm) 1 -1))))
(force-mode-line-update))
(defun hexl-maybe-dehexlify-buffer ()
......
;;; linum.el --- display line numbers in the left margin
;;; linum.el --- display line numbers in the left margin -*- lexical-binding: t -*-
;; Copyright (C) 2008-2011 Free Software Foundation, Inc.
......@@ -174,14 +174,14 @@ and you have to scroll or press \\[recenter-top-bottom] to update the numbers."
(setq line (1+ line)))
(set-window-margins win width (cdr (window-margins win)))))
(defun linum-after-change (beg end len)
(defun linum-after-change (beg end _len)
;; update overlays on deletions, and after newlines are inserted
(when (or (= beg end)
(= end (point-max))
(string-match-p "\n" (buffer-substring-no-properties beg end)))
(linum-update-current)))
(defun linum-after-scroll (win start)
(defun linum-after-scroll (win _start)
(linum-update (window-buffer win)))
;; (defun linum-after-size (frame)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment