1993-08-10 20:35:31 +00:00
|
|
|
;;; bookmark.el --- set bookmarks, jump to them later.
|
|
|
|
|
1994-05-03 23:47:06 +00:00
|
|
|
;; Copyright (C) 1993, 1994 Free Software Foundation
|
1993-08-10 20:35:31 +00:00
|
|
|
|
|
|
|
;; Author: Karl Fogel <kfogel@cs.oberlin.edu>
|
1993-08-14 11:04:06 +00:00
|
|
|
;; Maintainer: Karl Fogel <kfogel@cs.oberlin.edu>
|
1993-08-10 20:35:31 +00:00
|
|
|
;; Created: July, 1993
|
1993-10-25 23:56:15 +00:00
|
|
|
;; Version: 2.5
|
1993-08-10 20:35:31 +00:00
|
|
|
;; Keywords: bookmarks, placeholders
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
|
|
;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
;; any later version.
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with GNU Emacs; see the file COPYING. If not, write to
|
|
|
|
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
;; Thanks to David Bremner <bremner@cs.sfu.ca> for thinking of and
|
|
|
|
;; then implementing the bookmark-current-bookmark idea. He even
|
1993-10-25 23:56:15 +00:00
|
|
|
;; sent *patches*, bless his soul...
|
1993-08-10 20:35:31 +00:00
|
|
|
|
|
|
|
;; Thanks to Gregory M. Saunders <saunders@cis.ohio-state.edu> for
|
|
|
|
;; fixing and improving bookmark-time-to-save-p.
|
|
|
|
|
1993-10-25 23:56:15 +00:00
|
|
|
;; Thanks go to Andrew V. Klein <avk@rtsg.mot.com> for the code that
|
|
|
|
;; sorts the alist before presenting it to the user (in list-bookmarks
|
|
|
|
;; and the menu-bar).
|
|
|
|
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;; And much thanks to David Hughes <djh@harston.cv.com> for many small
|
|
|
|
;; suggestions and the code to implement them (like
|
|
|
|
;; Bookmark-menu-check-position, and some of the Lucid compatibility
|
|
|
|
;; stuff).
|
|
|
|
|
1993-10-25 23:56:15 +00:00
|
|
|
;; Kudos (whatever they are) go to Jim Blandy <jimb@cs.oberlin.edu>
|
|
|
|
;; for his eminently sensible suggestion to separate bookmark-jump
|
|
|
|
;; into bookmark-jump and bookmark-jump-noselect, which made many
|
|
|
|
;; other things cleaner as well.
|
|
|
|
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;; Thanks to Roland McGrath for encouragement and help with defining
|
|
|
|
;; autoloads on the menu-bar.
|
|
|
|
|
1993-10-25 23:56:15 +00:00
|
|
|
;; Jonathan Stigelman <stig@key.amdahl.com> gave patches for default
|
|
|
|
;; values in bookmark-jump and bookmark-set. Everybody please keep
|
|
|
|
;; all the keystrokes they save thereby and send them to him at the
|
|
|
|
;; end of each year :-) (No, seriously, thanks Jonathan!)
|
|
|
|
|
1993-08-10 20:35:31 +00:00
|
|
|
;; Based on info-bookmark.el, by Karl Fogel and Ken Olstad
|
|
|
|
;; <olstad@msc.edu>.
|
|
|
|
|
|
|
|
;; LCD Archive Entry:
|
|
|
|
;; bookmark|Karl Fogel|kfogel@cs.oberlin.edu|
|
|
|
|
;; Setting bookmarks in files or directories, jumping to them later.|
|
1993-10-25 23:56:15 +00:00
|
|
|
;; 16-July-93|Version: 2.5|~/misc/bookmark.el.Z|
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
|
|
|
|
;; Enough with the credits already, get on to the good stuff:
|
1993-08-10 20:35:31 +00:00
|
|
|
|
|
|
|
;; FAVORITE CHINESE RESTAURANT:
|
|
|
|
;; Boy, that's a tough one. Probably Hong Min, or maybe Emperor's
|
|
|
|
;; Choice (both in Chicago's Chinatown). Well, both. How about you?
|
|
|
|
|
1994-06-17 20:04:22 +00:00
|
|
|
;;; Commentary:
|
1993-08-10 20:35:31 +00:00
|
|
|
|
|
|
|
;; bookmark alist format:
|
|
|
|
;; (...
|
|
|
|
;; (bookmark-name (filename
|
|
|
|
;; string-in-front
|
|
|
|
;; string-behind
|
|
|
|
;; point))
|
|
|
|
;; ...)
|
|
|
|
;;
|
|
|
|
;; bookmark-name is the string the user gives the bookmark and
|
|
|
|
;; accesses it by from then on. filename is the location of the file
|
|
|
|
;; in which the bookmark is set. string-in-front is a string of
|
|
|
|
;; `bookmark-search-size' chars of context in front of the point the
|
|
|
|
;; bookmark is set at, string-behind is the same thing after the
|
|
|
|
;; point. bookmark-jump will search for string-behind and
|
|
|
|
;; string-in-front in case the file has changed since the bookmark was
|
|
|
|
;; set. It will attempt to place the user before the changes, if
|
|
|
|
;; there were any.
|
1993-08-13 00:59:51 +00:00
|
|
|
;;
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;; The bookmark list is sorted lexically by default, but you can turn
|
|
|
|
;; this off by setting bookmark-sort-flag to nil. If it is nil, then
|
|
|
|
;; the list will be presented in the order it is recorded
|
|
|
|
;; (chronologically), which is actually fairly useful as well.
|
1993-08-10 20:35:31 +00:00
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
;; Added for lucid emacs compatibility, db
|
|
|
|
(or (fboundp 'defalias) (fset 'defalias 'fset))
|
|
|
|
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;; suggested for lucid compatibility by david hughes:
|
|
|
|
(or (fboundp 'frame-height) (fset 'frame-height 'screen-height))
|
|
|
|
|
|
|
|
;; some people have C-x r set to rmail or whatever. We don't want to
|
|
|
|
;; assume that C-x r is a prefix map just because it's distributed
|
|
|
|
;; that way...
|
|
|
|
;; These are the distribution keybindings suggested by RMS, everything
|
1993-08-10 20:35:31 +00:00
|
|
|
;; else will be done with M-x or the menubar:
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;;;###autoload
|
1993-12-23 04:52:56 +00:00
|
|
|
(if (or (symbolp (key-binding "\C-xr"))
|
|
|
|
(fboundp 'bookmark-set))
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
nil
|
|
|
|
(progn (define-key ctl-x-map "rb" 'bookmark-jump)
|
|
|
|
(define-key ctl-x-map "rm" 'bookmark-set)
|
|
|
|
(define-key ctl-x-map "rl" 'list-bookmarks)))
|
1993-08-10 20:35:31 +00:00
|
|
|
|
|
|
|
;; define the map, so it can be bound by those who desire to do so:
|
|
|
|
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;;;###autoload
|
1993-08-14 19:49:27 +00:00
|
|
|
(defvar bookmark-map nil
|
|
|
|
"Keymap containing bindings to bookmark functions.
|
|
|
|
It is not bound to any key by default: to bind it
|
|
|
|
so that you have a bookmark prefix, just use `global-set-key' and bind a
|
|
|
|
key of your choice to `bookmark-map'. All interactive bookmark
|
1993-08-10 20:35:31 +00:00
|
|
|
functions have a binding in this keymap.")
|
|
|
|
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;;;###autoload
|
1993-08-10 20:35:31 +00:00
|
|
|
(define-prefix-command 'bookmark-map)
|
|
|
|
|
|
|
|
;; Read the help on all of these functions for details...
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;;;###autoload
|
1993-08-10 20:35:31 +00:00
|
|
|
(define-key bookmark-map "x" 'bookmark-set)
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;;;###autoload
|
|
|
|
(define-key bookmark-map "m" 'bookmark-set) ; "m" for "mark"
|
|
|
|
;;;###autoload
|
1993-08-10 20:35:31 +00:00
|
|
|
(define-key bookmark-map "j" 'bookmark-jump)
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;;;###autoload
|
|
|
|
(define-key bookmark-map "g" 'bookmark-jump) ; "g" for "go"
|
|
|
|
;;;###autoload
|
1993-08-10 20:35:31 +00:00
|
|
|
(define-key bookmark-map "i" 'bookmark-insert)
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;;;###autoload
|
|
|
|
(define-key bookmark-map "e" 'edit-bookmarks)
|
|
|
|
;;;###autoload
|
1993-08-10 20:35:31 +00:00
|
|
|
(define-key bookmark-map "f" 'bookmark-locate) ; "f" for "find"
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;;;###autoload
|
1993-08-14 19:49:27 +00:00
|
|
|
(define-key bookmark-map "r" 'bookmark-rename)
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;;;###autoload
|
1993-08-10 20:35:31 +00:00
|
|
|
(define-key bookmark-map "d" 'bookmark-delete)
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;;;###autoload
|
1993-08-10 20:35:31 +00:00
|
|
|
(define-key bookmark-map "l" 'bookmark-load)
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;;;###autoload
|
|
|
|
(define-key bookmark-map "w" 'bookmark-write)
|
|
|
|
;;;###autoload
|
1993-08-10 20:35:31 +00:00
|
|
|
(define-key bookmark-map "s" 'bookmark-save)
|
|
|
|
|
1993-08-14 19:52:32 +00:00
|
|
|
(defvar bookmark-alist ()
|
|
|
|
"Association list of bookmarks.
|
|
|
|
You probably don't want to change the value of this alist yourself;
|
|
|
|
instead, let the various bookmark functions do it for you.")
|
|
|
|
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(defvar bookmarks-already-loaded nil)
|
|
|
|
|
1993-08-10 20:35:31 +00:00
|
|
|
;; just add the hook to make sure that people don't lose bookmarks
|
|
|
|
;; when they kill Emacs, unless they don't want to save them.
|
|
|
|
(add-hook 'kill-emacs-hook
|
|
|
|
(function
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(lambda () (and (featurep 'bookmark)
|
|
|
|
bookmark-alist
|
|
|
|
(bookmark-time-to-save-p t)
|
|
|
|
(bookmark-save)))))
|
1993-08-10 20:35:31 +00:00
|
|
|
|
|
|
|
;; more stuff added by db.
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
|
1993-08-10 20:35:31 +00:00
|
|
|
(defvar bookmark-current-bookmark nil
|
1993-08-14 19:49:27 +00:00
|
|
|
"Name of bookmark most recently used in the current file.
|
|
|
|
It is buffer local, used to make moving a bookmark forward
|
1993-08-14 11:04:06 +00:00
|
|
|
through a file easier.")
|
1993-08-10 20:35:31 +00:00
|
|
|
|
|
|
|
(make-variable-buffer-local 'bookmark-current-bookmark)
|
|
|
|
|
|
|
|
(defvar bookmark-save-flag t
|
1993-08-14 19:49:27 +00:00
|
|
|
"*Controls when Emacs saves bookmarks to a file.
|
1994-05-16 07:24:45 +00:00
|
|
|
--> nil means never save bookmarks, except when `bookmark-save' is
|
1993-08-14 19:49:27 +00:00
|
|
|
explicitly called \(\\[bookmark-save]\).
|
|
|
|
--> t means save bookmarks when Emacs is killed.
|
|
|
|
--> Otherise, it should be a number that is the frequency with which
|
|
|
|
the bookmark list is saved \(i.e.: the number of times which
|
|
|
|
Emacs' bookmark list may be modified before it is automatically
|
|
|
|
saved.\). If it is a number, Emacs will also automatically save
|
|
|
|
bookmarks when it is killed.
|
1993-08-10 20:35:31 +00:00
|
|
|
|
|
|
|
Therefore, the way to get it to save every time you make or delete a
|
|
|
|
bookmark is to set this variable to 1 \(or 0, which produces the same
|
|
|
|
behavior.\)
|
|
|
|
|
|
|
|
To specify the file in which to save them, modify the variable
|
1993-08-14 19:49:27 +00:00
|
|
|
bookmark-file, which is `~/.emacs-bkmrks' by default.")
|
1993-08-10 20:35:31 +00:00
|
|
|
|
|
|
|
(defvar bookmark-alist-modification-count 0
|
1993-08-14 19:49:27 +00:00
|
|
|
"Number of modifications to bookmark list since it was last saved.")
|
1993-08-10 20:35:31 +00:00
|
|
|
|
1994-05-20 21:22:22 +00:00
|
|
|
(defvar bookmark-file
|
1994-11-01 05:45:47 +00:00
|
|
|
(if (or (eq system-type 'ms-dos) (eq system-type 'windows-nt))
|
1994-05-20 21:22:22 +00:00
|
|
|
"~/emacs.bmk" ; Cannot have initial dot [Yuck!]
|
|
|
|
"~/.emacs-bkmrks")
|
1993-08-10 20:35:31 +00:00
|
|
|
"*File in which to save bookmarks by default.")
|
|
|
|
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(defvar bookmark-version-control 'nospecial
|
1994-05-16 07:24:45 +00:00
|
|
|
"Control whether to make numbered backups of the master bookmark file.
|
|
|
|
This variable can have four values: t, nil, `never', and `nospecial'.
|
|
|
|
The first three have the same meaning that they do for the
|
|
|
|
variable `version-control'.
|
|
|
|
The value `nospecial' means just use the value of `version-control'.")
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
|
1993-08-10 20:35:31 +00:00
|
|
|
(defvar bookmark-completion-ignore-case t
|
1993-08-14 19:49:27 +00:00
|
|
|
"*Non-nil means bookmark functions ignore case in completion.")
|
1993-08-10 20:35:31 +00:00
|
|
|
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(defvar bookmark-sort-flag t
|
1994-05-16 07:24:45 +00:00
|
|
|
"*Non-nil means display bookmarks sorted by name.
|
|
|
|
Otherwise they are displayed in LIFO order (that is, most
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
recently set ones come first, oldest ones come last).")
|
|
|
|
|
1993-08-14 19:49:27 +00:00
|
|
|
(defvar bookmark-search-size 500
|
|
|
|
"Length of the context strings recorded on either side of a bookmark.")
|
1993-08-10 20:35:31 +00:00
|
|
|
|
|
|
|
(defvar bookmark-current-point 0)
|
|
|
|
(defvar bookmark-yank-point 0)
|
|
|
|
(defvar bookmark-current-buffer nil)
|
|
|
|
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;;;###autoload
|
1993-08-10 20:35:31 +00:00
|
|
|
(defun bookmark-set (&optional parg)
|
1994-05-16 07:24:45 +00:00
|
|
|
"Set a bookmark named NAME inside the visited file.
|
1993-08-14 19:49:27 +00:00
|
|
|
With prefix arg, will not overwrite a bookmark that has the same name
|
|
|
|
as NAME if such a bookmark already exists, but instead will \"push\"
|
|
|
|
the new bookmark onto the bookmark alist. Thus the most recently set
|
|
|
|
bookmark with name NAME would be the one in effect at any given time,
|
|
|
|
but the others are still there, should you decide to delete the most
|
|
|
|
recent one.
|
1993-08-10 20:35:31 +00:00
|
|
|
|
|
|
|
To yank words from the text of the buffer and use them as part of the
|
1993-08-14 19:49:27 +00:00
|
|
|
bookmark name, type C-w while setting a bookmark. Successive C-w's
|
1993-08-10 20:35:31 +00:00
|
|
|
yank successive words.
|
|
|
|
|
1994-05-16 07:24:45 +00:00
|
|
|
Typing C-v inserts the name of the current file being visited. Typing
|
1993-08-10 20:35:31 +00:00
|
|
|
C-u inserts the name of the last bookmark used in the buffer \(as an
|
|
|
|
aid in using a single bookmark name to track your progress through a
|
|
|
|
large file\). If no bookmark was used, then C-u behaves like C-v and
|
|
|
|
inserts the name of the file being visited.
|
|
|
|
|
|
|
|
Use \\[bookmark-delete] to remove bookmarks \(you give it a name,
|
|
|
|
and it removes only the first instance of a bookmark with that name from
|
|
|
|
the list of bookmarks.\)"
|
|
|
|
(interactive "P")
|
|
|
|
(if (not (bookmark-buffer-file-name))
|
|
|
|
(error "Buffer not visiting a file or directory."))
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(bookmark-try-default-file)
|
1993-08-10 20:35:31 +00:00
|
|
|
(setq bookmark-current-point (point))
|
|
|
|
(setq bookmark-yank-point (point))
|
|
|
|
(setq bookmark-current-buffer (current-buffer))
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(let* ((default (or bookmark-current-bookmark
|
|
|
|
(buffer-name (current-buffer))))
|
|
|
|
(str
|
|
|
|
(read-from-minibuffer
|
|
|
|
(format "Set bookmark (%s): " default)
|
|
|
|
nil
|
|
|
|
(let ((now-map (copy-keymap minibuffer-local-map)))
|
|
|
|
(progn (define-key now-map "\C-w"
|
|
|
|
'bookmark-yank-word)
|
|
|
|
(define-key now-map "\C-v"
|
|
|
|
'bookmark-insert-current-file-name)
|
|
|
|
(define-key now-map "\C-u"
|
|
|
|
'bookmark-insert-current-bookmark))
|
|
|
|
now-map))))
|
|
|
|
(and (string-equal str "") (setq str default))
|
1993-08-10 20:35:31 +00:00
|
|
|
(progn
|
|
|
|
(bookmark-make parg str)
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(setq bookmark-current-bookmark str)
|
|
|
|
(if (get-buffer "*Bookmark List*") ;rebuild the bookmark list
|
|
|
|
(save-excursion
|
|
|
|
(save-window-excursion
|
|
|
|
(list-bookmarks))))
|
1993-08-10 20:35:31 +00:00
|
|
|
(goto-char bookmark-current-point))))
|
|
|
|
|
|
|
|
(defun bookmark-insert-current-bookmark ()
|
|
|
|
;; insert this buffer's value of bookmark-current-bookmark, default
|
|
|
|
;; to file name if it's nil.
|
|
|
|
(interactive)
|
|
|
|
(let ((str
|
|
|
|
(save-excursion
|
|
|
|
(set-buffer bookmark-current-buffer)
|
|
|
|
bookmark-current-bookmark)))
|
|
|
|
(if str (insert str) (bookmark-insert-current-file-name))))
|
|
|
|
|
|
|
|
(defun bookmark-insert-current-file-name ()
|
|
|
|
;; insert the name (sans path) of the current file into the bookmark
|
|
|
|
;; name that is being set.
|
|
|
|
(interactive)
|
|
|
|
(let ((str (save-excursion
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(set-buffer bookmark-current-buffer)
|
|
|
|
(bookmark-buffer-file-name))))
|
1993-08-10 20:35:31 +00:00
|
|
|
(insert (substring
|
|
|
|
str
|
|
|
|
(1+ (string-match
|
|
|
|
"\\(/[^/]*\\)/*$"
|
|
|
|
str))))))
|
|
|
|
|
|
|
|
(defun bookmark-yank-word ()
|
|
|
|
(interactive)
|
|
|
|
;; get the next word from the buffer and append it to the name of
|
|
|
|
;; the bookmark currently being set.
|
|
|
|
(let ((string (save-excursion
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(set-buffer bookmark-current-buffer)
|
|
|
|
(goto-char bookmark-yank-point)
|
|
|
|
(buffer-substring
|
|
|
|
(point)
|
|
|
|
(save-excursion
|
|
|
|
(forward-word 1)
|
|
|
|
(setq bookmark-yank-point (point)))))))
|
1993-08-10 20:35:31 +00:00
|
|
|
(insert string)))
|
|
|
|
|
|
|
|
(defun bookmark-make (parg str)
|
|
|
|
(if (and (assoc str bookmark-alist) (not parg))
|
|
|
|
;; already existing boookmark under that name and
|
|
|
|
;; no prefix arg means just overwrite old bookmark
|
|
|
|
(setcdr (assoc str bookmark-alist)
|
|
|
|
(list (bookmark-make-cell)))
|
|
|
|
|
|
|
|
;; otherwise just cons it onto the front (either the bookmark
|
|
|
|
;; doesn't exist already, or there is no prefix arg. In either
|
|
|
|
;; case, we want the new bookmark consed onto the alist...)
|
|
|
|
|
|
|
|
(setq bookmark-alist
|
|
|
|
(cons
|
|
|
|
(list str
|
|
|
|
(bookmark-make-cell))
|
|
|
|
bookmark-alist)))
|
|
|
|
;; Added by db
|
|
|
|
(setq bookmark-current-bookmark str)
|
|
|
|
(setq bookmark-alist-modification-count
|
|
|
|
(1+ bookmark-alist-modification-count))
|
|
|
|
(if (bookmark-time-to-save-p)
|
|
|
|
(bookmark-save)))
|
|
|
|
|
|
|
|
(defun bookmark-make-cell ()
|
|
|
|
;; make the cell that is the cdr of a bookmark alist element. It
|
|
|
|
;; looks like this:
|
|
|
|
;; (filename search-forward-str search-back-str point)
|
|
|
|
(list
|
|
|
|
(bookmark-buffer-file-name)
|
|
|
|
(if (>= (- (point-max) (point)) bookmark-search-size)
|
|
|
|
(buffer-substring
|
|
|
|
(point)
|
|
|
|
(+ (point) bookmark-search-size))
|
|
|
|
nil)
|
|
|
|
(if (>= (- (point) (point-min)) bookmark-search-size)
|
|
|
|
(buffer-substring
|
|
|
|
(point)
|
|
|
|
(- (point) bookmark-search-size))
|
|
|
|
nil)
|
|
|
|
(point)))
|
|
|
|
|
|
|
|
(defun bookmark-buffer-file-name ()
|
|
|
|
(or
|
|
|
|
buffer-file-name
|
|
|
|
(if (and (boundp 'dired-directory) dired-directory)
|
|
|
|
(if (stringp dired-directory)
|
|
|
|
dired-directory
|
|
|
|
(car dired-directory)))))
|
|
|
|
|
|
|
|
(defun bookmark-try-default-file ()
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(and (not bookmarks-already-loaded)
|
|
|
|
(null bookmark-alist)
|
|
|
|
(file-readable-p (expand-file-name bookmark-file))
|
|
|
|
(progn
|
|
|
|
(bookmark-load bookmark-file t t)
|
|
|
|
(setq bookmarks-already-loaded t))))
|
|
|
|
|
|
|
|
(defun bookmark-maybe-sort-alist ()
|
|
|
|
;;Return the bookmark-alist for display. If the bookmark-sort-flag
|
|
|
|
;;is non-nil, then return a sorted copy of the alist.
|
|
|
|
(if bookmark-sort-flag
|
|
|
|
(setq bookmark-alist
|
|
|
|
(sort (copy-alist bookmark-alist)
|
|
|
|
(function
|
|
|
|
(lambda (x y) (string-lessp (car x) (car y))))))))
|
|
|
|
|
|
|
|
;;;###autoload
|
1993-08-10 20:35:31 +00:00
|
|
|
(defun bookmark-jump (str)
|
1993-08-14 19:49:27 +00:00
|
|
|
"Jump to bookmark BOOKMARK (a point in some file).
|
|
|
|
You may have a problem using this function if the value of variable
|
|
|
|
`bookmark-alist' is nil. If that happens, you need to load in some
|
|
|
|
bookmarks. See help on function `bookmark-load' for more about
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
this.
|
|
|
|
|
1994-05-16 07:24:45 +00:00
|
|
|
If the file pointed to by BOOKMARK no longer exists, `bookmark-jump'
|
|
|
|
asks you to specify a different file to use instead. If you specify
|
|
|
|
one, it also updates BOOKMARK to refer to that file."
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(interactive (progn (bookmark-try-default-file)
|
|
|
|
(let* ((completion-ignore-case
|
|
|
|
bookmark-completion-ignore-case)
|
|
|
|
(default
|
|
|
|
(or (and
|
|
|
|
(assoc bookmark-current-bookmark
|
|
|
|
bookmark-alist)
|
|
|
|
bookmark-current-bookmark)
|
|
|
|
(and (assoc (buffer-name (current-buffer))
|
|
|
|
bookmark-alist)
|
|
|
|
(buffer-name (current-buffer)))))
|
|
|
|
(str
|
|
|
|
(completing-read
|
|
|
|
(if default
|
|
|
|
(format "Jump to bookmark (%s): "
|
|
|
|
default)
|
|
|
|
"Jump to bookmark: ")
|
|
|
|
bookmark-alist
|
|
|
|
nil
|
|
|
|
0)))
|
|
|
|
(and (string-equal "" str)
|
|
|
|
(setq str default))
|
|
|
|
(list str))))
|
|
|
|
(let ((cell (bookmark-jump-noselect str)))
|
|
|
|
(and cell
|
|
|
|
(switch-to-buffer (car cell))
|
|
|
|
(goto-char (cdr cell)))))
|
|
|
|
|
|
|
|
(defun bookmark-jump-noselect (str)
|
|
|
|
;; a leetle helper for bookmark-jump :-)
|
|
|
|
;; returns (BUFFER . POINT)
|
|
|
|
(let ((whereto-list (car (cdr (assoc str bookmark-alist)))))
|
|
|
|
(let* ((file (expand-file-name (car whereto-list)))
|
|
|
|
(orig-file file)
|
|
|
|
(forward-str (car (cdr whereto-list)))
|
|
|
|
(behind-str (car (cdr (cdr whereto-list))))
|
|
|
|
(place (car (cdr (cdr (cdr whereto-list))))))
|
|
|
|
(if (or
|
|
|
|
(file-exists-p file)
|
|
|
|
;; else try some common compression extensions
|
|
|
|
;; and Emacs better handle it right!
|
|
|
|
(setq file
|
|
|
|
(or
|
|
|
|
(let ((altname (concat file ".Z")))
|
|
|
|
(and (file-exists-p altname)
|
|
|
|
altname))
|
|
|
|
(let ((altname (concat file ".gz")))
|
|
|
|
(and (file-exists-p altname)
|
|
|
|
altname))
|
|
|
|
(let ((altname (concat file ".z")))
|
|
|
|
(and (file-exists-p altname)
|
|
|
|
altname)))))
|
|
|
|
(save-excursion
|
|
|
|
(set-buffer (find-file-noselect file))
|
|
|
|
(goto-char place)
|
|
|
|
;; Go searching forward first. Then, if forward-str exists and
|
|
|
|
;; was found in the file, we can search backward for behind-str.
|
|
|
|
;; Rationale is that if text was inserted between the two in the
|
|
|
|
;; file, it's better to be put before it so you can read it,
|
|
|
|
;; rather than after and remain perhaps unaware of the changes.
|
|
|
|
(if forward-str
|
|
|
|
(if (search-forward forward-str (point-max) t)
|
|
|
|
(backward-char bookmark-search-size)))
|
|
|
|
(if behind-str
|
|
|
|
(if (search-backward behind-str (point-min) t)
|
|
|
|
(forward-char bookmark-search-size)))
|
|
|
|
;; added by db
|
|
|
|
(setq bookmark-current-bookmark str)
|
|
|
|
(cons (current-buffer) (point)))
|
|
|
|
(progn
|
|
|
|
(ding)
|
|
|
|
(if (y-or-n-p (concat (file-name-nondirectory orig-file)
|
|
|
|
" nonexistent. Relocate \""
|
|
|
|
str
|
|
|
|
"\"? "))
|
|
|
|
(progn
|
|
|
|
(bookmark-relocate str)
|
|
|
|
;; gasp! It's a recursive function call in Emacs Lisp!
|
|
|
|
(bookmark-jump-noselect str))
|
|
|
|
(message
|
|
|
|
"Bookmark not relocated, but deleting it would be a good idea.")
|
|
|
|
nil))))))
|
|
|
|
|
|
|
|
;;;###autoload
|
1994-05-16 07:24:45 +00:00
|
|
|
(defun bookmark-relocate (bookmark)
|
|
|
|
"Relocate bookmark BOOKMARK.
|
|
|
|
Prompt for a filename, and makes the bookmark BOOKMARK point to that
|
|
|
|
file, instead of the one it used to point at. Useful when a file has
|
|
|
|
been renamed after a bookmark was set in it."
|
1993-08-13 00:59:51 +00:00
|
|
|
(interactive (let ((completion-ignore-case
|
|
|
|
bookmark-completion-ignore-case))
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(progn (bookmark-try-default-file)
|
|
|
|
(list (completing-read
|
|
|
|
"Bookmark to relocate: "
|
|
|
|
bookmark-alist
|
|
|
|
nil
|
|
|
|
0)))))
|
1994-05-16 07:24:45 +00:00
|
|
|
(let* ((bmrk (assoc bookmark bookmark-alist))
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(bmrk-filename (car (car (cdr bmrk))))
|
|
|
|
(newloc (expand-file-name
|
|
|
|
(read-file-name
|
1994-05-16 07:24:45 +00:00
|
|
|
(format "Relocate %s to: " bookmark)
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(file-name-directory bmrk-filename)))))
|
|
|
|
(setcar (car (cdr bmrk)) newloc)))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun bookmark-locate (str &optional no-insertion)
|
|
|
|
"Insert the name of the file associated with BOOKMARK.
|
|
|
|
Optional second arg NO-INSERTION means merely return the filename as a
|
|
|
|
string."
|
|
|
|
(interactive (let ((completion-ignore-case
|
|
|
|
bookmark-completion-ignore-case))
|
|
|
|
(progn (bookmark-try-default-file)
|
|
|
|
(list (completing-read
|
|
|
|
"Insert bookmark location: "
|
|
|
|
bookmark-alist
|
|
|
|
nil
|
|
|
|
0)))))
|
|
|
|
(let ((where (car (car (cdr (assoc str bookmark-alist))))))
|
|
|
|
(if no-insertion
|
|
|
|
where
|
|
|
|
(insert where))))
|
|
|
|
|
|
|
|
;;;###autoload
|
1993-08-14 19:49:27 +00:00
|
|
|
(defun bookmark-rename (old &optional new)
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
"Change the name of OLD-BOOKMARK to NEWNAME.
|
|
|
|
If called from keyboard, prompts for OLD-BOOKMARK and NEWNAME.
|
|
|
|
If called from menubar, OLD-BOOKMARK is selected from a menu, and
|
|
|
|
prompts for NEWNAME.
|
|
|
|
If called from Lisp, prompts for NEWNAME if only OLD-BOOKMARK was
|
|
|
|
passed as an argument. If called with two strings, then no prompting
|
|
|
|
is done. You must pass at least OLD-BOOKMARK when calling from Lisp.
|
1993-08-14 19:49:27 +00:00
|
|
|
|
|
|
|
While you are entering the new name, consecutive C-w's insert
|
|
|
|
consectutive words from the text of the buffer into the new bookmark
|
|
|
|
name, and C-v inserts the name of the file."
|
1993-08-13 00:59:51 +00:00
|
|
|
(interactive (let ((completion-ignore-case
|
|
|
|
bookmark-completion-ignore-case))
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(progn (bookmark-try-default-file)
|
|
|
|
(list (completing-read "Old bookmark name: "
|
|
|
|
bookmark-alist
|
|
|
|
nil
|
|
|
|
0)))))
|
1993-08-10 20:35:31 +00:00
|
|
|
(progn
|
|
|
|
(setq bookmark-current-point (point))
|
|
|
|
(setq bookmark-yank-point (point))
|
|
|
|
(setq bookmark-current-buffer (current-buffer))
|
|
|
|
(let ((cell (assoc old bookmark-alist))
|
|
|
|
(str
|
1993-08-14 19:49:27 +00:00
|
|
|
(or new ; use second arg, if non-nil
|
|
|
|
(read-from-minibuffer
|
|
|
|
"New name: "
|
|
|
|
nil
|
|
|
|
(let ((now-map (copy-keymap minibuffer-local-map)))
|
|
|
|
(progn (define-key now-map "\C-w"
|
|
|
|
'bookmark-yank-word)
|
|
|
|
(define-key now-map "\C-v"
|
|
|
|
'bookmark-insert-current-file-name))
|
|
|
|
now-map)))))
|
1993-08-10 20:35:31 +00:00
|
|
|
(progn
|
|
|
|
(setcar cell str)
|
|
|
|
(setq bookmark-current-bookmark str)
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(if (get-buffer "*Bookmark List*")
|
|
|
|
(save-excursion (save-window-excursion (list-bookmarks))))
|
1993-08-10 20:35:31 +00:00
|
|
|
(setq bookmark-alist-modification-count
|
|
|
|
(1+ bookmark-alist-modification-count))
|
|
|
|
(if (bookmark-time-to-save-p)
|
|
|
|
(bookmark-save))))))
|
|
|
|
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;;;###autoload
|
1993-08-10 20:35:31 +00:00
|
|
|
(defun bookmark-insert (str)
|
1993-08-14 19:49:27 +00:00
|
|
|
"Insert the text of the file pointed to by bookmark BOOKMARK.
|
|
|
|
You may have a problem using this function if the value of variable
|
|
|
|
`bookmark-alist' is nil. If that happens, you need to load in some
|
|
|
|
bookmarks. See help on function `bookmark-load' for more about
|
1993-08-14 11:04:06 +00:00
|
|
|
this."
|
1993-08-13 00:59:51 +00:00
|
|
|
(interactive (let ((completion-ignore-case
|
|
|
|
bookmark-completion-ignore-case))
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(progn (bookmark-try-default-file)
|
|
|
|
(list (completing-read
|
|
|
|
"Insert bookmark contents: "
|
|
|
|
bookmark-alist
|
|
|
|
nil
|
|
|
|
0)))))
|
|
|
|
(let ((orig-point (point))
|
|
|
|
(str-to-insert
|
|
|
|
(save-excursion
|
|
|
|
(set-buffer (car (bookmark-jump-noselect str)))
|
|
|
|
(buffer-substring (point-min) (point-max)))))
|
|
|
|
(insert str-to-insert)
|
|
|
|
(push-mark)
|
|
|
|
(goto-char orig-point)))
|
|
|
|
|
|
|
|
;;;###autoload
|
1993-08-10 20:35:31 +00:00
|
|
|
(defun bookmark-delete (str)
|
1993-08-14 19:49:27 +00:00
|
|
|
"Delete the bookmark named NAME from the bookmark list.
|
|
|
|
Removes only the first instance of a bookmark with that name. If
|
|
|
|
there are one or more other bookmarks with the same name, they will
|
|
|
|
not be deleted. Defaults to the \"current\" bookmark \(that is, the
|
|
|
|
one most recently used in this file, if any\)."
|
1993-08-10 20:35:31 +00:00
|
|
|
(interactive (let ((completion-ignore-case
|
|
|
|
bookmark-completion-ignore-case))
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(progn (bookmark-try-default-file)
|
|
|
|
(list
|
|
|
|
(completing-read
|
|
|
|
"Delete bookmark: "
|
|
|
|
bookmark-alist
|
|
|
|
nil
|
|
|
|
0
|
|
|
|
bookmark-current-bookmark)))))
|
1993-08-13 00:59:51 +00:00
|
|
|
(let ((will-go (assoc str bookmark-alist)))
|
|
|
|
(setq bookmark-alist (delq will-go bookmark-alist))
|
|
|
|
;; Added by db, nil bookmark-current-bookmark if the last
|
|
|
|
;; occurence has been deleted
|
1993-08-10 20:35:31 +00:00
|
|
|
(or (assoc bookmark-current-bookmark bookmark-alist)
|
1993-08-13 00:59:51 +00:00
|
|
|
(setq bookmark-current-bookmark nil)))
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(if (get-buffer "*Bookmark List*")
|
|
|
|
(save-excursion (save-window-excursion (list-bookmarks))))
|
1993-08-13 00:59:51 +00:00
|
|
|
(setq bookmark-alist-modification-count
|
|
|
|
(1+ bookmark-alist-modification-count))
|
|
|
|
(if (bookmark-time-to-save-p)
|
|
|
|
(bookmark-save)))
|
1993-08-10 20:35:31 +00:00
|
|
|
|
|
|
|
(defun bookmark-time-to-save-p (&optional last-time)
|
|
|
|
;; By Gregory M. Saunders <saunders@cis.ohio-state.edu>
|
|
|
|
;; finds out whether it's time to save bookmarks to a file, by
|
|
|
|
;; examining the value of variable bookmark-save-flag, and maybe
|
|
|
|
;; bookmark-alist-modification-count. Returns t if they should be
|
|
|
|
;; saved, nil otherwise. if last-time is non-nil, then this is
|
|
|
|
;; being called when emacs is killed.
|
|
|
|
(cond (last-time
|
|
|
|
(and (> bookmark-alist-modification-count 0)
|
|
|
|
bookmark-save-flag))
|
|
|
|
((numberp bookmark-save-flag)
|
|
|
|
(>= bookmark-alist-modification-count bookmark-save-flag))
|
|
|
|
(t
|
|
|
|
nil)))
|
|
|
|
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;;;###autoload
|
1993-08-10 20:35:31 +00:00
|
|
|
(defun bookmark-write ()
|
1994-05-16 07:24:45 +00:00
|
|
|
"Write bookmarks to a specified file.
|
|
|
|
Don't use this in Lisp programs; use `bookmark-save' instead."
|
1993-08-10 20:35:31 +00:00
|
|
|
(interactive)
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(bookmark-try-default-file)
|
1993-08-10 20:35:31 +00:00
|
|
|
(bookmark-save t))
|
|
|
|
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;;;###autoload
|
1993-08-13 00:59:51 +00:00
|
|
|
(defun bookmark-save (&optional parg file)
|
1993-08-14 19:49:27 +00:00
|
|
|
"Save currently defined bookmarks.
|
|
|
|
Saves by default in the file defined by the variable
|
|
|
|
`bookmark-file'. With a prefix arg, save it in file FILE.
|
1993-08-10 20:35:31 +00:00
|
|
|
|
|
|
|
If you are calling this from Lisp, the two arguments are PREFIX-ARG
|
|
|
|
and FILE, and if you just want it to write to the default file, then
|
|
|
|
pass no arguments. Or pass in nil and FILE, and it will save in FILE
|
|
|
|
instead. If you pass in one argument, and it is non-nil, then the
|
|
|
|
user will be interactively queried for a file to save in.
|
|
|
|
|
1993-08-13 00:59:51 +00:00
|
|
|
When you want to load in the bookmarks from a file, use
|
1993-08-14 19:49:27 +00:00
|
|
|
\`bookmark-load\', \\[bookmark-load]. That function will prompt you
|
1993-08-13 00:59:51 +00:00
|
|
|
for a file, defaulting to the file defined by variable
|
1993-08-14 19:49:27 +00:00
|
|
|
`bookmark-file'."
|
1993-08-10 20:35:31 +00:00
|
|
|
(interactive "P")
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(bookmark-try-default-file)
|
1993-08-10 20:35:31 +00:00
|
|
|
(cond
|
|
|
|
((and (null parg) (null file))
|
|
|
|
;;whether interactive or not, write to default file
|
|
|
|
(bookmark-write-file bookmark-file))
|
|
|
|
((and (null parg) file)
|
|
|
|
;;whether interactive or not, write to given file
|
|
|
|
(bookmark-write-file file))
|
|
|
|
((and parg (not file))
|
|
|
|
;;have been called interactively w/ prefix arg
|
|
|
|
(let ((file (read-file-name "File to save bookmarks in: ")))
|
|
|
|
(bookmark-write-file file)))
|
|
|
|
(t ; someone called us with prefix-arg *and* a file, so just write to file
|
|
|
|
(bookmark-write-file file)))
|
|
|
|
;; signal that we have synced the bookmark file by setting this to
|
|
|
|
;; 0. If there was an error at any point before, it will not get
|
|
|
|
;; set, which is what we want.
|
|
|
|
(setq bookmark-alist-modification-count 0))
|
|
|
|
|
|
|
|
(defun bookmark-write-file (file)
|
|
|
|
(save-excursion
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(save-window-excursion
|
|
|
|
(if (>= baud-rate 9600)
|
|
|
|
(message (format "Saving bookmarks to file %s." file)))
|
1993-10-26 03:29:54 +00:00
|
|
|
(set-buffer (let ((enable-local-variables nil))
|
1993-10-25 23:56:15 +00:00
|
|
|
(find-file-noselect file)))
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(goto-char (point-min))
|
|
|
|
(delete-region (point-min) (point-max))
|
|
|
|
(print bookmark-alist (current-buffer))
|
|
|
|
(let ((version-control
|
|
|
|
(cond
|
|
|
|
((null bookmark-version-control) nil)
|
|
|
|
((eq 'never bookmark-version-control) 'never)
|
|
|
|
((eq 'nospecial bookmark-version-control) version-control)
|
|
|
|
(t
|
|
|
|
t))))
|
|
|
|
(write-file file)
|
|
|
|
(kill-buffer (current-buffer))))))
|
|
|
|
|
|
|
|
;;;###autoload
|
1993-08-10 20:35:31 +00:00
|
|
|
(defun bookmark-load (file &optional revert no-msg)
|
1993-08-14 19:49:27 +00:00
|
|
|
"Load bookmarks from FILE (which must be in bookmark format).
|
|
|
|
Appends loaded bookmarks to the front of the list of bookmarks. If
|
|
|
|
optional second argument REVERT is non-nil, existing bookmarks are
|
|
|
|
destroyed. Optional third arg NO-MSG means don't display any messages
|
|
|
|
while loading.
|
1993-08-10 20:35:31 +00:00
|
|
|
|
|
|
|
If you load a file that doesn't contain a proper bookmark alist, you
|
1993-08-14 19:49:27 +00:00
|
|
|
will corrupt Emacs's bookmark list. Generally, you should only load
|
1993-08-10 20:35:31 +00:00
|
|
|
in files that were created with the bookmark functions in the first
|
1993-08-14 19:49:27 +00:00
|
|
|
place. Your own personal bookmark file, `~/.emacs-bkmrks', is
|
1993-08-14 11:04:06 +00:00
|
|
|
maintained automatically by Emacs; you shouldn't need to load it
|
1993-08-13 00:59:51 +00:00
|
|
|
explicitly."
|
1993-08-10 20:35:31 +00:00
|
|
|
(interactive
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(progn (bookmark-try-default-file)
|
|
|
|
(list (read-file-name
|
|
|
|
(format "Load bookmarks from: (%s) "
|
|
|
|
bookmark-file)
|
|
|
|
;;Default might not be used often,
|
|
|
|
;;but there's no better default, and
|
|
|
|
;;I guess it's better than none at all.
|
|
|
|
"~/" bookmark-file 'confirm))))
|
1993-08-10 20:35:31 +00:00
|
|
|
(setq file (expand-file-name file))
|
|
|
|
(if (file-readable-p file)
|
|
|
|
(save-excursion
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(save-window-excursion
|
|
|
|
(if (and (null no-msg) (>= baud-rate 9600))
|
|
|
|
(message (format "Loading bookmarks from %s..." file)))
|
1993-10-26 03:29:54 +00:00
|
|
|
(set-buffer (let ((enable-local-variables nil))
|
1993-10-25 23:56:15 +00:00
|
|
|
(find-file-noselect file)))
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(goto-char (point-min))
|
|
|
|
(let ((blist (car (read-from-string
|
|
|
|
(buffer-substring (point-min) (point-max))))))
|
|
|
|
(if (listp blist)
|
|
|
|
(progn
|
|
|
|
(if (not revert)
|
|
|
|
(setq bookmark-alist-modification-count
|
|
|
|
(1+ bookmark-alist-modification-count))
|
|
|
|
(setq bookmark-alist-modification-count 0))
|
|
|
|
(setq bookmark-alist
|
|
|
|
(append blist (if (not revert) bookmark-alist)))
|
|
|
|
(if (get-buffer "*Bookmark List*")
|
|
|
|
(save-excursion (list-bookmarks))))
|
|
|
|
(error (format "Invalid bookmark list in %s." file))))
|
|
|
|
(kill-buffer (current-buffer)))
|
|
|
|
(if (and (null no-msg) (>= baud-rate 9600))
|
|
|
|
(message (format "Loading bookmarks from %s... done" file))))
|
1993-08-10 20:35:31 +00:00
|
|
|
(error (format "Cannot read bookmark file %s." file))))
|
|
|
|
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;;;; bookmark-menu-mode stuff ;;;;
|
|
|
|
|
|
|
|
(defvar Bookmark-menu-bookmark-column nil)
|
|
|
|
|
|
|
|
(defvar Bookmark-menu-hidden-bookmarks ())
|
|
|
|
|
|
|
|
(defvar Bookmark-menu-file-column 30
|
|
|
|
"*Column at which to display filenames in a buffer listing bookmarks.
|
|
|
|
You can toggle whether files are shown with \\<Bookmark-menu-mode-map>\\[Bookmark-menu-toggle-filenames].")
|
|
|
|
|
|
|
|
(defvar Bookmark-menu-toggle-filenames t
|
|
|
|
"*Non-nil means show filenames when listing bookmarks.
|
|
|
|
This may result in truncated bookmark names. To disable this, put the
|
|
|
|
following in your .emacs:
|
|
|
|
|
|
|
|
\(setq Bookmark-menu-toggle-filenames nil\)")
|
|
|
|
|
|
|
|
(defvar Bookmark-menu-mode-map nil)
|
|
|
|
|
|
|
|
(if Bookmark-menu-mode-map
|
|
|
|
nil
|
|
|
|
(setq Bookmark-menu-mode-map (make-keymap))
|
|
|
|
(suppress-keymap Bookmark-menu-mode-map t)
|
|
|
|
(define-key Bookmark-menu-mode-map "q" 'Bookmark-menu-quit)
|
|
|
|
(define-key Bookmark-menu-mode-map "v" 'Bookmark-menu-select)
|
|
|
|
(define-key Bookmark-menu-mode-map "w" 'Bookmark-menu-locate)
|
|
|
|
(define-key Bookmark-menu-mode-map "2" 'Bookmark-menu-2-window)
|
|
|
|
(define-key Bookmark-menu-mode-map "1" 'Bookmark-menu-1-window)
|
|
|
|
(define-key Bookmark-menu-mode-map "j" 'Bookmark-menu-this-window)
|
|
|
|
(define-key Bookmark-menu-mode-map "f" 'Bookmark-menu-this-window)
|
|
|
|
(define-key Bookmark-menu-mode-map "o" 'Bookmark-menu-other-window)
|
|
|
|
(define-key Bookmark-menu-mode-map "\C-o" 'Bookmark-menu-switch-other-window)
|
|
|
|
(define-key Bookmark-menu-mode-map "s" 'Bookmark-menu-save)
|
|
|
|
(define-key Bookmark-menu-mode-map "k" 'Bookmark-menu-delete)
|
|
|
|
(define-key Bookmark-menu-mode-map "\C-d" 'Bookmark-menu-delete-backwards)
|
|
|
|
(define-key Bookmark-menu-mode-map "x" 'Bookmark-menu-execute)
|
|
|
|
(define-key Bookmark-menu-mode-map "\C-k" 'Bookmark-menu-delete)
|
|
|
|
(define-key Bookmark-menu-mode-map "d" 'Bookmark-menu-delete)
|
|
|
|
(define-key Bookmark-menu-mode-map " " 'next-line)
|
|
|
|
(define-key Bookmark-menu-mode-map "n" 'next-line)
|
|
|
|
(define-key Bookmark-menu-mode-map "p" 'previous-line)
|
|
|
|
(define-key Bookmark-menu-mode-map "\177" 'Bookmark-menu-backup-unmark)
|
|
|
|
(define-key Bookmark-menu-mode-map "?" 'describe-mode)
|
|
|
|
(define-key Bookmark-menu-mode-map "u" 'Bookmark-menu-unmark)
|
|
|
|
(define-key Bookmark-menu-mode-map "m" 'Bookmark-menu-mark)
|
|
|
|
(define-key Bookmark-menu-mode-map "l" 'Bookmark-menu-load)
|
|
|
|
(define-key Bookmark-menu-mode-map "r" 'Bookmark-menu-rename)
|
|
|
|
(define-key Bookmark-menu-mode-map "t" 'Bookmark-menu-toggle-filenames))
|
|
|
|
|
|
|
|
;; Bookmark Menu mode is suitable only for specially formatted data.
|
|
|
|
(put 'Bookmark-menu-mode 'mode-class 'special)
|
|
|
|
|
|
|
|
;; need to display whether or not bookmark exists as a buffer in flag
|
|
|
|
;; column.
|
|
|
|
|
|
|
|
;; Format:
|
|
|
|
;; FLAGS BOOKMARK (/FILE/NAME/HERE/WHAT/REGEXP/TO/USE?)
|
|
|
|
;; goto bookmark-column and then search till "(/[^)]*)$" or "(/.*)$" ?
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defalias 'edit-bookmarks 'list-bookmarks)
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun list-bookmarks ()
|
|
|
|
"Display a list of existing bookmarks.
|
|
|
|
The list is displayed in a buffer named `*Bookmark List*'.
|
1994-05-16 07:24:45 +00:00
|
|
|
The leftmost column displays a `D' if the bookmark is flagged for
|
|
|
|
deletion, or `>' if it is flagged for displaying."
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(interactive)
|
|
|
|
(bookmark-try-default-file)
|
|
|
|
(switch-to-buffer (get-buffer-create "*Bookmark List*"))
|
|
|
|
(let ((buffer-read-only nil))
|
|
|
|
(delete-region (point-max) (point-min))
|
|
|
|
(goto-char (point-min)) ;sure are playing it safe...
|
|
|
|
(insert "% Bookmark\n- --------\n")
|
|
|
|
(bookmark-maybe-sort-alist)
|
|
|
|
(let ((lst bookmark-alist))
|
|
|
|
(while lst
|
|
|
|
(insert
|
|
|
|
(concat " " (car (car lst)) "\n"))
|
|
|
|
(setq lst (cdr lst)))))
|
|
|
|
(goto-char (point-min))
|
|
|
|
(forward-line 2)
|
|
|
|
(bookmark-menu-mode)
|
|
|
|
(if Bookmark-menu-toggle-filenames
|
|
|
|
(Bookmark-menu-toggle-filenames t)))
|
|
|
|
|
|
|
|
(defun bookmark-menu-mode ()
|
|
|
|
"Major mode for editing a list of bookmarks.
|
|
|
|
Each line describes one of the bookmarks in Emacs.
|
|
|
|
Letters do not insert themselves; instead, they are commands.
|
|
|
|
\\<Bookmark-menu-mode-map>
|
|
|
|
\\[Bookmark-menu-mark] -- mark bookmark to be displayed.
|
|
|
|
\\[Bookmark-menu-select] -- select bookmark of line point is on.
|
1994-05-16 07:24:45 +00:00
|
|
|
Also show bookmarks marked using `m' in other windows.
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
\\[Bookmark-menu-toggle-filenames] -- toggle displaying of filenames (they may obscure long bookmark names).
|
|
|
|
\\[Bookmark-menu-locate] -- display (in minibuffer) location of this bookmark.
|
|
|
|
\\[Bookmark-menu-1-window] -- select this bookmark in full-frame window.
|
|
|
|
\\[Bookmark-menu-2-window] -- select this bookmark in one window,
|
|
|
|
together with bookmark selected before this one in another window.
|
|
|
|
\\[Bookmark-menu-this-window] -- select this bookmark in place of the bookmark menu buffer.
|
|
|
|
\\[Bookmark-menu-other-window] -- select this bookmark in another window,
|
|
|
|
so the bookmark menu bookmark remains visible in its window.
|
|
|
|
\\[Bookmark-menu-switch-other-window] -- switch the other window to this bookmark.
|
|
|
|
\\[Bookmark-menu-rename] -- rename this bookmark \(prompts for new name\).
|
|
|
|
\\[Bookmark-menu-delete] -- mark this bookmark to be deleted, and move down.
|
|
|
|
\\[Bookmark-menu-delete-backwards] -- mark this bookmark to be deleted, and move up.
|
|
|
|
\\[Bookmark-menu-execute] -- delete marked bookmarks.
|
|
|
|
\\[Bookmark-menu-save] -- save the current bookmark list in the default file.
|
|
|
|
With a prefix arg, prompts for a file to save in.
|
|
|
|
\\[Bookmark-menu-load] -- load in a file of bookmarks (prompts for file.)
|
|
|
|
\\[Bookmark-menu-unmark] -- remove all kinds of marks from current line.
|
|
|
|
With prefix argument, also move up one line.
|
|
|
|
\\[Bookmark-menu-backup-unmark] -- back up a line and remove marks."
|
|
|
|
(kill-all-local-variables)
|
|
|
|
(use-local-map Bookmark-menu-mode-map)
|
|
|
|
(setq truncate-lines t)
|
|
|
|
(setq buffer-read-only t)
|
|
|
|
(setq major-mode 'bookmark-menu-mode)
|
|
|
|
(setq mode-name "Bookmark Menu")
|
|
|
|
(run-hooks 'bookmark-menu-mode-hook))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-toggle-filenames (&optional parg)
|
|
|
|
"Toggle whether filenames are shown in the bookmark list.
|
|
|
|
Optional argument SHOW means show them unconditionally."
|
|
|
|
(interactive)
|
|
|
|
(cond
|
|
|
|
(parg
|
|
|
|
(setq Bookmark-menu-toggle-filenames nil)
|
|
|
|
(Bookmark-menu-show-filenames)
|
|
|
|
(setq Bookmark-menu-toggle-filenames t))
|
|
|
|
(Bookmark-menu-toggle-filenames
|
|
|
|
(Bookmark-menu-hide-filenames)
|
|
|
|
(setq Bookmark-menu-toggle-filenames nil))
|
|
|
|
(t
|
|
|
|
(Bookmark-menu-show-filenames)
|
|
|
|
(setq Bookmark-menu-toggle-filenames t))))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-show-filenames (&optional force)
|
|
|
|
(if (and (not force) Bookmark-menu-toggle-filenames)
|
|
|
|
nil ;already shown, so do nothing
|
|
|
|
(save-excursion
|
|
|
|
(save-window-excursion
|
|
|
|
(goto-char (point-min))
|
|
|
|
(forward-line 2)
|
|
|
|
(setq Bookmark-menu-hidden-bookmarks ())
|
|
|
|
(let ((buffer-read-only nil))
|
|
|
|
(while (< (point) (point-max))
|
|
|
|
(let ((bmrk (Bookmark-menu-bookmark)))
|
|
|
|
(setq Bookmark-menu-hidden-bookmarks
|
|
|
|
(cons bmrk Bookmark-menu-hidden-bookmarks))
|
|
|
|
(move-to-column Bookmark-menu-file-column t)
|
|
|
|
(delete-region (point) (progn (end-of-line) (point)))
|
|
|
|
(insert " ")
|
|
|
|
(bookmark-locate bmrk)
|
|
|
|
(forward-line 1))))))))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-hide-filenames (&optional force)
|
|
|
|
(if (and (not force) Bookmark-menu-toggle-filenames)
|
|
|
|
;; nothing to hide if above is nil
|
|
|
|
(save-excursion
|
|
|
|
(save-window-excursion
|
|
|
|
(goto-char (point-min))
|
|
|
|
(forward-line 2)
|
|
|
|
(setq Bookmark-menu-hidden-bookmarks
|
|
|
|
(nreverse Bookmark-menu-hidden-bookmarks))
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (point-min))
|
|
|
|
(search-forward "Bookmark")
|
|
|
|
(backward-word 1)
|
|
|
|
(setq Bookmark-menu-bookmark-column (current-column)))
|
|
|
|
(save-excursion
|
|
|
|
(let ((buffer-read-only nil))
|
|
|
|
(while Bookmark-menu-hidden-bookmarks
|
|
|
|
(move-to-column Bookmark-menu-bookmark-column t)
|
|
|
|
(kill-line)
|
|
|
|
(insert (car Bookmark-menu-hidden-bookmarks))
|
|
|
|
(setq Bookmark-menu-hidden-bookmarks
|
|
|
|
(cdr Bookmark-menu-hidden-bookmarks))
|
|
|
|
(forward-line 1))))))))
|
|
|
|
|
|
|
|
;; if you look at this next function from far away, it resembles a
|
|
|
|
;; gun. But only with this comment above...
|
|
|
|
(defun Bookmark-menu-check-position ()
|
|
|
|
;; Returns t if on a line with a bookmark.
|
|
|
|
;; Otherwise, repositions and returns t.
|
|
|
|
;; written by David Hughes <djh@harston.cv.com>
|
|
|
|
;; Mucho thanks, David! -karl
|
|
|
|
(cond ((< (count-lines (point-min) (point)) 2)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(forward-line 2)
|
|
|
|
t)
|
|
|
|
((and (bolp) (eobp))
|
|
|
|
(beginning-of-line 0)
|
|
|
|
t)
|
|
|
|
(t
|
|
|
|
t)))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-bookmark ()
|
|
|
|
;; return a string which is bookmark of this line.
|
|
|
|
(if (Bookmark-menu-check-position)
|
|
|
|
(save-excursion
|
|
|
|
(save-window-excursion
|
|
|
|
(goto-char (point-min))
|
|
|
|
(search-forward "Bookmark")
|
|
|
|
(backward-word 1)
|
|
|
|
(setq Bookmark-menu-bookmark-column (current-column)))))
|
|
|
|
(if Bookmark-menu-toggle-filenames
|
|
|
|
(Bookmark-menu-hide-filenames))
|
|
|
|
(save-excursion
|
|
|
|
(save-window-excursion
|
|
|
|
(beginning-of-line)
|
|
|
|
(forward-char Bookmark-menu-bookmark-column)
|
|
|
|
(prog1
|
|
|
|
(buffer-substring (point)
|
|
|
|
(progn
|
|
|
|
(end-of-line)
|
|
|
|
(point)))
|
|
|
|
;; well, this is certainly crystal-clear:
|
|
|
|
(if Bookmark-menu-toggle-filenames
|
|
|
|
(Bookmark-menu-toggle-filenames t))))))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-mark ()
|
|
|
|
"Mark bookmark on this line to be displayed by \\<Bookmark-menu-mode-map>\\[Bookmark-menu-select] command."
|
|
|
|
(interactive)
|
|
|
|
(beginning-of-line)
|
|
|
|
(if (Bookmark-menu-check-position)
|
|
|
|
(let ((buffer-read-only nil))
|
|
|
|
(delete-char 1)
|
|
|
|
(insert ?>)
|
|
|
|
(forward-line 1))))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-select ()
|
|
|
|
"Select this line's bookmark; also display bookmarks marked with `>'.
|
|
|
|
You can mark bookmarks with the \\<Bookmark-menu-mode-map>\\[Bookmark-menu-mark] command."
|
|
|
|
(interactive)
|
|
|
|
(if (Bookmark-menu-check-position)
|
|
|
|
(let ((bmrk (Bookmark-menu-bookmark))
|
|
|
|
(menu (current-buffer))
|
|
|
|
(others ())
|
|
|
|
tem)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (re-search-forward "^>" nil t)
|
|
|
|
(setq tem (Bookmark-menu-bookmark))
|
|
|
|
(let ((buffer-read-only nil))
|
|
|
|
(delete-char -1)
|
|
|
|
(insert ?\ ))
|
|
|
|
(or (string-equal tem bmrk)
|
|
|
|
(memq tem others)
|
|
|
|
(setq others (cons tem others))))
|
|
|
|
(setq others (nreverse others)
|
|
|
|
tem (/ (1- (frame-height)) (1+ (length others))))
|
|
|
|
(delete-other-windows)
|
|
|
|
(bookmark-jump bmrk)
|
|
|
|
(bury-buffer menu)
|
|
|
|
(if (equal (length others) 0)
|
|
|
|
nil
|
|
|
|
(while others
|
|
|
|
(split-window nil tem)
|
|
|
|
(other-window 1)
|
|
|
|
(bookmark-jump (car others))
|
|
|
|
(setq others (cdr others)))
|
|
|
|
(other-window 1)))))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-save (parg)
|
|
|
|
"Save the current list into a bookmark file.
|
|
|
|
With a prefix arg, prompts for a file to save them in."
|
|
|
|
(interactive "P")
|
|
|
|
(save-excursion
|
|
|
|
(save-window-excursion
|
|
|
|
(bookmark-save parg))))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-load ()
|
|
|
|
"Load a bookmark file and rebuild list."
|
|
|
|
(interactive)
|
|
|
|
(if (Bookmark-menu-check-position)
|
|
|
|
(save-excursion
|
|
|
|
(save-window-excursion
|
|
|
|
(call-interactively 'bookmark-load)))))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-1-window ()
|
|
|
|
"Select this line's bookmark, alone, in full frame."
|
|
|
|
(interactive)
|
|
|
|
(if (Bookmark-menu-check-position)
|
|
|
|
(progn
|
|
|
|
(bookmark-jump (Bookmark-menu-bookmark))
|
|
|
|
(bury-buffer (other-buffer))
|
|
|
|
(delete-other-windows))))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-2-window ()
|
|
|
|
"Select this line's bookmark, with previous buffer in second window."
|
|
|
|
(interactive)
|
|
|
|
(if (Bookmark-menu-check-position)
|
|
|
|
(let ((bmrk (Bookmark-menu-bookmark))
|
|
|
|
(menu (current-buffer))
|
|
|
|
(pop-up-windows t))
|
|
|
|
(delete-other-windows)
|
|
|
|
(switch-to-buffer (other-buffer))
|
|
|
|
(let ((buff (car (bookmark-jump-noselect bmrk))))
|
|
|
|
(pop-to-buffer buff))
|
|
|
|
(bury-buffer menu))))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-this-window ()
|
|
|
|
"Select this line's bookmark in this window."
|
|
|
|
(interactive)
|
|
|
|
(if (Bookmark-menu-check-position)
|
|
|
|
(bookmark-jump (Bookmark-menu-bookmark))))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-other-window ()
|
|
|
|
"Select this line's bookmark in other window, leaving bookmark menu visible."
|
|
|
|
(interactive)
|
|
|
|
(if (Bookmark-menu-check-position)
|
|
|
|
(let ((buff (car (bookmark-jump-noselect (Bookmark-menu-bookmark)))))
|
|
|
|
(switch-to-buffer-other-window buff))))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-switch-other-window ()
|
|
|
|
"Make the other window select this line's bookmark.
|
|
|
|
The current window remains selected."
|
|
|
|
(interactive)
|
|
|
|
(if (Bookmark-menu-check-position)
|
|
|
|
(let ((buff (car (bookmark-jump-noselect (Bookmark-menu-bookmark)))))
|
|
|
|
(display-buffer buff))))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-quit ()
|
|
|
|
"Quit the bookmark menu."
|
|
|
|
(interactive)
|
|
|
|
(let ((buffer (current-buffer)))
|
|
|
|
(switch-to-buffer (other-buffer))
|
|
|
|
(bury-buffer buffer)))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-unmark (&optional backup)
|
|
|
|
"Cancel all requested operations on bookmark on this line and move down.
|
|
|
|
Optional ARG means move up."
|
|
|
|
(interactive "P")
|
|
|
|
(beginning-of-line)
|
|
|
|
(if (Bookmark-menu-check-position)
|
|
|
|
(progn
|
|
|
|
(let ((buffer-read-only nil))
|
|
|
|
(delete-char 1)
|
|
|
|
;; any flags to reset according to circumstances? How about a
|
|
|
|
;; flag indicating whether this bookmark is being visited?
|
|
|
|
;; well, we don't have this now, so maybe later.
|
|
|
|
(insert " "))
|
|
|
|
(forward-line (if backup -1 1)))))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-backup-unmark ()
|
|
|
|
"Move up and cancel all requested operations on bookmark on line above."
|
|
|
|
(interactive)
|
|
|
|
(forward-line -1)
|
|
|
|
(if (Bookmark-menu-check-position)
|
|
|
|
(progn
|
|
|
|
(Bookmark-menu-unmark)
|
|
|
|
(forward-line -1))))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-delete ()
|
|
|
|
"Mark bookmark on this line to be deleted by \\<Bookmark-menu-mode-map>\\[Bookmark-menu-execute] command."
|
|
|
|
(interactive)
|
|
|
|
(beginning-of-line)
|
|
|
|
(if (Bookmark-menu-check-position)
|
|
|
|
(let ((buffer-read-only nil))
|
|
|
|
(delete-char 1)
|
|
|
|
(insert ?D)
|
|
|
|
(forward-line 1))))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-delete-backwards ()
|
1994-05-16 07:24:45 +00:00
|
|
|
"Mark bookmark on this line to be deleted by \\<Bookmark-menu-mode-map>\\[Bookmark-menu-execute] command.
|
|
|
|
Then move up one line"
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(interactive)
|
|
|
|
(Bookmark-menu-delete)
|
|
|
|
(forward-line -2)
|
|
|
|
(if (Bookmark-menu-check-position)
|
|
|
|
(forward-line 1)))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-execute ()
|
|
|
|
"Delete bookmarks marked with \\<Buffer-menu-mode-map>\\[Buffer-menu-delete] commands."
|
|
|
|
(interactive)
|
|
|
|
(let ((hide-em Bookmark-menu-toggle-filenames))
|
|
|
|
(if hide-em (Bookmark-menu-hide-filenames))
|
|
|
|
(setq Bookmark-menu-toggle-filenames nil)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(forward-line 1)
|
|
|
|
(let ((deaders ()))
|
|
|
|
(while (re-search-forward "^D" (point-max) t)
|
|
|
|
(setq deaders (cons (Bookmark-menu-bookmark) deaders)))
|
|
|
|
(mapcar (lambda (str)
|
|
|
|
(setq bookmark-alist
|
|
|
|
(delq (assoc str bookmark-alist) bookmark-alist)))
|
|
|
|
deaders))
|
|
|
|
(list-bookmarks)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(forward-line 2)
|
|
|
|
(setq Bookmark-menu-toggle-filenames hide-em)
|
|
|
|
(if Bookmark-menu-toggle-filenames
|
|
|
|
(Bookmark-menu-toggle-filenames t))))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-rename ()
|
|
|
|
"Rename bookmark on current line. Prompts for a new name."
|
|
|
|
(interactive)
|
|
|
|
(if (Bookmark-menu-check-position)
|
|
|
|
(let ((bmrk (Bookmark-menu-bookmark))
|
|
|
|
(thispoint (point)))
|
|
|
|
(bookmark-rename bmrk)
|
|
|
|
(list-bookmarks)
|
|
|
|
(goto-char thispoint))))
|
|
|
|
|
|
|
|
(defun Bookmark-menu-locate ()
|
|
|
|
"Display location of this bookmark. Displays in the minibuffer."
|
|
|
|
(interactive)
|
|
|
|
(if (Bookmark-menu-check-position)
|
|
|
|
(let ((bmrk (Bookmark-menu-bookmark)))
|
|
|
|
(message (bookmark-locate bmrk t)))))
|
|
|
|
|
1993-08-13 00:59:51 +00:00
|
|
|
;;;; bookmark menu bar stuff ;;;;
|
|
|
|
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(defvar bookmark-menu-bar-length 70
|
1993-08-14 19:49:27 +00:00
|
|
|
"*Maximum length of a bookmark name displayed on a popup menu.")
|
1993-08-10 20:35:31 +00:00
|
|
|
|
1993-08-13 00:59:51 +00:00
|
|
|
(defun bookmark-make-menu-bar-alist ()
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(bookmark-try-default-file)
|
|
|
|
(bookmark-maybe-sort-alist)
|
1993-08-10 20:35:31 +00:00
|
|
|
(if bookmark-alist
|
|
|
|
(mapcar (lambda (cell)
|
|
|
|
(let ((str (car cell)))
|
|
|
|
(cons
|
1993-08-13 00:59:51 +00:00
|
|
|
(if (> (length str) bookmark-menu-bar-length)
|
|
|
|
(substring str 0 bookmark-menu-bar-length)
|
1993-08-10 20:35:31 +00:00
|
|
|
str)
|
|
|
|
str)))
|
|
|
|
bookmark-alist)
|
|
|
|
(error "No bookmarks currently set.")))
|
|
|
|
|
1993-08-13 00:59:51 +00:00
|
|
|
(defun bookmark-make-menu-bar-with-function (func-sym
|
|
|
|
menu-label
|
|
|
|
menu-str event)
|
1993-08-10 20:35:31 +00:00
|
|
|
;; help function for making menus that need to apply a bookmark
|
|
|
|
;; function to a string.
|
1993-08-13 00:59:51 +00:00
|
|
|
(let* ((menu (bookmark-make-menu-bar-alist))
|
1993-08-10 20:35:31 +00:00
|
|
|
(str (x-popup-menu event
|
|
|
|
(list menu-label
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(cons menu-str menu)))))
|
|
|
|
(if str (apply func-sym (list str)))))
|
1993-08-10 20:35:31 +00:00
|
|
|
|
1994-03-10 07:32:24 +00:00
|
|
|
;;;###autoload
|
1993-08-13 00:59:51 +00:00
|
|
|
(defun bookmark-menu-bar-insert (event)
|
1993-08-14 19:49:27 +00:00
|
|
|
"Insert the text of the file pointed to by bookmark BOOKMARK.
|
|
|
|
You may have a problem using this function if the value of variable
|
|
|
|
`bookmark-alist' is nil. If that happens, you need to load in some
|
|
|
|
bookmarks. See help on function `bookmark-load' for more about
|
|
|
|
this."
|
1993-08-10 20:35:31 +00:00
|
|
|
(interactive "e")
|
1993-08-13 00:59:51 +00:00
|
|
|
(bookmark-make-menu-bar-with-function 'bookmark-insert
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
"Bookmark Insert Menu"
|
|
|
|
"--- Insert Contents ---"
|
|
|
|
event))
|
1993-08-10 20:35:31 +00:00
|
|
|
|
1994-03-10 07:32:24 +00:00
|
|
|
;;;###autoload
|
1993-08-13 00:59:51 +00:00
|
|
|
(defun bookmark-menu-bar-jump (event)
|
1993-08-14 19:49:27 +00:00
|
|
|
"Jump to bookmark BOOKMARK (a point in some file).
|
|
|
|
You may have a problem using this function if the value of variable
|
|
|
|
`bookmark-alist' is nil. If that happens, you need to load in some
|
|
|
|
bookmarks. See help on function `bookmark-load' for more about
|
|
|
|
this."
|
1993-08-10 20:35:31 +00:00
|
|
|
(interactive "e")
|
1993-08-13 00:59:51 +00:00
|
|
|
(bookmark-make-menu-bar-with-function 'bookmark-jump
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
"Bookmark Jump Menu"
|
|
|
|
"--- Jump to Bookmark ---"
|
|
|
|
event))
|
1993-08-10 20:35:31 +00:00
|
|
|
|
1994-03-10 07:32:24 +00:00
|
|
|
;;;###autoload
|
1993-08-13 00:59:51 +00:00
|
|
|
(defun bookmark-menu-bar-locate (event)
|
1994-05-16 07:24:45 +00:00
|
|
|
"Insert the name of the file associated with BOOKMARK.
|
1993-08-14 19:49:27 +00:00
|
|
|
\(This is not the same as the contents of that file\)."
|
1993-08-10 20:35:31 +00:00
|
|
|
(interactive "e")
|
1993-08-13 00:59:51 +00:00
|
|
|
(bookmark-make-menu-bar-with-function 'bookmark-locate
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
"Bookmark Locate Menu"
|
|
|
|
"--- Insert Location ---"
|
|
|
|
event))
|
1993-08-10 20:35:31 +00:00
|
|
|
|
1994-03-10 07:32:24 +00:00
|
|
|
;;;###autoload
|
1993-08-13 00:59:51 +00:00
|
|
|
(defun bookmark-menu-bar-rename (event)
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
"Change the name of OLD-BOOKMARK to NEWNAME.
|
|
|
|
If called from keyboard, prompts for OLD-BOOKMARK and NEWNAME.
|
|
|
|
If called from menubar, OLD-BOOKMARK is selected from a menu, and
|
|
|
|
prompts for NEWNAME.
|
|
|
|
If called from Lisp, prompts for NEWNAME if only OLD-BOOKMARK was
|
|
|
|
passed as an argument. If called with two strings, then no prompting
|
|
|
|
is done. You must pass at least OLD-BOOKMARK when calling from Lisp.
|
1993-08-14 19:49:27 +00:00
|
|
|
|
|
|
|
While you are entering the new name, consecutive C-w's insert
|
|
|
|
consectutive words from the text of the buffer into the new bookmark
|
|
|
|
name, and C-v inserts the name of the file."
|
1993-08-10 20:35:31 +00:00
|
|
|
(interactive "e")
|
1993-08-13 00:59:51 +00:00
|
|
|
(bookmark-make-menu-bar-with-function 'bookmark-rename
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
"Bookmark Rename Menu"
|
|
|
|
"--- Rename Bookmark ---"
|
|
|
|
event))
|
1993-08-10 20:35:31 +00:00
|
|
|
|
1994-03-10 07:32:24 +00:00
|
|
|
;;;###autoload
|
1993-08-13 00:59:51 +00:00
|
|
|
(defun bookmark-menu-bar-delete (event)
|
1993-08-14 19:49:27 +00:00
|
|
|
"Delete the bookmark named NAME from the bookmark list.
|
|
|
|
Removes only the first instance of a bookmark with that name. If
|
|
|
|
there are one or more other bookmarks with the same name, they will
|
|
|
|
not be deleted. Defaults to the \"current\" bookmark \(that is, the
|
|
|
|
one most recently used in this file, if any\)."
|
1993-08-10 20:35:31 +00:00
|
|
|
(interactive "e")
|
1993-08-13 00:59:51 +00:00
|
|
|
(bookmark-make-menu-bar-with-function 'bookmark-delete
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
"Bookmark Delete Menu"
|
|
|
|
"--- Delete Bookmark ---"
|
|
|
|
event))
|
1993-08-10 20:35:31 +00:00
|
|
|
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
;; Thanks to Roland McGrath for fixing menubar.el so that the
|
|
|
|
;; following works, and for explaining what to do to make it work.
|
1993-08-10 20:35:31 +00:00
|
|
|
|
1994-03-10 04:24:29 +00:00
|
|
|
;;;###autoload
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(defvar menu-bar-bookmark-map (make-sparse-keymap "Bookmark functions."))
|
1993-08-10 20:35:31 +00:00
|
|
|
|
1994-03-10 04:24:29 +00:00
|
|
|
;;;###autoload
|
|
|
|
(fset 'menu-bar-bookmark-map (symbol-value 'menu-bar-bookmark-map))
|
1993-08-10 20:35:31 +00:00
|
|
|
|
1994-03-10 04:24:29 +00:00
|
|
|
;;;###autoload
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(define-key menu-bar-bookmark-map [load]
|
|
|
|
'("Load a bookmark file" . bookmark-load))
|
1993-08-10 20:35:31 +00:00
|
|
|
|
1994-03-10 04:24:29 +00:00
|
|
|
;;;###autoload
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(define-key menu-bar-bookmark-map [write]
|
|
|
|
'("Write \(to another file\)" . bookmark-write))
|
|
|
|
|
1994-03-10 04:24:29 +00:00
|
|
|
;;;###autoload
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(define-key menu-bar-bookmark-map [save]
|
|
|
|
'("Save \(in default file\)" . bookmark-save))
|
|
|
|
|
1994-03-10 04:24:29 +00:00
|
|
|
;;;###autoload
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(define-key menu-bar-bookmark-map [edit]
|
|
|
|
'("Edit Bookmark List" . list-bookmarks))
|
|
|
|
|
1994-03-10 04:24:29 +00:00
|
|
|
;;;###autoload
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(define-key menu-bar-bookmark-map [delete]
|
|
|
|
'("Delete bookmark" . bookmark-menu-bar-delete))
|
|
|
|
|
1994-03-10 04:24:29 +00:00
|
|
|
;;;###autoload
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(define-key menu-bar-bookmark-map [rename]
|
|
|
|
'("Rename bookmark" . bookmark-menu-bar-rename))
|
|
|
|
|
1994-03-10 04:24:29 +00:00
|
|
|
;;;###autoload
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(define-key menu-bar-bookmark-map [locate]
|
|
|
|
'("Insert location" . bookmark-menu-bar-locate))
|
1993-08-10 20:35:31 +00:00
|
|
|
|
1994-03-10 04:24:29 +00:00
|
|
|
;;;###autoload
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(define-key menu-bar-bookmark-map [insert]
|
|
|
|
'("Insert contents" . bookmark-menu-bar-insert))
|
|
|
|
|
1994-03-10 04:24:29 +00:00
|
|
|
;;;###autoload
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(define-key menu-bar-bookmark-map [set]
|
|
|
|
'("Set bookmark" . bookmark-set))
|
|
|
|
|
1994-03-10 04:24:29 +00:00
|
|
|
;;;###autoload
|
(bookmark-write): Add numbered backups for bookmark file.
(bookmark-version-control): New variable.
(bookmark-jump): bookmark-jump now gives a
default value if no bookmark is entered manually.
(bookmark-set): Default to bookmark-current-bookmark or
buffer-name the way bookmark-jump does.
(ctl-x-map): Check if C-x r is a prefix before using it as one.
Include string "Bookmarks" in defining
[menu-bar bookmark] in global-map in the menu-bar code.
(menu-bar-bookmark-map): Supply t as 4th arg of autoload.
(bookmark-jump-noselect): New subroutine taken from
bookmark-jump. Support compressed files.
(bookmark-jump): Call bookmark-jump-noselect.
Offer to relocate if necessary, but change default dir to that of
the old bookmark in read-file-name.
(bookmark-set, bookmark-rename, bookmark-delete,
bookmark-write-file, bookmark-load, Bookmark-menu-show-filenames,
Bookmark-menu-hide-filenames, Bookmark-menu-bookmark,
Bookmark-menu-save, Bookmark-menu-load): Fixed the save-excursion
bugs by wrapping things in save-window-excursion as well.
(bookmark-make-menu-bar-alist): Added sorting.
(bookmark-map): Added new keybindings.
(bookmark-try-default-file): Set bookmarks-already-loaded to t after the load.
(list-bookmarks): Added bookmark menu stuff.
(Bookmark-menu-*): New functions.
1993-10-13 05:59:54 +00:00
|
|
|
(define-key menu-bar-bookmark-map [jump]
|
|
|
|
'("Jump to bookmark" . bookmark-menu-bar-jump))
|
|
|
|
|
|
|
|
(fset 'menu-bar-bookmark-map (symbol-value 'menu-bar-bookmark-map))
|
|
|
|
|
|
|
|
;;;; end bookmark menu-bar stuff ;;;;
|
1993-08-10 20:35:31 +00:00
|
|
|
|
|
|
|
(provide 'bookmark)
|
|
|
|
|
1993-08-13 00:59:51 +00:00
|
|
|
;;; bookmark.el ends here
|