Commit e95a67dc authored by Stefan Monnier's avatar Stefan Monnier
Browse files

Replace lexical-let by lexical-binding (except Gnus, CEDET, ERT).

* lisp/term/ns-win.el (ns-define-service):
* lisp/progmodes/pascal.el (pascal-goto-defun):
* lisp/progmodes/js.el (js--read-tab):
* lisp/progmodes/etags.el (tags-lazy-completion-table):
* lisp/emacs-lisp/syntax.el (syntax-propertize-via-font-lock):
* lisp/emacs-lisp/ewoc.el (ewoc--wrap):
* lisp/emacs-lisp/assoc.el (aput, adelete, amake):
* lisp/doc-view.el (doc-view-convert-current-doc):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/vc/diff.el (diff-no-select): Replace lexical-let by lexical-binding.
parent 4c3fa1d9
2012-04-26 Stefan Monnier <monnier@iro.umontreal.ca>
* term/ns-win.el (ns-define-service):
* progmodes/pascal.el (pascal-goto-defun):
* progmodes/js.el (js--read-tab):
* progmodes/etags.el (tags-lazy-completion-table):
* emacs-lisp/syntax.el (syntax-propertize-via-font-lock):
* emacs-lisp/ewoc.el (ewoc--wrap):
* emacs-lisp/assoc.el (aput, adelete, amake):
* doc-view.el (doc-view-convert-current-doc):
* vc/diff.el (diff-no-select): Replace lexical-let by lexical-binding.
2012-04-26 Chong Yidong <cyd@gnu.org>
* image.el (image-type-from-buffer): Only return supported image
......
......@@ -670,31 +670,31 @@ Don't use that together with FILTER."
;; (dolist (ext completion-ignored-extensions)
;; (if (eq ?/ (aref ext (1- (length ext)))) (push ext cie)))
;; (setq cie (concat (regexp-opt cie "\\(?:") "\\'"))
;; (lexical-let* ((default (and buffer-file-name
;; (abbreviate-file-name buffer-file-name)))
;; (cie cie)
;; (completion-table
;; ;; We need a mix of read-file-name and
;; ;; read-directory-name so that completion to directories
;; ;; is preferred, but if the user wants to enter a global
;; ;; pattern, he can still use completion on filenames to
;; ;; help him write the pattern.
;; ;; Essentially, we want to use
;; ;; (completion-table-with-predicate
;; ;; 'read-file-name-internal 'file-directory-p nil)
;; ;; but that doesn't work because read-file-name-internal
;; ;; does not obey its `predicate' argument.
;; (completion-table-in-turn
;; (lambda (str pred action)
;; (let ((read-file-name-predicate
;; (lambda (f)
;; (and (not (member f '("./" "../")))
;; ;; Hack! Faster than file-directory-p!
;; (eq (aref f (1- (length f))) ?/)
;; (not (string-match cie f))))))
;; (complete-with-action
;; action 'read-file-name-internal str nil)))
;; 'read-file-name-internal)))
;; (let* ((default (and buffer-file-name
;; (abbreviate-file-name buffer-file-name)))
;; (cie cie)
;; (completion-table
;; ;; We need a mix of read-file-name and
;; ;; read-directory-name so that completion to directories
;; ;; is preferred, but if the user wants to enter a global
;; ;; pattern, he can still use completion on filenames to
;; ;; help him write the pattern.
;; ;; Essentially, we want to use
;; ;; (completion-table-with-predicate
;; ;; 'read-file-name-internal 'file-directory-p nil)
;; ;; but that doesn't work because read-file-name-internal
;; ;; does not obey its `predicate' argument.
;; (completion-table-in-turn
;; (lambda (str pred action)
;; (let ((read-file-name-predicate
;; (lambda (f)
;; (and (not (member f '("./" "../")))
;; ;; Hack! Faster than file-directory-p!
;; (eq (aref f (1- (length f))) ?/)
;; (not (string-match cie f))))))
;; (complete-with-action
;; action 'read-file-name-internal str nil)))
;; 'read-file-name-internal)))
;; (minibuffer-with-setup-hook
;; (lambda ()
;; (setq minibuffer-default default)
......
......@@ -960,13 +960,12 @@ Those files are saved in the directory given by the function
(odf
;; ODF files have to be converted to PDF before Ghostscript can
;; process it.
(lexical-let
((pdf (expand-file-name "doc.pdf" doc-view-current-cache-dir))
(opdf (expand-file-name (concat (file-name-sans-extension
(file-name-nondirectory doc-view-buffer-file-name))
".pdf")
doc-view-current-cache-dir))
(png-file png-file))
(let ((pdf (expand-file-name "doc.pdf" doc-view-current-cache-dir))
(opdf (expand-file-name (concat (file-name-sans-extension
(file-name-nondirectory doc-view-buffer-file-name))
".pdf")
doc-view-current-cache-dir))
(png-file png-file))
;; The unoconv tool only supports a output directory, but no
;; file name. It's named like the input file with the
;; extension replaced by pdf.
......
;;; assoc.el --- insert/delete functions on association lists
;;; assoc.el --- insert/delete functions on association lists -*- lexical-binding: t -*-
;; Copyright (C) 1996, 2001-2012 Free Software Foundation, Inc.
......@@ -36,7 +36,7 @@ the order of any other key-value pair. Side effect sets alist to new
sorted list."
(set alist-symbol
(sort (copy-alist (symbol-value alist-symbol))
(function (lambda (a b) (equal (car a) key))))))
(lambda (a _b) (equal (car a) key)))))
(defun aelement (key value)
......@@ -71,8 +71,8 @@ If VALUE is not supplied, or is nil, the key-value pair will not be
modified, but will be moved to the head of the alist. If the key-value
pair cannot be found in the alist, it will be inserted into the head
of the alist (with value nil if VALUE is nil or not supplied)."
(lexical-let ((elem (aelement key value))
alist)
(let ((elem (aelement key value))
alist)
(asort alist-symbol key)
(setq alist (symbol-value alist-symbol))
(cond ((null alist) (set alist-symbol elem))
......@@ -86,7 +86,7 @@ of the alist (with value nil if VALUE is nil or not supplied)."
Alist is referenced by ALIST-SYMBOL and the key-value pair to remove
is pair matching KEY. Returns the altered alist."
(asort alist-symbol key)
(lexical-let ((alist (symbol-value alist-symbol)))
(let ((alist (symbol-value alist-symbol)))
(cond ((null alist) nil)
((anot-head-p alist key) alist)
(t (set alist-symbol (cdr alist))))))
......@@ -123,10 +123,10 @@ KEYLIST and VALUELIST should have the same number of elements, but
this isn't enforced. If VALUELIST is smaller than KEYLIST, remaining
keys are associated with nil. If VALUELIST is larger than KEYLIST,
extra values are ignored. Returns the created alist."
(lexical-let ((keycar (car keylist))
(keycdr (cdr keylist))
(valcar (car valuelist))
(valcdr (cdr valuelist)))
(let ((keycar (car keylist))
(keycdr (cdr keylist))
(valcar (car valuelist))
(valcdr (cdr valuelist)))
(cond ((null keycdr)
(aput alist-symbol keycar valcar))
(t
......
;;; ewoc.el --- utility to maintain a view of a list of objects in a buffer
;;; ewoc.el --- utility to maintain a view of a list of objects in a buffer -*- lexical-binding: t -*-
;; Copyright (C) 1991-2012 Free Software Foundation, Inc.
......@@ -216,10 +216,9 @@ NODE and leaving the new node's start there. Return the new node."
(ewoc--adjust m (point) R dll)))
(defun ewoc--wrap (func)
(lexical-let ((ewoc--user-pp func))
(lambda (data)
(funcall ewoc--user-pp data)
(insert "\n"))))
(lambda (data)
(funcall func data)
(insert "\n")))
;;; ===========================================================================
......
;;; syntax.el --- helper functions to find syntactic context
;;; syntax.el --- helper functions to find syntactic context -*- lexical-binding: t -*-
;; Copyright (C) 2000-2012 Free Software Foundation, Inc.
......@@ -274,13 +274,12 @@ Note: back-references in REGEXPs do not work."
"Propertize for syntax in START..END using font-lock syntax.
KEYWORDS obeys the format used in `font-lock-syntactic-keywords'.
The return value is a function suitable for `syntax-propertize-function'."
(lexical-let ((keywords keywords))
(lambda (start end)
(with-no-warnings
(let ((font-lock-syntactic-keywords keywords))
(font-lock-fontify-syntactic-keywords-region start end)
;; In case it was eval'd/compiled.
(setq keywords font-lock-syntactic-keywords))))))
(lambda (start end)
(with-no-warnings
(let ((font-lock-syntactic-keywords keywords))
(font-lock-fontify-syntactic-keywords-region start end)
;; In case it was eval'd/compiled.
(setq keywords font-lock-syntactic-keywords)))))
(defun syntax-propertize (pos)
"Ensure that syntax-table properties are set until POS."
......
......@@ -406,7 +406,7 @@ which will be concatenated with proper quoting before passing them to MPD."
(funcall callback (prog1 (mpc-proc-buf-to-alist
(current-buffer))
(set-buffer buf))))))
;; (lexical-let ((res nil))
;; (let ((res nil))
;; (mpc-proc-cmd-to-alist cmd (lambda (alist) (setq res alist)))
;; (mpc-proc-sync)
;; res)
......
;;; etags.el --- etags facility for Emacs
;;; etags.el --- etags facility for Emacs -*- lexical-binding: t -*-
;; Copyright (C) 1985-1986, 1988-1989, 1992-1996, 1998, 2000-2012
;; Free Software Foundation, Inc.
......@@ -781,7 +781,7 @@ tags table and its (recursively) included tags tables."
(setq tags-completion-table nil)))))
(defun tags-lazy-completion-table ()
(lexical-let ((buf (current-buffer)))
(let ((buf (current-buffer)))
(lambda (string pred action)
(with-current-buffer buf
(save-excursion
......
;;; js.el --- Major mode for editing JavaScript
;;; js.el --- Major mode for editing JavaScript -*- lexical-binding: t -*-
;; Copyright (C) 2008-2012 Free Software Foundation, Inc.
......@@ -1036,17 +1036,12 @@ LIMIT defaults to point."
(c-save-buffer-state
(open-items
orig-match-start
orig-match-end
orig-depth
parse
prev-parse-point
name
case-fold-search
filtered-class-styles
new-item
goal-point
end-prop)
goal-point)
;; Figure out which class styles we need to look for
(setq filtered-class-styles
......@@ -2956,8 +2951,8 @@ browser, respectively."
(ido-mode -1))
(with-js
(lexical-let ((tabs (js--get-tabs)) selected-tab-cname
selected-tab prev-hitab)
(let ((tabs (js--get-tabs)) selected-tab-cname
selected-tab prev-hitab)
;; Disambiguate names
(setq tabs (loop with tab-names = (make-hash-table :test 'equal)
......@@ -3053,7 +3048,6 @@ browser, respectively."
"gBrowser"
"selectedTab")
with index = 0
for match in ido-matches
for candidate-tab = (find-tab-by-cname match)
if (eq (fourth candidate-tab) tab-to-match)
......
......@@ -1353,21 +1353,21 @@ The default is a name found in the buffer around point."
(default (if (pascal-comp-defun default nil 'lambda)
default ""))
(label
;; Do completion with default
;; Do completion with default.
(completing-read (if (not (string= default ""))
(concat "Label (default " default "): ")
"Label: ")
;; Complete with the defuns found in the
;; current-buffer.
(lexical-let ((buf (current-buffer)))
(let ((buf (current-buffer)))
(lambda (s p a)
(with-current-buffer buf
(pascal-comp-defun s p a))))
nil t "")))
;; If there was no response on prompt, use default value
;; If there was no response on prompt, use default value.
(if (string= label "")
(setq label default))
;; Goto right place in buffer if label is not an empty string
;; Goto right place in buffer if label is not an empty string.
(or (string= label "")
(progn
(goto-char (point-min))
......
;;; ns-win.el --- lisp side of interface with NeXT/Open/GNUstep/MacOS X window system
;;; ns-win.el --- lisp side of interface with NeXT/Open/GNUstep/MacOS X window system -*- lexical-binding: t -*-
;; Copyright (C) 1993-1994, 2005-2012 Free Software Foundation, Inc.
......@@ -44,7 +44,7 @@
(error "%s: Loading ns-win.el but not compiled for GNUstep/MacOS"
(invocation-name)))
(eval-when-compile (require 'cl)) ; lexical-let
(eval-when-compile (require 'cl))
;; Documentation-purposes only: actually loaded in loadup.el.
(require 'frame)
......@@ -65,7 +65,7 @@
;; nsterm.m.
(defvar ns-input-file)
(defun ns-handle-nxopen (switch &optional temp)
(defun ns-handle-nxopen (_switch &optional temp)
(setq unread-command-events (append unread-command-events
(if temp '(ns-open-temp-file)
'(ns-open-file)))
......@@ -74,7 +74,7 @@
(defun ns-handle-nxopentemp (switch)
(ns-handle-nxopen switch t))
(defun ns-ignore-1-arg (switch)
(defun ns-ignore-1-arg (_switch)
(setq x-invocation-args (cdr x-invocation-args)))
(defun ns-parse-geometry (geom)
......@@ -201,21 +201,20 @@ The properties returned may include `top', `left', `height', and `width'."
(mapconcat 'identity (cons "ns-service" path) "-")))))
;; This defines the function.
(defalias name
(lexical-let ((service service))
(lambda (arg)
(interactive "p")
(let* ((in-string
(cond ((stringp arg) arg)
(mark-active
(buffer-substring (region-beginning) (region-end)))))
(out-string (ns-perform-service service in-string)))
(cond
((stringp arg) out-string)
((and out-string (or (not in-string)
(not (string= in-string out-string))))
(if mark-active (delete-region (region-beginning) (region-end)))
(insert out-string)
(setq deactivate-mark nil)))))))
(lambda (arg)
(interactive "p")
(let* ((in-string
(cond ((stringp arg) arg)
(mark-active
(buffer-substring (region-beginning) (region-end)))))
(out-string (ns-perform-service service in-string)))
(cond
((stringp arg) out-string)
((and out-string (or (not in-string)
(not (string= in-string out-string))))
(if mark-active (delete-region (region-beginning) (region-end)))
(insert out-string)
(setq deactivate-mark nil))))))
(cond
((lookup-key global-map mapping)
(while (cdr path)
......
2012-04-26 Stefan Monnier <monnier@iro.umontreal.ca>
* url.el (url-retrieve-synchronously): Replace lexical-let by
lexical-binding.
2012-04-10 William Xu <william.xwl@gmail.com> (tiny change)
* url.el (url-retrieve-internal): Hexify multibye URL string first
......@@ -28,8 +33,8 @@
2012-03-11 Chong Yidong <cyd@gnu.org>
* url-http.el (url-http-end-of-document-sentinel): Handle
keepalive expiry by calling url-http again (Bug#10223).
* url-http.el (url-http-end-of-document-sentinel):
Handle keepalive expiry by calling url-http again (Bug#10223).
(url-http): New arg, for the above.
2012-03-11 Devon Sean McCullough <emacs-hacker2012@jovi.net>
......@@ -180,8 +185,8 @@
2011-07-03 Lars Magne Ingebrigtsen <larsi@gnus.org>
* url-http.el (url-http-wait-for-headers-change-function): Remove
pointless "HTTP/0.9 How I hate thee!" message (bug#6735).
* url-http.el (url-http-wait-for-headers-change-function):
Remove pointless "HTTP/0.9 How I hate thee!" message (bug#6735).
2011-06-04 Andreas Schwab <schwab@linux-m68k.org>
......
;;; url.el --- Uniform Resource Locator retrieval tool
;;; url.el --- Uniform Resource Locator retrieval tool -*- lexical-binding: t -*-
;; Copyright (C) 1996-1999, 2001, 2004-2012 Free Software Foundation, Inc.
......@@ -225,8 +225,8 @@ associated with it (the case for dired, info, or mailto URLs that need
no further processing). URL is either a string or a parsed URL."
(url-do-setup)
(lexical-let ((retrieval-done nil)
(asynch-buffer nil))
(let ((retrieval-done nil)
(asynch-buffer nil))
(setq asynch-buffer
(url-retrieve url (lambda (&rest ignored)
(url-debug 'retrieval "Synchronous fetching done (%S)" (current-buffer))
......
;;; diff.el --- run `diff'
;;; diff.el --- run `diff' -*- lexical-binding: t -*-
;; Copyright (C) 1992, 1994, 1996, 2001-2012 Free Software Foundation, Inc.
......@@ -147,11 +147,8 @@ specified in `diff-switches' are passed to the diff command."
(buffer-enable-undo (current-buffer))
(diff-mode)
(set (make-local-variable 'revert-buffer-function)
(lexical-let ((old old) (new new)
(switches switches)
(no-async no-async))
(lambda (ignore-auto noconfirm)
(diff-no-select old new switches no-async (current-buffer)))))
(lambda (_ignore-auto _noconfirm)
(diff-no-select old new switches no-async (current-buffer))))
(setq default-directory thisdir)
(let ((inhibit-read-only t))
(insert command "\n"))
......@@ -159,12 +156,11 @@ specified in `diff-switches' are passed to the diff command."
(let ((proc (start-process "Diff" buf shell-file-name
shell-command-switch command)))
(set-process-filter proc 'diff-process-filter)
(lexical-let ((old-alt old-alt) (new-alt new-alt))
(set-process-sentinel
proc (lambda (proc msg)
(with-current-buffer (process-buffer proc)
(diff-sentinel (process-exit-status proc)
old-alt new-alt))))))
(set-process-sentinel
proc (lambda (proc _msg)
(with-current-buffer (process-buffer proc)
(diff-sentinel (process-exit-status proc)
old-alt new-alt)))))
;; Async processes aren't available.
(let ((inhibit-read-only t))
(diff-sentinel
......
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