* [PATCH] Use special-mode in eww list modes
@ 2015-10-11 2:59 Mark Oteiza
2015-10-12 19:42 ` Kaushal Modi
0 siblings, 1 reply; 5+ messages in thread
From: Mark Oteiza @ 2015-10-11 2:59 UTC (permalink / raw)
To: emacs-devel
* 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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Use special-mode in eww list modes
2015-10-11 2:59 [PATCH] Use special-mode in eww list modes Mark Oteiza
@ 2015-10-12 19:42 ` Kaushal Modi
2015-10-13 8:48 ` Artur Malabarba
0 siblings, 1 reply; 5+ messages in thread
From: Kaushal Modi @ 2015-10-12 19:42 UTC (permalink / raw)
To: Mark Oteiza, emacs-devel
[-- 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 --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-10-13 14:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-11 2:59 [PATCH] Use special-mode in eww list modes Mark Oteiza
2015-10-12 19:42 ` Kaushal Modi
2015-10-13 8:48 ` Artur Malabarba
2015-10-13 12:11 ` Mark Oteiza
2015-10-13 14:25 ` Kaushal Modi
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).