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

Re: Persistent emacs-w3m sessions



* 2004-04-06 Jose A. Ortega Ruiz:

> i first require w3m and customize it. aftewards i do this:
>
> (if (require 'w3m-session nil t)
>     (progn
>      (setq w3m-session-file "~/.emacs.d/w3m-session")
>      (setq w3m-session-save-always nil)
>      (setq w3m-session-load-always nil)
>      (setq w3m-session-duplicate-tabs 'ask)
>
>      ;;;;; jump to w3m buffer
>      (defmacro jao-w3m-add-jumper ()
>        (let ((n (length (w3m-list-buffers))))
>          `(define-key w3m-mode-map
>             (vector (list 'meta (+ ?0 ,n)))
>             (lambda ()
>               (interactive)
>               (let ((tab (nth (1- ,n) (w3m-list-buffers))))
>                 (if tab (switch-to-buffer tab)
>                   (message "No such tab")))))))
>      (add-hook 'w3m-mode-hook (lambda () (jao-w3m-add-jumper)))
>
>      ;;;;; additional shortcuts
>      (defun jao-w3m-keys ()
>        (define-key w3m-mode-map "v" 'bmk-mgr-show-bookmarks)
>        (define-key w3m-mode-map "a" 'bmk-mgr-add-current-w3m-page)
>        (define-key w3m-mode-map "S" 'w3m-session-save)
>        (define-key w3m-mode-map "L" 'w3m-session-load)
>        (define-key w3m-mode-map "V" 'w3m-view-image)
>        (define-key w3m-mode-map [(meta tab)] 'w3m-next-buffer))
>      (add-hook 'w3m-mode-hook 'jao-w3m-keys))
>   (message "w3m-session not available"))

thanks.  but what are these `bmk-mgr-*' functions?  google doesn't turn up
anything useful on the problem of keeping bookmarks into files and HTTP
links alike in the same file.  is this what `bmk-mgr-*' are for?  then i'd
like to have a pointer to a copy of this jewel  :)

i wonder why you don't do your customization "the simple way", ie.:

8<-- cut-from-here -->8
(add-hook 'w3m-load-hook
	  '(lambda nil
	    (define-key w3m-mode-map [up] 'previous-line)
	    (define-key w3m-mode-map [down] 'next-line)
	    (define-key w3m-mode-map [right] 'forward-char)
	    (define-key w3m-mode-map [left] 'backward-char)
	    (define-key w3m-mode-map [?p] 'w3m-view-previous-page)
	    (define-key w3m-mode-map [backspace] 'w3m-view-previous-page)
	    (define-key w3m-mode-map [tab] 'w3m-next-anchor)
	    (define-key w3m-mode-map [\S-tab] 'w3m-previous-anchor)
            ;(define-key w3m-mode-map "S" 'w3m-session-save)
            ;(define-key w3m-mode-map "L" 'w3m-session-load)
           )
)
8<-- cut-upto-here -->8

i've never had any problems with it, although neither the hook nor the
functions are defined at the time of the `add-hook' definition.  it seems
that emacs creates the variable `w3m-load-hook' (beeing a list containing a
lambda) for later use.  i only have the customary ``(autoload 'w3m*)''
functions preceding this.  the keymapping is done right after activating
the first "http://"; type of link.

  clemens