aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Fogel2008-01-02 07:49:04 +0000
committerKarl Fogel2008-01-02 07:49:04 +0000
commit03e26a796d29cdfef73517b7292c54268a4fdb99 (patch)
tree3af0c0546b6af2e2d46016eaf2e7815a7f958d1e
parentaacde24f5cdebc6d7ccb2f50a9d8e413906c4497 (diff)
downloademacs-03e26a796d29cdfef73517b7292c54268a4fdb99.tar.gz
emacs-03e26a796d29cdfef73517b7292c54268a4fdb99.zip
Change a return type, for greater extensibility. See
http://lists.gnu.org/archive/html/emacs-devel/2007-12/msg01077.html and its thread for discussion leading to this change. * emacs-cvs/lisp/bookmark.el: (bookmark-jump-noselect): Return an alist instead of a dotted pair. (bookmark-jump, bookmark-jump-other-window, bookmark-insert) (bookmark-bmenu-2-window, bookmark-bmenu-other-window) (bookmark-bmenu-switch-other-window): Adjust accordingly. (bookmark-make-cell-function): Adjust documentation accordingly. * emacs-cvs/lisp/image-mode.el (image-bookmark-jump): Adjust return type accordingly; document. * emacs-cvs/lisp/doc-view.el (doc-view-bookmark-jump): Adjust return type accordingly; document.
-rw-r--r--lisp/ChangeLog19
-rw-r--r--lisp/bookmark.el58
-rw-r--r--lisp/doc-view.el4
-rw-r--r--lisp/image-mode.el4
4 files changed, 55 insertions, 30 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 470812daa18..cc089335e4b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,22 @@
12008-01-02 Karl Fogel <kfogel@red-bean.com>
2
3 Change a return type, for greater extensibility. See
4 http://lists.gnu.org/archive/html/emacs-devel/2007-12/msg01077.html
5 and its thread for discussion leading to this change.
6
7 * emacs-cvs/lisp/bookmark.el:
8 (bookmark-jump-noselect): Return an alist instead of a dotted pair.
9 (bookmark-jump, bookmark-jump-other-window, bookmark-insert)
10 (bookmark-bmenu-2-window, bookmark-bmenu-other-window)
11 (bookmark-bmenu-switch-other-window): Adjust accordingly.
12 (bookmark-make-cell-function): Adjust documentation accordingly.
13
14 * emacs-cvs/lisp/image-mode.el
15 (image-bookmark-jump): Adjust return type accordingly; document.
16
17 * emacs-cvs/lisp/doc-view.el
18 (doc-view-bookmark-jump): Adjust return type accordingly; document.
19
12008-01-02 Miles Bader <Miles Bader <miles@gnu.org>> 202008-01-02 Miles Bader <Miles Bader <miles@gnu.org>>
2 21
3 * net/rcirc.el (rcirc-log-filename-function): New variable. 22 * net/rcirc.el (rcirc-log-filename-function): New variable.
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 9b8eb738f0c..49749f4e465 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -491,13 +491,11 @@ The function will be called with two arguments: ANNOTATION and
491INFO-NODE. See `bookmark-make-cell-for-text-file' for a 491INFO-NODE. See `bookmark-make-cell-for-text-file' for a
492description. 492description.
493 493
494The returned record may contain a special cons (handler 494The returned record may contain a special cons (handler . SOME-FUNCTION)
495. some-function) which sets the handler function that should be 495which sets the handler function that should be used to open this
496used to open this bookmark instead of `bookmark-jump-noselect'. 496bookmark instead of `bookmark-jump-noselect'. The handler should
497It should return a cons (BUFFER . POINT) indicating buffer 497return an alist like the one that function returns, and (of course)
498showing the bookmarked location and the value of point in that 498should likewise not select the buffer.")
499buffer. Like `bookmark-jump-noselect' the buffer shouldn't be
500selected by the handler.")
501 499
502(defun bookmark-make (name &optional annotation overwrite info-node) 500(defun bookmark-make (name &optional annotation overwrite info-node)
503 "Make a bookmark named NAME. 501 "Make a bookmark named NAME.
@@ -1084,10 +1082,10 @@ of the old one in the permanent bookmark record."
1084 (unless bookmark 1082 (unless bookmark
1085 (error "No bookmark specified")) 1083 (error "No bookmark specified"))
1086 (bookmark-maybe-historicize-string bookmark) 1084 (bookmark-maybe-historicize-string bookmark)
1087 (let ((cell (bookmark-jump-internal bookmark))) 1085 (let ((alist (bookmark-jump-internal bookmark)))
1088 (and cell 1086 (and alist
1089 (switch-to-buffer (car cell)) 1087 (switch-to-buffer (cadr (assq 'buffer alist)))
1090 (goto-char (cdr cell)) 1088 (goto-char (cadr (assq 'position alist)))
1091 (progn (run-hooks 'bookmark-after-jump-hook) t) 1089 (progn (run-hooks 'bookmark-after-jump-hook) t)
1092 (if bookmark-automatically-show-annotations 1090 (if bookmark-automatically-show-annotations
1093 ;; if there is an annotation for this bookmark, 1091 ;; if there is an annotation for this bookmark,
@@ -1106,10 +1104,10 @@ See `bookmark-jump'."
1106 (list bkm) bkm))) 1104 (list bkm) bkm)))
1107 (when bookmark 1105 (when bookmark
1108 (bookmark-maybe-historicize-string bookmark) 1106 (bookmark-maybe-historicize-string bookmark)
1109 (let ((cell (bookmark-jump-internal bookmark))) 1107 (let ((alist (bookmark-jump-internal bookmark)))
1110 (and cell 1108 (and alist
1111 (switch-to-buffer-other-window (car cell)) 1109 (switch-to-buffer-other-window (cadr (assq 'buffer alist)))
1112 (goto-char (cdr cell)) 1110 (goto-char (cadr (assq 'position alist)))
1113 (if bookmark-automatically-show-annotations 1111 (if bookmark-automatically-show-annotations
1114 ;; if there is an annotation for this bookmark, 1112 ;; if there is an annotation for this bookmark,
1115 ;; show it in a buffer. 1113 ;; show it in a buffer.
@@ -1143,8 +1141,12 @@ be retrieved from a VC backend, else return nil."
1143 bookmark)) 1141 bookmark))
1144 1142
1145(defun bookmark-jump-noselect (str) 1143(defun bookmark-jump-noselect (str)
1146 ;; a leetle helper for bookmark-jump :-) 1144 ;; Helper for bookmark-jump. STR is a bookmark name, of the sort
1147 ;; returns (BUFFER . POINT) 1145 ;; accepted by `bookmark-get-bookmark'.
1146 ;;
1147 ;; Return an alist '((buffer BUFFER) (position POSITION) ...)
1148 ;; indicating the bookmarked point within the specied buffer. Any
1149 ;; elements not documented here should be ignored.
1148 (bookmark-maybe-load-default-file) 1150 (bookmark-maybe-load-default-file)
1149 (let* ((file (expand-file-name (bookmark-get-filename str))) 1151 (let* ((file (expand-file-name (bookmark-get-filename str)))
1150 (forward-str (bookmark-get-front-context-string str)) 1152 (forward-str (bookmark-get-front-context-string str))
@@ -1179,7 +1181,7 @@ be retrieved from a VC backend, else return nil."
1179 (goto-char (match-end 0)))) 1181 (goto-char (match-end 0))))
1180 ;; added by db 1182 ;; added by db
1181 (setq bookmark-current-bookmark str) 1183 (setq bookmark-current-bookmark str)
1182 (cons (current-buffer) (point)))) 1184 `((buffer ,(current-buffer)) (position ,(point)))))
1183 1185
1184 ;; Else unable to find the marked file, so ask if user wants to 1186 ;; Else unable to find the marked file, so ask if user wants to
1185 ;; relocate the bookmark, else remind them to consider deletion. 1187 ;; relocate the bookmark, else remind them to consider deletion.
@@ -1296,7 +1298,7 @@ this."
1296 (let ((orig-point (point)) 1298 (let ((orig-point (point))
1297 (str-to-insert 1299 (str-to-insert
1298 (save-excursion 1300 (save-excursion
1299 (set-buffer (car (bookmark-jump-internal bookmark))) 1301 (set-buffer (cadr (assq 'buffer (bookmark-jump-internal bookmark))))
1300 (buffer-string)))) 1302 (buffer-string))))
1301 (insert str-to-insert) 1303 (insert str-to-insert)
1302 (push-mark) 1304 (push-mark)
@@ -1925,9 +1927,9 @@ With a prefix arg, prompts for a file to save them in."
1925 (pop-up-windows t)) 1927 (pop-up-windows t))
1926 (delete-other-windows) 1928 (delete-other-windows)
1927 (switch-to-buffer (other-buffer)) 1929 (switch-to-buffer (other-buffer))
1928 (let* ((pair (bookmark-jump-internal bmrk)) 1930 (let* ((alist (bookmark-jump-internal bmrk))
1929 (buff (car pair)) 1931 (buff (cadr (assq 'buffer alist)))
1930 (pos (cdr pair))) 1932 (pos (cadr (assq 'position alist))))
1931 (pop-to-buffer buff) 1933 (pop-to-buffer buff)
1932 (goto-char pos)) 1934 (goto-char pos))
1933 (bury-buffer menu)))) 1935 (bury-buffer menu))))
@@ -1945,9 +1947,9 @@ With a prefix arg, prompts for a file to save them in."
1945 (interactive) 1947 (interactive)
1946 (let ((bookmark (bookmark-bmenu-bookmark))) 1948 (let ((bookmark (bookmark-bmenu-bookmark)))
1947 (if (bookmark-bmenu-check-position) 1949 (if (bookmark-bmenu-check-position)
1948 (let* ((pair (bookmark-jump-internal bookmark)) 1950 (let* ((alist (bookmark-jump-internal bookmark))
1949 (buff (car pair)) 1951 (buff (cadr (assq 'buffer alist)))
1950 (pos (cdr pair))) 1952 (pos (cadr (assq 'position alist))))
1951 (switch-to-buffer-other-window buff) 1953 (switch-to-buffer-other-window buff)
1952 (goto-char pos) 1954 (goto-char pos)
1953 (set-window-point (get-buffer-window buff) pos) 1955 (set-window-point (get-buffer-window buff) pos)
@@ -1963,9 +1965,9 @@ The current window remains selected."
1963 same-window-buffer-names 1965 same-window-buffer-names
1964 same-window-regexps) 1966 same-window-regexps)
1965 (if (bookmark-bmenu-check-position) 1967 (if (bookmark-bmenu-check-position)
1966 (let* ((pair (bookmark-jump-internal bookmark)) 1968 (let* ((alist (bookmark-jump-internal bookmark))
1967 (buff (car pair)) 1969 (buff (cadr (assq 'buffer alist)))
1968 (pos (cdr pair))) 1970 (pos (cadr (assq 'position alist))))
1969 (display-buffer buff) 1971 (display-buffer buff)
1970 (let ((o-buffer (current-buffer))) 1972 (let ((o-buffer (current-buffer)))
1971 ;; save-excursion won't do 1973 ;; save-excursion won't do
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 388d30b381b..67372f4c621 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -1017,6 +1017,8 @@ See the command `doc-view-mode' for more information on this mode."
1017 1017
1018;;;###autoload 1018;;;###autoload
1019(defun doc-view-bookmark-jump (bmk) 1019(defun doc-view-bookmark-jump (bmk)
1020 ;; This implements the `handler' function interface for record type
1021 ;; returned by `bookmark-make-cell-function', which see.
1020 (save-window-excursion 1022 (save-window-excursion
1021 (let ((filename (bookmark-get-filename bmk)) 1023 (let ((filename (bookmark-get-filename bmk))
1022 (page (cdr (assq 'page (bookmark-get-bookmark-record bmk))))) 1024 (page (cdr (assq 'page (bookmark-get-bookmark-record bmk)))))
@@ -1024,6 +1026,6 @@ See the command `doc-view-mode' for more information on this mode."
1024 (when (not (eq major-mode 'doc-view-mode)) 1026 (when (not (eq major-mode 'doc-view-mode))
1025 (doc-view-toggle-display)) 1027 (doc-view-toggle-display))
1026 (doc-view-goto-page page) 1028 (doc-view-goto-page page)
1027 (cons (current-buffer) 1)))) 1029 `((buffer ,(current-buffer)) (position ,1)))))
1028 1030
1029;;; doc-view.el ends here 1031;;; doc-view.el ends here
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index 4041db8ebf2..98f4fa81968 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -375,6 +375,8 @@ and showing the image as an image."
375 375
376;;;###autoload 376;;;###autoload
377(defun image-bookmark-jump (bmk) 377(defun image-bookmark-jump (bmk)
378 ;; This implements the `handler' function interface for record type
379 ;; returned by `bookmark-make-cell-function', which see.
378 (save-window-excursion 380 (save-window-excursion
379 (let ((filename (bookmark-get-filename bmk)) 381 (let ((filename (bookmark-get-filename bmk))
380 (type (cdr (assq 'image-type (bookmark-get-bookmark-record bmk)))) 382 (type (cdr (assq 'image-type (bookmark-get-bookmark-record bmk))))
@@ -384,7 +386,7 @@ and showing the image as an image."
384 (image-toggle-display)) 386 (image-toggle-display))
385 (when (string= image-type "text") 387 (when (string= image-type "text")
386 (goto-char pos)) 388 (goto-char pos))
387 (cons (current-buffer) pos)))) 389 `((buffer ,(current-buffer)) (position ,(point))))))
388 390
389(provide 'image-mode) 391(provide 'image-mode)
390 392