aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Fogel1995-12-30 19:52:40 +0000
committerKarl Fogel1995-12-30 19:52:40 +0000
commit09fd6588960a1ca0fad029e6f513359bb88d5576 (patch)
treed8986b58a0bb2ceaa410e92b9f584099678111a3
parent5526cfdeebfe077fd7db23caaffa28fae052c621 (diff)
downloademacs-09fd6588960a1ca0fad029e6f513359bb88d5576.tar.gz
emacs-09fd6588960a1ca0fad029e6f513359bb88d5576.zip
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
";;;###autoloads" the as they were done in 2.6.13. (bookmark-version): new var, set to 2.6.19. (baud-rate): set to 19200 if not already bound. (bookmark-make): don't call `set-text-properties' on a Lisp string if this is XEmacs, because it won't work. (buffer-substring-no-properties): if this is not fboundp, then fset it to `buffer-substring-without-properties'.
-rw-r--r--lisp/bookmark.el77
1 files changed, 71 insertions, 6 deletions
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 73480a0b174..f80acc9db0c 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -5,7 +5,7 @@
5;; Author: Karl Fogel <kfogel@cyclic.com> 5;; Author: Karl Fogel <kfogel@cyclic.com>
6;; Maintainer: Karl Fogel <kfogel@cyclic.com> 6;; Maintainer: Karl Fogel <kfogel@cyclic.com>
7;; Created: July, 1993 7;; Created: July, 1993
8;; Author's Update Number: 2.6.13 8;; Author's Update Number: see variable `bookmark-version'.
9;; Keywords: bookmarks, placeholders, annotations 9;; Keywords: bookmarks, placeholders, annotations
10 10
11;;; Summary: 11;;; Summary:
@@ -69,6 +69,8 @@
69;; Thanks to Mikio Nakajima <PBC01764@niftyserve.or.jp> for many bugs 69;; Thanks to Mikio Nakajima <PBC01764@niftyserve.or.jp> for many bugs
70;; reported and fixed. 70;; reported and fixed.
71 71
72;; Thank you, Michael Kifer, for contributing the XEmacs support.
73
72;; Enough with the credits already, get on to the good stuff: 74;; Enough with the credits already, get on to the good stuff:
73 75
74;; FAVORITE CHINESE RESTAURANT: 76;; FAVORITE CHINESE RESTAURANT:
@@ -81,6 +83,11 @@
81 83
82;;;; Code: 84;;;; Code:
83 85
86(defconst bookmark-version "2.6.19"
87 "Version number of bookmark.el. This is not related to the version
88of Emacs bookmark comes with; it is used solely by bookmark's
89maintainers to avoid version confusion.")
90
84;;; Misc comments: 91;;; Misc comments:
85;; 92;;
86;; If variable bookmark-use-annotations is non-nil, an annotation is 93;; If variable bookmark-use-annotations is non-nil, an annotation is
@@ -176,12 +183,29 @@ following in your .emacs:
176 183
177;;; No user-serviceable parts beyond this point. 184;;; No user-serviceable parts beyond this point.
178 185
186;; Is it XEmacs?
187(defconst bookmark-xemacsp
188 (string-match "\\(Lucid\\|Xemacs\\)" emacs-version))
189
190
179;; Added for lucid emacs compatibility, db 191;; Added for lucid emacs compatibility, db
180(or (fboundp 'defalias) (fset 'defalias 'fset)) 192(or (fboundp 'defalias) (fset 'defalias 'fset))
181 193
182;; suggested for lucid compatibility by david hughes: 194;; suggested for lucid compatibility by david hughes:
183(or (fboundp 'frame-height) (defalias 'frame-height 'screen-height)) 195(or (fboundp 'frame-height) (defalias 'frame-height 'screen-height))
184 196
197;; This variable is probably obsolete now...
198(or (boundp 'baud-rate)
199 ;; some random value higher than 9600
200 (setq baud-rate 19200))
201
202;; XEmacs apparently call this `buffer-substring-without-properties',
203;; sigh.
204(or (fboundp 'buffer-substring-no-properties)
205 (if (fboundp 'buffer-substring-without-properties)
206 (fset 'buffer-substring-no-properties
207 'buffer-substring-without-properties)
208 (fset 'buffer-substring-no-properties 'buffer-substring)))
185 209
186 210
187;;; Keymap stuff: 211;;; Keymap stuff:
@@ -474,7 +498,10 @@ Optional third arg OVERWRITE means replace any existing bookmarks with
474this name." 498this name."
475 (bookmark-maybe-load-default-file) 499 (bookmark-maybe-load-default-file)
476 (let ((stripped-name (copy-sequence name))) 500 (let ((stripped-name (copy-sequence name)))
477 (set-text-properties 0 (length stripped-name) nil stripped-name) 501 (or bookmark-xemacsp
502 ;; XEmacs's `set-text-properties' doesn't work on
503 ;; free-standing strings, apparently.
504 (set-text-properties 0 (length stripped-name) nil stripped-name))
478 (if (and (bookmark-get-bookmark stripped-name) (not overwrite)) 505 (if (and (bookmark-get-bookmark stripped-name) (not overwrite))
479 ;; already existing boookmark under that name and 506 ;; already existing boookmark under that name and
480 ;; no prefix arg means just overwrite old bookmark 507 ;; no prefix arg means just overwrite old bookmark
@@ -1958,6 +1985,33 @@ strings returned are not."
1958 (cons (concat "-*- " name " -*-") pane-list))) 1985 (cons (concat "-*- " name " -*-") pane-list)))
1959 1986
1960 1987
1988(defun bookmark-build-xemacs-menu (name entries function)
1989 "Build a menu named NAME from the strings in ENTRIES.
1990That is, ENTRIES is a list of strings that appear as the choices
1991in the menu.
1992The visible entries are truncated to `bookmark-menu-length', but the
1993strings returned are not."
1994 (let* (lst
1995 (pane-list
1996 (progn
1997 (while entries
1998 (let ((str (car entries)))
1999 (setq lst (cons
2000 (vector
2001 (if (> (length str) bookmark-menu-length)
2002 (substring str 0 bookmark-menu-length)
2003 str)
2004 (list function str)
2005 t)
2006 lst))
2007 (setq entries (cdr entries))))
2008 (nreverse lst))))
2009
2010 ;; Return the menu:
2011 (append (if popup-menu-titles (list (concat "-*- " name " -*-")))
2012 pane-list)))
2013
2014
1961(defun bookmark-menu-popup-paned-menu (event name entries) 2015(defun bookmark-menu-popup-paned-menu (event name entries)
1962 "Pop up multi-paned menu at EVENT, return string chosen from ENTRIES. 2016 "Pop up multi-paned menu at EVENT, return string chosen from ENTRIES.
1963That is, ENTRIES is a list of strings which appear as the choices 2017That is, ENTRIES is a list of strings which appear as the choices
@@ -2071,23 +2125,34 @@ corresponding bookmark function from Lisp \(the one without the
2071;; We MUST autoload EACH form used to set up this variable's value, so 2125;; We MUST autoload EACH form used to set up this variable's value, so
2072;; that the whole job is done in loaddefs.el. 2126;; that the whole job is done in loaddefs.el.
2073 2127
2128;; FSF Emacs menubar stuff
2129;; The odd conditional structure is due to the limitations of autoload
2130;; cookies.
2131
2074;;;###autoload 2132;;;###autoload
2075(defvar menu-bar-bookmark-map (make-sparse-keymap "Bookmark functions")) 2133(defvar menu-bar-bookmark-map (make-sparse-keymap "Bookmark functions"))
2076 2134
2077;;;###autoload 2135;;;###autoload
2078(defalias 'menu-bar-bookmark-map (symbol-value 'menu-bar-bookmark-map)) 2136(defalias 'menu-bar-bookmark-map (symbol-value 'menu-bar-bookmark-map))
2079 2137
2138;; make bookmarks appear toward the right side of the menu.
2139(if (boundp 'menu-bar-final-items)
2140 (if menu-bar-final-items
2141 (setq menu-bar-final-items
2142 (cons 'bookmark menu-bar-final-items)))
2143 (setq menu-bar-final-items '(bookmark)))
2144
2080;;;###autoload 2145;;;###autoload
2081(define-key menu-bar-bookmark-map [load] 2146(define-key menu-bar-bookmark-map [load]
2082 '("Load a Bookmark File" . bookmark-load)) 2147 '("Load a Bookmark File..." . bookmark-load))
2083 2148
2084;;;###autoload 2149;;;###autoload
2085(define-key menu-bar-bookmark-map [write] 2150(define-key menu-bar-bookmark-map [write]
2086 '("Write \(to another file\)" . bookmark-write)) 2151 '("Save Bookmarks As..." . bookmark-write))
2087 2152
2088;;;###autoload 2153;;;###autoload
2089(define-key menu-bar-bookmark-map [save] 2154(define-key menu-bar-bookmark-map [save]
2090 '("Save \(in default file\)" . bookmark-save)) 2155 '("Save Bookmarks" . bookmark-save))
2091 2156
2092;;;###autoload 2157;;;###autoload
2093(define-key menu-bar-bookmark-map [edit] 2158(define-key menu-bar-bookmark-map [edit]