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

Forward: w3m tips



こんなメールがきました。
/usr/share/doc/w3m/examles/ じゃなくて、たぶん /usr/share/doc/w3m-el/examples
だと思います。emacs-w3m のソース配布だと TIPS* にはいってるやつが
このディレクトリにいれてあるので、TIPSに どうでしょう?

-- 
鵜飼文敏
--- Begin Message ---
Hello Fumitoshi!

I've these these snippets that I would like to contribute. If you think
these may be usable for other w3m-el users please feel free to add them
to /usr/share/doc/w3m/examles/.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; w3m session stuff
;;  - M-x web-save-session saves all currently browsed urls into your
;;    custom.el under the variable 'w3m-session-urls'
;;  - M-x web-load-session opens the urls in 'w3m-session-urls' (only
;;    the ones which aren't currently opened)

(defun web-save-session ()
  (interactive)
  (customize-save-variable
   'w3m-session-urls
   (let ((list (sort (buffer-list-dolist
                      (string-match "w3m-mode" (symbol-name major-mode)) t)
                     'string<)))
     (loop for buffer in list
           do (set-buffer buffer)
           collect w3m-current-url))))

(defun web-load-session ()
  (interactive)
  (let* ((list (sort (buffer-list-dolist
                     (string-match "w3m-mode" (symbol-name major-mode)) t)
                     'string<))
         (urls (loop for buffer in list
                     do (set-buffer buffer)
                     collect w3m-current-url)))
    (dolist (url (set-difference w3m-session-urls urls :test 'equalp))
      (w3m-goto-url-new-session url))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This function redefines the original w3m-download-this-url with one
;; that uses the 'Downolader 4 X' download manager.

(defun w3m-download-this-url ()
  (interactive)
  "Download the file or the image which pointed by the link under cursor with downloader for X"
  (let ((url (or (w3m-anchor) (w3m-image))))
    (if url
        (call-process "d4x" nil nil nil url)
        (w3m-display-message "No URL at point"))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This function cycles thru your w3m-mode buffers.  I bound it to my
;; 'Web/Homepage' multimedia button, really convenient.

(defun ign-web-button ()
  (interactive)
  (let ((list (sort (buffer-list-dolist
                     (string-match "w3m-mode" (symbol-name major-mode)) t)
                    'string<)))
    (let ((cyclelist (member (buffer-name) list)))
      (cond (cyclelist
             (if (> (length cyclelist) 1)
                 (switch-to-buffer (second cyclelist))
                 (switch-to-buffer (first list))))
            (t (switch-to-buffer (first list)))))))

(global-set-key [(XF86HomePage)] 'ign-web-button)

-- 
ignotus
                                                  Rome wasn't burnt in a day.

--- End Message ---