From: Kaushal Modi <kaushal.modi@gmail.com>
To: Mark Oteiza <mvoteiza@udel.edu>, emacs-devel@gnu.org
Subject: Re: [PATCH] Use special-mode in eww list modes
Date: Mon, 12 Oct 2015 19:42:10 +0000 [thread overview]
Message-ID: <CAFyQvY3tiJzOXe6=4LbuEg-RQz_5VTiYreCkRQZWO9989AVy0Q@mail.gmail.com> (raw)
In-Reply-To: <87wpuu5cur.fsf@udel.edu>
[-- Attachment #1: Type: text/plain, Size: 3752 bytes --]
I like that idea, cleans up the code a bit.
On Sat, Oct 10, 2015 at 11:00 PM Mark Oteiza <mvoteiza@udel.edu> wrote:
>
> * lisp/net/eww.el (eww-bookmark-mode, eww-history-mode)
> (eww-buffers-mode): Derive from special-mode and remove redundant
> setting of buffer-read-only.
> (eww-mode-map): Remove redundant keymap parent setting.
> (eww-bookmark-mode-map, eww-history-mode-map, eww-buffers-mode-map):
> Remove redundant keymap suppressions and mappings.
> ---
>
> Alternatively, I think it would make sense to use tabulated-list-mode
> for these listing buffers, except the bookmark mode, since there is
> fancy stuff in there for manipulating bookmarks.
>
> lisp/net/eww.el | 22 ++++++----------------
> 1 file changed, 6 insertions(+), 16 deletions(-)
>
> diff --git a/lisp/net/eww.el b/lisp/net/eww.el
> index d44890f..bda4e0c 100644
> --- a/lisp/net/eww.el
> +++ b/lisp/net/eww.el
> @@ -627,7 +627,6 @@ the like."
>
> (defvar eww-mode-map
> (let ((map (make-sparse-keymap)))
> - (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)
> @@ -1583,8 +1582,6 @@ If CHARSET is nil then use UTF-8."
>
> (defvar eww-bookmark-mode-map
> (let ((map (make-sparse-keymap)))
> - (suppress-keymap map)
> - (define-key map "q" 'quit-window)
> (define-key map [(control k)] 'eww-bookmark-kill)
> (define-key map [(control y)] 'eww-bookmark-yank)
> (define-key map "\r" 'eww-bookmark-browse)
> @@ -1601,13 +1598,12 @@ If CHARSET is nil then use UTF-8."
> :active eww-bookmark-kill-ring]))
> map))
>
> -(define-derived-mode eww-bookmark-mode nil "eww bookmarks"
> +(define-derived-mode eww-bookmark-mode special-mode "eww bookmarks"
> "Mode for listing bookmarks.
>
> \\{eww-bookmark-mode-map}"
> (buffer-disable-undo)
> - (setq buffer-read-only t
> - truncate-lines t))
> + (setq truncate-lines t))
>
> ;;; History code
>
> @@ -1670,8 +1666,6 @@ If CHARSET is nil then use UTF-8."
>
> (defvar eww-history-mode-map
> (let ((map (make-sparse-keymap)))
> - (suppress-keymap map)
> - (define-key map "q" 'quit-window)
> (define-key map "\r" 'eww-history-browse)
> ;; (define-key map "n" 'next-error-no-select)
> ;; (define-key map "p" 'previous-error-no-select)
> @@ -1684,13 +1678,12 @@ If CHARSET is nil then use UTF-8."
> :active (get-text-property (line-beginning-position)
> 'eww-history)]))
> map))
>
> -(define-derived-mode eww-history-mode nil "eww history"
> +(define-derived-mode eww-history-mode special-mode "eww history"
> "Mode for listing eww-histories.
>
> \\{eww-history-mode-map}"
> (buffer-disable-undo)
> - (setq buffer-read-only t
> - truncate-lines t))
> + (setq truncate-lines t))
>
> ;;; eww buffers list
>
> @@ -1795,8 +1788,6 @@ If CHARSET is nil then use UTF-8."
>
> (defvar eww-buffers-mode-map
> (let ((map (make-sparse-keymap)))
> - (suppress-keymap map)
> - (define-key map "q" 'quit-window)
> (define-key map [(control k)] 'eww-buffer-kill)
> (define-key map "\r" 'eww-buffer-select)
> (define-key map "n" 'eww-buffer-show-next)
> @@ -1812,13 +1803,12 @@ If CHARSET is nil then use UTF-8."
> :active (get-text-property (line-beginning-position)
> 'eww-buffer)]))
> map))
>
> -(define-derived-mode eww-buffers-mode nil "eww buffers"
> +(define-derived-mode eww-buffers-mode special-mode "eww buffers"
> "Mode for listing buffers.
>
> \\{eww-buffers-mode-map}"
> (buffer-disable-undo)
> - (setq buffer-read-only t
> - truncate-lines t))
> + (setq truncate-lines t))
>
> ;;; Desktop support
>
> --
> 2.6.0
>
>
>
>
[-- Attachment #2: Type: text/html, Size: 4756 bytes --]
next prev parent reply other threads:[~2015-10-12 19:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-11 2:59 [PATCH] Use special-mode in eww list modes Mark Oteiza
2015-10-12 19:42 ` Kaushal Modi [this message]
2015-10-13 8:48 ` Artur Malabarba
2015-10-13 12:11 ` Mark Oteiza
2015-10-13 14:25 ` Kaushal Modi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFyQvY3tiJzOXe6=4LbuEg-RQz_5VTiYreCkRQZWO9989AVy0Q@mail.gmail.com' \
--to=kaushal.modi@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=mvoteiza@udel.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).