[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bridging between emacs's bookmark.el and emacs-w3m
- From: ARISAWA Akihiro <ari@xxxxxxxxxxxxx>
- Date: Fri, 24 Sep 2010 12:41:43 +0900
- X-ml-name: emacs-w3m
- X-mail-count: 11367
- References: <20100922.205409.1099674152461470757.yamato@xxxxxxxxxx>
Masatake YAMATO writes:
> ところがいつからかわからないのですが、最近のemacsに付属するbookmark.el
> では、ハンドラさえ用意すれば、任意のバッファにブックマークをつけること
> ができるようになりました。
NEWS によると 23.1 からのようです。
*** bookmark provides `bookmark-make-record-function' so special major
modes like Info can teach bookmark.el how to save and restore the
relevant data.
> そこでemacs-w3mのバッファにbookmark.elのブックマークをつけるための
> ハンドラを書きました。
いいですねえ。
ただ、手元の Emacs23.2 では bookmark-bmenu-toggle-filenames が t(デフォ
ルト)だと C-x r l 時に添付のエラーとなりました。
Emacs24 だと、コードを見る限り bookmark-location で対策されてそうですが、
bookmark-w3m.el で簡単に対応するなら以下のような感じでしょうか。
--- a/bookmark-w3m.el
+++ b/bookmark-w3m.el
@@ -45,6 +45,7 @@
`(,w3m-current-title
,@(bookmark-make-record-default 'no-file)
(url . ,w3m-current-url)
+ (filename . ,w3m-current-url)
(handler . bookmark-w3m-bookmark-jump)))
(defun bookmark-w3m-bookmark-jump (bookmark)
Katsumi Yamaoka writes:
> 実は `bookmark-make-record-default' の仕様が Emacs 23 と 24 で、
> だいぶ変わっているのです:
>
> ;; 23
> (bookmark-make-record-default &optional POINT-ONLY)
>
> ;; 24
> (bookmark-make-record-default &optional NO-FILE NO-CONTEXT POSN)
コードを見る限りは、POINT-ONLY と NO-FILE は変数名が変わっただけのようで
す。ということで、24 でも、もしかしたら動くかも。
(すみません。24はコンパイルしてません(^^;)
--
有沢 明宏
Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
insert(nil)
(prog1 (insert (bookmark-location bookmark)) (if (display-mouse-p) (add-text-properties start ... ...)))
(let ((start ...)) (prog1 (insert ...) (if ... ...)))
bookmark-insert-location("Text browser works on Emacs" t)
(let ((bmrk ...)) (push bmrk bookmark-bmenu-hidden-bookmarks) (let (...) (move-to-column bookmark-bmenu-file-column t) (if ... ...)) (delete-region (point) (progn ... ...)) (insert " ") (bookmark-insert-location bmrk t) (forward-line 1))
(while (< (point) (point-max)) (let (...) (push bmrk bookmark-bmenu-hidden-bookmarks) (let ... ... ...) (delete-region ... ...) (insert " ") (bookmark-insert-location bmrk t) (forward-line 1)))
(let ((inhibit-read-only t)) (while (< ... ...) (let ... ... ... ... ... ... ...)))
(save-window-excursion (goto-char (point-min)) (forward-line 2) (setq bookmark-bmenu-hidden-bookmarks nil) (let (...) (while ... ...)))
(save-excursion (save-window-excursion (goto-char ...) (forward-line 2) (setq bookmark-bmenu-hidden-bookmarks nil) (let ... ...)))
(progn (save-excursion (save-window-excursion ... ... ... ...)))
(unwind-protect (progn (save-excursion ...)) (set-buffer-modified-p was-modified))
(let ((was-modified ...)) (unwind-protect (progn ...) (set-buffer-modified-p was-modified)))
(with-buffer-modified-unmodified (save-excursion (save-window-excursion ... ... ... ...)))
(if (and (not force) bookmark-bmenu-toggle-filenames) nil (with-buffer-modified-unmodified (save-excursion ...)))
bookmark-bmenu-show-filenames()
(cond (show (setq bookmark-bmenu-toggle-filenames nil) (bookmark-bmenu-show-filenames) (setq bookmark-bmenu-toggle-filenames t)) (bookmark-bmenu-toggle-filenames (bookmark-bmenu-hide-filenames) (setq bookmark-bmenu-toggle-filenames nil)) (t (bookmark-bmenu-show-filenames) (setq bookmark-bmenu-toggle-filenames t)))
bookmark-bmenu-toggle-filenames(t)
(if bookmark-bmenu-toggle-filenames (bookmark-bmenu-toggle-filenames t))
(let ((inhibit-read-only t)) (erase-buffer) (insert "% Bookmark\n- --------\n") (add-text-properties (point-min) (point) (quote ...)) (dolist (full-record ...) (let ... ... ... ... ... ...)) (set-buffer-modified-p (not ...)) (goto-char (point-min)) (forward-line 2) (bookmark-bmenu-mode) (if bookmark-bmenu-toggle-filenames (bookmark-bmenu-toggle-filenames t)))
bookmark-bmenu-list()
call-interactively(bookmark-bmenu-list nil nil)