[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/image-mode.el,v
From: |
Tassilo Horn |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/image-mode.el,v |
Date: |
Wed, 26 Dec 2007 11:48:40 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Tassilo Horn <tsdh> 07/12/26 11:48:39
Index: image-mode.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/image-mode.el,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- image-mode.el 30 Oct 2007 17:09:41 -0000 1.28
+++ image-mode.el 26 Dec 2007 11:48:37 -0000 1.29
@@ -219,6 +219,9 @@
(kill-all-local-variables)
(setq mode-name "Image[text]")
(setq major-mode 'image-mode)
+ ;; Use our own bookmarking function for images.
+ (set (make-local-variable 'bookmark-make-cell-function)
+ 'image-bookmark-make-cell)
(add-hook 'change-major-mode-hook 'image-toggle-display-text nil t)
(if (and (display-images-p)
(not (get-char-property (point-min) 'display)))
@@ -352,6 +355,37 @@
(if (called-interactively-p)
(message "Repeat this command to go back to displaying the file as
text")))))
+;;; Support for bookmark.el
+
+(defun image-bookmark-make-cell (annotation &rest args)
+ (let ((the-record
+ `((filename . ,(buffer-file-name))
+ (image-type . ,image-type)
+ (position . ,(point))
+ (handler . image-bookmark-jump))))
+
+ ;; Take no chances with text properties
+ (set-text-properties 0 (length annotation) nil annotation)
+
+ (when annotation
+ (nconc the-record (list (cons 'annotation annotation))))
+
+ ;; Finally, return the completed record.
+ the-record))
+
+;;;###autoload
+(defun image-bookmark-jump (bmk)
+ (save-window-excursion
+ (let ((filename (bookmark-get-filename bmk))
+ (type (cdr (assq 'image-type (bookmark-get-bookmark-record bmk))))
+ (pos (bookmark-get-position bmk)))
+ (find-file filename)
+ (when (not (string= image-type type))
+ (image-toggle-display))
+ (when (string= image-type "text")
+ (goto-char pos))
+ (cons (current-buffer) pos))))
+
(provide 'image-mode)
;; arch-tag: b5b2b7e6-26a7-4b79-96e3-1546b5c4c6cb
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/lisp/image-mode.el,v,
Tassilo Horn <=