all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mark Oteiza <mvoteiza@udel.edu>
To: emacs-devel@gnu.org
Subject: [PATCH] Use special-mode in eww list modes
Date: Sat, 10 Oct 2015 22:59:56 -0400	[thread overview]
Message-ID: <87wpuu5cur.fsf@udel.edu> (raw)


* 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





             reply	other threads:[~2015-10-11  2:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-11  2:59 Mark Oteiza [this message]
2015-10-12 19:42 ` [PATCH] Use special-mode in eww list modes Kaushal Modi
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wpuu5cur.fsf@udel.edu \
    --to=mvoteiza@udel.edu \
    --cc=emacs-devel@gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.