[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: [PATCH] w3m-lnum add highlight



Hi Andrey,

Please don't hesitate to post any message to the emacs-w3m list. ;-)
Here's the one I individually received.  If you folks reply to it,
burst the attachment in advance.  (In Gnus, use `C-d' and `B c' it
to the emacs-w3m group.)

I'll work on the new patch, later.
--- Begin Message ---
Katsumi Yamaoka <yamaoka@xxxxxxx> writes:

> Hideyuki SHIRAI wrote:
>> "Lf" => w3m-linknum-follow
>> "Ll" => w3m-go-to-linknum
>> "Li" => w3m-linknum-toggle-image
>> "Lg" => w3m-linknum-read-url
>
> Oh, good!  It solves the lack of keys.
>
> (free translation)
>> Isn't there an intention with which emacs-w3m doesn't use such
>> combined keystrokes?
>
> I believe there's nothing to hinder the use of such keys.

Yup, seems good.  Though `w3m-linknum-read-url' is not intended for use
as user command so no need for key and `w3m-linknum-toggle-image'...  I
thought something better.  emacs-w3m provides some nice commands on (point)
but when (point) is not onto something meaningful you get "No bla at
point".  So I took some/most such commands and made enhanced versions
which fall back to original when (point) is on proper element and in the
other case turn numbering selection on for respectable type of elements,
feeding result back to original.  I think these enhanced variants
(w3m-linknum-bla-bla) can safely[1] supersede originals (w3m-bla-bla) on
keybindings and maybe menus.  In such case the only command looking for
keybinding is the killing feature :P `w3m-linknum-follow' (and maybe
`w3m-go-to-linknum' as a sort of relative).  Here's a ChangeLog for
w3m-lnum.

2010-07-08  Andrey Kotlarski  <m00naticus@xxxxxxxxx>

	* w3m-lnum.el: Update usage comment.
	(w3m-link-numbering-mode): Cosmetic change.
	(w3m-get-anchor-info): Added w3m-image-alt char property to return
        list.
	(w3m-go-to-linknum, w3m-linknum-get-action): On 0 input select
	location url.
	(w3m-linknum-follow): Changed prompt and using w3m-message.
	(w3m-linknum-toggle-inline-image): Renamed from
	w3m-linknum-toggle-image and using w3m-message.  When image on
	point, toggle it.
	(w3m-linknum-view-image, w3m-linknum-save-image)
	(w3m-linknum-external-view-this-url)
	(w3m-linknum-edit-this-url, w3m-linknum-print-this-url)
	(w3m-linknum-download-this-url): New commands.

Then the diff itself and after this, for brave testers (enhancement is quite
simple and not expecting oddities) temp diff with w3m.el replacing bindings of
point-commands for their enhanced w3m-linknum-bla-bla variants (sorry
for being longer than necessary, auto indented it).  So beware, 2 diffs.

[1] Joking :) For example I use w3m-wget alongside and it expects to
substitute `w3m-download-this-url'.  Changed it accordingly
and enhanced it in the above manner, but it comes to show that maybe
originals should be "enhanced" in place for consistency with other
packages.  Not that painful hopefully ;)

--- w3m-lnum-cvs.el	2010-07-08 20:00:22.171802905 +0300
+++ w3m-lnum.el	        2010-07-08 21:40:18.483567124 +0300
@@ -34,14 +34,6 @@
 ;; Install this file to an appropriate directory, and add these
 ;; expressions to your ~/.emacs-w3m.
 
-;; (autoload 'w3m-linknum-follow "w3m-lnum"
-;;   "Turn on link numbers, ask for one and execute appropriate action on it." t)
-;; (autoload 'w3m-go-to-linknum "w3m-lnum"
-;;   "Turn on link and form numbers and ask for one to go to." t)
-;; (autoload 'w3m-linknum-toggle-image "w3m-lnum"
-;;   "Turn on link numbers and toggle an image." t)
-;; (autoload 'w3m-linknum-read-url "w3m-lnum"
-;;   "Turn on link numbers and return PROMPT selected url.")
 ;; (add-hook 'w3m-mode-hook 'w3m-link-numbering-mode)
 
 ;;; Code:
@@ -112,7 +104,7 @@
 	      (unless (= (setq arg (prefix-numeric-value arg)) 0)
 		(setq diff (not (eq arg w3m-link-numbering-mode)))
 		arg)
-	    (if (not w3m-link-numbering-mode) 1)))
+	    (unless w3m-link-numbering-mode 1)))
     (if w3m-link-numbering-mode
 	(progn
 	  (if diff (w3m-linknum-remove-overlays))
@@ -242,7 +234,7 @@
 	(and found-prev marked-new (throw 'done nil))))))
 
 (defun w3m-get-anchor-info (&optional num)
-  "Get info (url/action position [image]) of anchor numbered as NUM.
+  "Get info (url/action position [image image-alt]) of anchor numbered as NUM.
 If NUM is not specified, use currently highlighted anchor."
   (macrolet
       ((get-match-info
@@ -254,7 +246,8 @@
 		 (throw
 		  'found
 		  (if href (list href pos
-				 (get-text-property pos 'w3m-image))
+				 (get-text-property pos 'w3m-image)
+				 (get-text-property pos 'w3m-image-alt))
 		    (list (get-text-property pos 'w3m-action)
 			  pos))))))))
     (catch 'found
@@ -266,31 +259,40 @@
 ;;;###autoload
 (defun w3m-go-to-linknum (arg)
   "Turn on link and form numbers and ask for one to go to.
-With prefix ARG don't highlight current link."
+With prefix ARG don't highlight current link.
+0 corresponds to location url."
   (interactive "P")
   (w3m-with-linknum
    4
-   (let (info)
-     (if arg
-	 (setq info (w3m-get-anchor-info
-		     (w3m-read-number "Anchor number: ")))
-       (w3m-read-int-interactive "Anchor number: "
-				 'w3m-highlight-numbered-anchor)
-       (setq info (w3m-get-anchor-info)))
+   (let ((info (if arg
+		   (let ((num (w3m-read-number "Anchor number: ")))
+		     (if (= 0 num)
+			 (list nil 16)
+		       (w3m-get-anchor-info num)))
+		 (if (= 0 (w3m-read-int-interactive
+			   "Anchor number: "
+			   'w3m-highlight-numbered-anchor))
+		     (list nil 16)
+		   (w3m-get-anchor-info)))))
      (if info
 	 (goto-char (cadr info))
-       (error "No valid anchor selected")))))
+       (w3m-message "No valid anchor selected")))))
 
 (defun w3m-linknum-get-action (&optional prompt type)
   "Turn on link numbers and return list of url or action, position
 and image url if such of  PROMPT selected anchor.
 TYPE sets types of anchors to be numbered, if nil or 4, number urls,
 form fields and buttons. 1 - only links, 2 - only images.
-Highlight every intermediate result anchor."
+Highlight every intermediate result anchor.
+Input 0 corresponds to current page url."
   (w3m-with-linknum
-   (or type 4) (w3m-read-int-interactive (or prompt "Anchor number: ")
-					 'w3m-highlight-numbered-anchor)
-   (w3m-get-anchor-info)))
+   (or type 4)
+   (if (and (= 0 (w3m-read-int-interactive
+		  (or prompt "Anchor number: ")
+		  'w3m-highlight-numbered-anchor))
+	    (not (eq type 2)))
+       (list w3m-current-url 16 nil nil)
+     (w3m-get-anchor-info))))
 
 ;;;###autoload
 (defun w3m-linknum-follow (arg)
@@ -301,7 +303,7 @@
   (interactive "P")
   (let ((info (w3m-linknum-get-action
 	       (concat "Follow " (if arg "in new session ")
-		       "(select link): "))))
+		       "(select anchor): "))))
     (if info
 	(let ((action (car info)))
 	  (cond ((stringp action)	; url
@@ -322,7 +324,7 @@
 		       (let ((w3m-form-new-session nil)
 			     (w3m-form-download nil))
 			 (eval action)))))))
-      (error "No valid link selected"))))
+      (w3m-message "No valid link selected"))))
 
 ;;;###autoload
 (defun w3m-linknum-read-url (&optional prompt)
@@ -332,22 +334,119 @@
     (and link (stringp (setq link (car link)))
 	 link)))
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; linknum alternatives to w3m user commands on point
+
 ;;;###autoload
-(defun w3m-linknum-toggle-image (&optional arg)
-  "Turn on link numbers and toggle an image.
+(defun w3m-linknum-toggle-inline-image (&optional arg)
+  "If image at point, toggle it.
+Otherwise turn on link numbers and toggle selected image.
 With prefix ARG open in new session url behind image if such."
   (interactive "P")
-  (let ((im (w3m-linknum-get-action
-	     (if arg
-		 "Open image url in new session: "
-	       "Toggle image: ")
-	     2)))
-    (if im
-	(if (and arg (car im))
-	    (w3m-goto-url-new-session (car im))
-	  (save-excursion (goto-char (cadr im))
-			  (w3m-toggle-inline-image)))
-      (error "No image selected"))))
+  (if (w3m-image)
+      (let ((url (get-char-property (point) 'w3m-href-anchor)))
+	(if (and arg url)
+	    (w3m-goto-url-new-session url)
+	  (w3m-toggle-inline-image)))
+    (let ((im (w3m-linknum-get-action
+	       (if arg
+		   "Open image url in new session: "
+		 "Toggle image: ")
+	       2)))
+      (if im
+	  (if (and arg (car im))
+	      (w3m-goto-url-new-session (car im))
+	    (save-excursion (goto-char (cadr im))
+			    (w3m-toggle-inline-image)))
+	(w3m-message "No image selected")))))
+
+;;;###autoload
+(defun w3m-linknum-view-image ()
+  "Display the image under point in the external viewer.
+If no image at poing, turn on image numbers and display selected.
+The viewer is defined in `w3m-content-type-alist' for every type of an
+image."
+  (interactive)
+  (let ((url (w3m-url-valid (w3m-image))))
+    (if url
+	(w3m-external-view url)
+      (let ((im (w3m-linknum-get-action
+		 "Open image url in external viewer: " 2)))
+	(if im
+	    (w3m-external-view (caddr im))
+	  (w3m-message "No image selected"))))))
+
+;;;###autoload
+(defun w3m-linknum-save-image ()
+  "Save the image under point to a file.
+If no image at poing, turn on image numbers and save selected.
+The default name will be the original name of the image."
+  (interactive)
+  (let ((url (w3m-url-valid (w3m-image))))
+    (if url
+	(w3m-download url)
+      (let ((im (w3m-linknum-get-action "Save image: " 2)))
+	(if im
+	    (w3m-download (caddr im))
+	  (w3m-message "No image selected"))))))
+
+;;;###autoload
+(defun w3m-linknum-external-view-this-url ()
+  "Launch the external browser and display the link at point.
+If no link at point, turn on link numbers and open selected externally."
+  (interactive)
+  (let ((url (w3m-url-valid (or (w3m-anchor) (w3m-image)
+				(w3m-linknum-read-url
+				 "Open in external browser: ")))))
+    (if url
+	(w3m-external-view url)
+      (w3m-message "No URL selected"))))
+
+;;;###autoload
+(defun w3m-linknum-edit-this-url ()
+  "Edit the page linked from the anchor under the cursor.
+If no such, turn on link numbers and edit selected."
+  (interactive)
+  (let ((url (w3m-url-valid (w3m-anchor))))
+    (if url
+	(w3m-edit-url url)
+      (let ((link (w3m-linknum-read-url "Select link to edit: ")))
+	(if link
+	    (w3m-edit-url link)
+	  (w3m-message "No URL selected"))))))
+
+;;;###autoload
+(defun w3m-linknum-print-this-url ()
+  "Display the url under point in the echo area and put it into `kill-ring'.
+If no url under point, activate numbering and select one."
+  (interactive)
+  (if (or (w3m-anchor) (w3m-image))
+      (w3m-print-this-url t)
+    (let ((link (w3m-linknum-get-action "Select URL to copy: " 1)))
+      (if link
+	  (let ((url (car link)))
+	    (kill-new url)
+	    (w3m-message "%s%s" (let ((im-alt (cadddr link)))
+				  (if (zerop (length im-alt))
+				      ""
+				    (concat im-alt ": ")))
+			 url))
+	(w3m-message "No URL selected")))))
+
+;;;###autoload
+(defun w3m-linknum-download-this-url ()
+  "Download the file or the page pointed to by the link under point.
+If no point, activate numbering and select andchor to download."
+  (interactive)
+  (if (or (w3m-anchor) (w3m-image) (w3m-action))
+      (w3m-download-this-url)
+    (let ((info (w3m-linknum-get-action
+		 "Select anchor to download: ")))
+      (if info
+	  (save-excursion
+	    (goto-char (cadr info))
+	    (w3m-download-this-url))
+	(w3m-message "No anchor selected")))))
 
 (provide 'w3m-lnum)




--- w3m-cvs.el       	2010-07-08 20:00:43.218584042 +0300
+++ w3m.el	        2010-07-08 18:46:57.059497771 +0300
@@ -153,7 +153,15 @@
   (autoload 'report-emacs-w3m-bug "w3m-bug" nil t)
   (autoload 'w3m-replace-symbol "w3m-symbol" nil t)
   (autoload 'w3m-mail "w3m-mail" nil t)
+  (autoload 'w3m-linknum-follow "w3m-lnum" nil t)
   (autoload 'w3m-go-to-linknum "w3m-lnum" nil t)
+  (autoload 'w3m-linknum-read-url "w3m-lnum")
+  (autoload 'w3m-linknum-toggle-inline-image "w3m-lnum" nil t)
+  (autoload 'w3m-linknum-view-image "w3m-lnum" nil t)
+  (autoload 'w3m-linknum-external-view-this-url "w3m-lnum" nil t)
+  (autoload 'w3m-linknum-edit-this-url "w3m-lnum" nil t)
+  (autoload 'w3m-linknum-print-this-url "w3m-lnum" nil t)
+  (autoload 'w3m-linknum-download-this-url "w3m-lnum" nil t)
   (autoload 'w3m-session-select "w3m-session"
     "Select session from session list." t)
   (autoload 'w3m-session-save "w3m-session"
@@ -4069,7 +4077,7 @@
 						 (unless (interactive-p)
 						   safe-regexp))
 	    (setq w3m-display-inline-images (not status))
-	    (when status 
+	    (when status
 	      (w3m-process-stop (current-buffer))
 	      (w3m-idle-images-show-unqueue (current-buffer)))
 	    (force-mode-line-update)))
@@ -7711,17 +7719,17 @@
     (define-key map "N" 'w3m-view-next-page)
     (define-key map "^" 'w3m-view-parent-page)
     (define-key map "\M-d" 'w3m-download)
-    (define-key map "d" 'w3m-download-this-url)
-    (define-key map "u" 'w3m-print-this-url)
-    (define-key map "I" 'w3m-view-image)
-    (define-key map "\M-i" 'w3m-save-image)
+    (define-key map "d" 'w3m-linknum-download-this-url)
+    (define-key map "u" 'w3m-linknum-print-this-url)
+    (define-key map "I" 'w3m-linknum-view-image)
+    (define-key map "\M-i" 'w3m-linknum-save-image)
     (define-key map "c" 'w3m-print-current-url)
     (define-key map "M" 'w3m-view-url-with-external-browser)
     (define-key map "G" 'w3m-goto-url-new-session)
     (define-key map "g" 'w3m-goto-url)
     (define-key map "T" 'w3m-toggle-inline-images)
     (define-key map "\M-T" 'w3m-turnoff-inline-images)
-    (define-key map "t" 'w3m-toggle-inline-image)
+    (define-key map "t" 'w3m-linknum-toggle-inline-image)
     (when (w3m-display-graphic-p)
       (define-key map "\M-[" 'w3m-zoom-out-image)
       (define-key map "\M-]" 'w3m-zoom-in-image))
@@ -7776,7 +7784,7 @@
     (define-key map "=" 'w3m-view-header)
     (define-key map "s" 'w3m-history)
     (define-key map "E" 'w3m-edit-current-url)
-    (define-key map "e" 'w3m-edit-this-url)
+    (define-key map "e" 'w3m-linknum-edit-this-url)
     (define-key map "|" 'w3m-pipe-source)
     (define-key map "C" (make-sparse-keymap))
     (define-key map "Ct" 'w3m-redisplay-with-content-type)
@@ -7841,7 +7849,147 @@
     (define-key map "b" 'w3m-scroll-down-or-previous-url)
     (define-key map "!" 'w3m-redisplay-with-content-type)
     (define-key map "d" 'w3m-download)
-    (define-key map "D" 'w3m-download-this-url)
+    (define-key map "D" 'w3m-linknum-download-this-url)
+    (define-key map "e" 'w3m-edit-current-url)
+    (define-key map "E" 'w3m-linknum-edit-this-url)
+    (define-key map "f" 'undefined) ;; reserved.
+    (define-key map "g" 'w3m-goto-url)
+    (define-key map "G" 'w3m-goto-url-new-session)
+    (define-key map "h" 'describe-mode)
+    (define-key map "H" 'w3m-gohome)
+    (define-key map "i" (if (w3m-display-graphic-p)
+			    'w3m-linknum-toggle-inline-image
+			  'w3m-linknum-view-image))
+    (define-key map "I" 'w3m-linknum-toggle-inline-images)
+    (define-key map "\M-I" 'w3m-turnoff-inline-images)
+    (when (w3m-display-graphic-p)
+      (define-key map "\M-[" 'w3m-zoom-out-image)
+      (define-key map "\M-]" 'w3m-zoom-in-image))
+    (define-key map "\M-i" 'w3m-linknum-save-image)
+    (define-key map "l" 'w3m-view-previous-page)
+    (define-key map "\C-l" 'recenter)
+    (define-key map [(control L)] 'w3m-reload-this-page)
+    (define-key map [(control t) (control L)] 'w3m-reload-all-pages)
+    (define-key map "M" 'w3m-view-url-with-external-browser)
+    (define-key map "n" 'w3m-view-next-page)
+    (define-key map "N" 'w3m-namazu)
+    (define-key map "\M-n" 'w3m-copy-buffer)
+    (define-key map "\M-k" 'w3m-cookie)
+    (define-key map "\C-c\C-t" 'w3m-copy-buffer)
+    (define-key map "\C-c\C-p" 'w3m-previous-buffer)
+    (define-key map "\C-c\C-n" 'w3m-next-buffer)
+    (when (featurep 'w3m-ems)
+      (define-key map [?\C-c ?\C-,] 'w3m-tab-move-left)
+      (define-key map [?\C-c ?\C-<] 'w3m-tab-move-left)
+      (define-key map [?\C-c ?\C-.] 'w3m-tab-move-right)
+      (define-key map [?\C-c ?\C->] 'w3m-tab-move-right))
+    (define-key map "\C-c\C-w" 'w3m-delete-buffer)
+    (define-key map "\C-c\M-w" 'w3m-delete-other-buffers)
+    (define-key map "\C-c\M-l" 'w3m-delete-left-tabs)
+    (define-key map "\C-c\M-r" 'w3m-delete-right-tabs)
+    (define-key map "\C-c\C-s" 'w3m-select-buffer)
+    (define-key map "\C-c\C-a" 'w3m-switch-buffer)
+    (define-key map "\M-s" 'w3m-session-select)
+    (define-key map "\M-S" 'w3m-session-save)
+    (define-key map "o" 'w3m-history)
+    (define-key map "O" 'w3m-db-history)
+    (define-key map "p" 'w3m-view-previous-page)
+    (define-key map "P" 'undecided) ;; reserved for print-this-buffer.
+    (define-key map "q" 'w3m-close-window)
+    (define-key map "Q" 'w3m-quit)
+    (define-key map "r" 'w3m-redisplay-this-page)
+    (define-key map "R" 'w3m-reload-this-page)
+    (define-key map "\C-tR" 'w3m-reload-all-pages)
+    (define-key map "s" 'w3m-search)
+    (define-key map "S" 'w3m-search-new-session)
+    (define-key map "T" 'w3m-dtree)
+    (define-key map "u" 'w3m-view-parent-page)
+    (define-key map "v" 'w3m-bookmark-view)
+    (define-key map "V" 'w3m-bookmark-view-new-session)
+    (define-key map "W" 'w3m-weather)
+    (define-key map "y" 'w3m-print-current-url)
+    (define-key map "Y" 'w3m-linknum-print-this-url)
+    (define-key map "=" 'w3m-view-header)
+    (define-key map "\\" 'w3m-view-source)
+    (define-key map "?" 'describe-mode)
+    (define-key map ">" 'w3m-scroll-left)
+    (define-key map "<" 'w3m-scroll-right)
+    (define-key map [(shift right)] 'w3m-shift-left)
+    (define-key map [(shift left)] 'w3m-shift-right)
+    (define-key map "\M-l" 'w3m-horizontal-recenter)
+    (define-key map "\C-a" 'w3m-beginning-of-line)
+    (define-key map "\C-e" 'w3m-end-of-line)
+    (define-key map "." 'beginning-of-buffer)
+    (define-key map "^" 'w3m-view-parent-page)
+    (define-key map "]" 'w3m-next-form)
+    (define-key map "[" 'w3m-previous-form)
+    (define-key map "}" 'w3m-next-image)
+    (define-key map "{" 'w3m-previous-image)
+    (define-key map "|" 'w3m-pipe-source)
+    (define-key map "C" (make-sparse-keymap))
+    (define-key map "Ct" 'w3m-redisplay-with-content-type)
+    (define-key map "Cc" 'w3m-redisplay-with-charset)
+    (define-key map "CC" 'w3m-redisplay-and-reset)
+    (define-key map "\C-c\C-b" 'report-emacs-w3m-bug)
+    (define-key map "\C-c\C-c" 'w3m-submit-form)
+    (define-key map "\C-c\C-k" 'w3m-process-stop)
+    (define-key map "\C-c\C-m" 'w3m-move-unseen-buffer)
+    (define-key map "\C-c\C-l" 'w3m-go-to-linknum)
+    (setq w3m-info-like-map map)))
+
+(defvar w3m-info-like-map nil
+  "Info-like keymap used in emacs-w3m buffers.")
+;; `C-t' is a prefix key reserved to commands that do something in all
+;; emacs-w3m buffers.  2006-05-18
+(unless w3m-info-like-map
+  (let ((map (make-keymap)))
+    (suppress-keymap map)
+    (define-key map [backspace] 'w3m-scroll-down-or-previous-url)
+    (define-key map [delete] 'w3m-scroll-down-or-previous-url)
+    (define-key map "\C-?" 'w3m-scroll-down-or-previous-url)
+    (if (featurep 'xemacs)
+	(define-key map [(shift space)] 'w3m-scroll-down-or-previous-url)
+      (define-key map [?\S-\ ] 'w3m-scroll-down-or-previous-url))
+    (define-key map "\t" 'w3m-next-anchor)
+    (define-key map [tab] 'w3m-next-anchor)
+    (define-key map [(shift tab)] 'w3m-previous-anchor)
+    (define-key map [(shift iso-lefttab)] 'w3m-previous-anchor)
+    (define-key map [backtab] 'w3m-previous-anchor)
+    (define-key map "\M-\t" 'w3m-previous-anchor)
+    (define-key map "\C-m" 'w3m-view-this-url)
+    (define-key map [(shift return)] 'w3m-view-this-url-new-session)
+    (define-key map [(shift kp-enter)] 'w3m-view-this-url-new-session)
+    (if (featurep 'xemacs)
+	(progn
+	  (define-key map [(button2)] 'w3m-mouse-view-this-url)
+	  (define-key map [(shift button2)]
+	    'w3m-mouse-view-this-url-new-session))
+      (define-key map [mouse-2] 'w3m-mouse-view-this-url)
+      ;; Support for mouse-1 on Emacs 22 and greater.
+      (define-key map [follow-link] 'mouse-face)
+      (define-key map [S-mouse-2] 'w3m-mouse-view-this-url-new-session))
+    (cond ((featurep 'xemacs)
+	   (define-key map [(button3)] 'w3m-mouse-major-mode-menu))
+	  ;; Don't use [mouse-3], which gets submenus not working in GTK Emacs.
+	  ((featurep 'gtk)
+	   (define-key map [down-mouse-3] 'w3m-mouse-major-mode-menu)
+	   (define-key map [drag-mouse-3] 'undefined)
+	   (define-key map [mouse-3] 'undefined))
+	  (t
+	   (define-key map [mouse-3] 'w3m-mouse-major-mode-menu)))
+    (define-key map "\C-c\C-@" 'w3m-history-store-position)
+    (define-key map [?\C-c?\C- ] 'w3m-history-store-position)
+    (define-key map "\C-c\C-v" 'w3m-history-restore-position)
+    (define-key map " " 'w3m-scroll-up-or-next-url)
+    (define-key map "a" 'w3m-bookmark-add-current-url)
+    (define-key map "\C-ta" 'w3m-bookmark-add-all-urls)
+    (define-key map "\M-a" 'w3m-bookmark-add-this-url)
+    (define-key map "+" 'w3m-antenna-add-current-url)
+    (define-key map "A" 'w3m-antenna)
+    (define-key map "b" 'w3m-scroll-down-or-previous-url)
+    (define-key map "!" 'w3m-redisplay-with-content-type)
+    (define-key map "d" 'w3m-download)
+    (define-key map "D" 'w3m-linknum-download-this-url)
     (define-key map "e" 'w3m-edit-current-url)
     (define-key map "E" 'w3m-edit-this-url)
     (define-key map "f" 'undefined) ;; reserved.
@@ -10725,7 +10873,7 @@
   "*Whether to clean up temporary files when emacs-w3m shutdown."
   :group 'w3m
   :type 'boolean)
-  
+
 (defun w3m-cleanup-temp-files ()
   (when w3m-do-cleanup-temp-files
     (dolist (f (directory-files w3m-profile-directory))

--- End Message ---