From: Stefan Monnier Date: Mon, 12 Jan 2015 18:07:52 +0000 (-0500) Subject: * lisp/net/eww.el: Use lexical-binding. X-Git-Tag: emacs-25.0.90~2603^2~5 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=81882be7111e361ad072b9512bfefa3430b3e867;p=emacs.git * lisp/net/eww.el: Use lexical-binding. (eww-links-at-point): Remove unused arg. (eww-mode-map): Inherit from special-mode-map. (eww-mode): Derive from special-mode. Don't use `setq' on a hook. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 072af5b1b91..6e2adc9b8e1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,10 +1,17 @@ +2015-01-14 Stefan Monnier + + * net/eww.el: Use lexical-binding. + (eww-links-at-point): Remove unused arg. + (eww-mode-map): Inherit from special-mode-map. + (eww-mode): Derive from special-mode. Don't use `setq' on a hook. + 2015-01-13 Alan Mackenzie Allow compilation during loading of Modes derived from a CC Mode mode. Fixes debbugs#19206. - * progmodes/cc-bytecomp.el (cc-bytecomp-compiling-or-loading): new - function which walks the stack to discover whether we're compiling + * progmodes/cc-bytecomp.el (cc-bytecomp-compiling-or-loading): + New function which walks the stack to discover whether we're compiling or loading. (cc-bytecomp-is-compiling): Reformulate, and move towards beginning. @@ -21,8 +28,8 @@ symbol's 'source property. (c-lang-const): Use cc-bytecomp-is-compiling. - * progmodes/cc-langs.el (c-make-init-lang-vars-fun): Use - cc-bytecomp-is-compiling. + * progmodes/cc-langs.el (c-make-init-lang-vars-fun): + Use cc-bytecomp-is-compiling. 2015-01-13 Stefan Monnier @@ -439,8 +446,8 @@ to `pre-command-hook'. (xref--xref-buffer-mode-map): Don't remap `next-line' and `previous-line'. Additionally bind `xref-next-line' and - `xref-prev-line' to `n' and `p' respectively. Bind - `xref-show-location-at-point' to `C-o'. + `xref-prev-line' to `n' and `p' respectively. + Bind `xref-show-location-at-point' to `C-o'. 2015-01-01 Eli Zaretskii @@ -629,15 +636,15 @@ Add argument MSG to display user-friendly message when no process is running. (python-shell-switch-to-shell): Call pop-to-buffer with NORECORD. - (python-shell-make-comint): Rename argument SHOW from POP. Use - display-buffer instead of pop-to-buffer. + (python-shell-make-comint): Rename argument SHOW from POP. + Use display-buffer instead of pop-to-buffer. (run-python): Doc fix. Return process. (python-shell-get-or-create-process): Make obsolete. 2014-12-27 Fabián Ezequiel Gallina - * progmodes/python.el (python-shell-buffer-substring): Handle - cornercase when region sent starts at point-min. + * progmodes/python.el (python-shell-buffer-substring): + Handle cornercase when region sent starts at point-min. 2014-12-27 Eli Zaretskii @@ -809,8 +816,8 @@ 2014-12-25 Filipp Gunbin - * dired-aux.el (dired-maybe-insert-subdir): Make - dired-maybe-insert-subdir always skip trivial files. + * dired-aux.el (dired-maybe-insert-subdir): + Make dired-maybe-insert-subdir always skip trivial files. 2014-12-25 Helmut Eller Dmitry Gutov @@ -855,8 +862,8 @@ * window.el (mouse-autoselect-window-position-1): New variable. (mouse-autoselect-window-cancel) - (mouse-autoselect-window-select, handle-select-window): With - delayed autoselection select window only if mouse moves after + (mouse-autoselect-window-select, handle-select-window): + With delayed autoselection select window only if mouse moves after selecting its frame. 2014-12-24 Michael Albinus diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 71094b1b66d..879eb53115e 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1,4 +1,4 @@ -;;; eww.el --- Emacs Web Wowser +;;; eww.el --- Emacs Web Wowser -*- lexical-binding:t -*- ;; Copyright (C) 2013-2015 Free Software Foundation, Inc. @@ -552,7 +552,7 @@ See the `eww-search-prefix' variable for the search engine used." "Return URI of the Web page the current EWW buffer is visiting." (plist-get eww-data :url)) -(defun eww-links-at-point (&optional pt) +(defun eww-links-at-point () "Return list of URIs, if any, linked at point." (remq nil (list (get-text-property (point) 'shr-url) @@ -631,17 +631,13 @@ the like." (defvar eww-mode-map (let ((map (make-sparse-keymap))) - (suppress-keymap map) - (define-key map "q" 'quit-window) - (define-key map "g" 'eww-reload) + (set-keymap-parent map special-mode-map) + (define-key map "g" 'eww-reload) ;FIXME: revert-buffer-function instead! (define-key map "G" 'eww) (define-key map [?\t] 'shr-next-link) (define-key map [?\M-\t] 'shr-previous-link) (define-key map [backtab] 'shr-previous-link) (define-key map [delete] 'scroll-down-command) - (define-key map [?\S-\ ] 'scroll-down-command) - (define-key map "\177" 'scroll-down-command) - (define-key map " " 'scroll-up-command) (define-key map "l" 'eww-back-url) (define-key map "r" 'eww-forward-url) (define-key map "n" 'eww-next-url) @@ -699,21 +695,19 @@ the like." map) "Tool bar for `eww-mode'.") -(define-derived-mode eww-mode nil "eww" - "Mode for browsing the web. - -\\{eww-mode-map}" +(define-derived-mode eww-mode special-mode "eww" + "Mode for browsing the web." (setq-local eww-data (list :title "")) - (setq-local browse-url-browser-function 'eww-browse-url) - (setq-local after-change-functions 'eww-process-text-input) + (setq-local browse-url-browser-function #'eww-browse-url) + (add-hook 'after-change-functions #'eww-process-text-input nil t) (setq-local eww-history nil) (setq-local eww-history-position 0) (when (boundp 'tool-bar-map) - (setq-local tool-bar-map eww-tool-bar-map)) + (setq-local tool-bar-map eww-tool-bar-map)) ;; desktop support - (setq-local desktop-save-buffer 'eww-desktop-misc-data) + (setq-local desktop-save-buffer #'eww-desktop-misc-data) ;; multi-page isearch support - (setq-local multi-isearch-next-buffer-function 'eww-isearch-next-buffer) + (setq-local multi-isearch-next-buffer-function #'eww-isearch-next-buffer) (setq truncate-lines t) (buffer-disable-undo) (setq buffer-read-only t)) @@ -1056,7 +1050,7 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.") (insert value) (shr-ensure-newline) (when (< (count-lines start (point)) lines) - (dotimes (i (- lines (count-lines start (point)))) + (dotimes (_ (- lines (count-lines start (point)))) (insert "\n"))) (setq end (point-marker)) (goto-char start) @@ -1848,7 +1842,7 @@ Also used when saving `eww-history'.") ;; . r)) -(defun eww-desktop-misc-data (directory) +(defun eww-desktop-misc-data (_directory) "Return a property list with data used to restore eww buffers. This list will contain, as :history, the list, whose first element is the value of `eww-data', and the tail is `eww-history'. @@ -1896,7 +1890,7 @@ Otherwise, the restored buffer will contain a prompt to do so by using ;;; Isearch support -(defun eww-isearch-next-buffer (&optional buffer wrap) +(defun eww-isearch-next-buffer (&optional _buffer wrap) "Go to the next page to search using `rel' attribute for navigation." (if wrap (condition-case nil