1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-25 07:28:20 +00:00
emacs/lisp/bookmark.el

2649 lines
107 KiB
EmacsLisp
Raw Normal View History

;;; bookmark.el --- set bookmarks, maybe annotate them, jump to them later -*- lexical-binding: t -*-
1993-08-10 20:35:31 +00:00
2024-01-02 01:47:10 +00:00
;; Copyright (C) 1993-1997, 2001-2024 Free Software Foundation, Inc.
1993-08-10 20:35:31 +00:00
;; Author: Karl Fogel <kfogel@red-bean.com>
1993-08-10 20:35:31 +00:00
;; Created: July, 1993
;; Keywords: convenience
1993-08-10 20:35:31 +00:00
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
1993-08-10 20:35:31 +00:00
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
1993-08-10 20:35:31 +00:00
;; 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. If not, see <https://www.gnu.org/licenses/>.
1996-01-14 07:34:30 +00:00
;;; Commentary:
;; This package is for setting "bookmarks" in files. A bookmark
;; associates a string with a location in a certain file. Thus, you
;; can navigate your way to that location by providing the string.
2020-12-14 13:52:46 +00:00
;;
2021-09-03 09:13:53 +00:00
;; Type `M-x customize-group RET bookmark RET' for user options.
1993-08-10 20:35:31 +00:00
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;; Code:
1993-08-10 20:35:31 +00:00
1996-01-14 07:34:30 +00:00
(require 'pp)
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(require 'tabulated-list)
(require 'text-property-search)
(require 'fringe) ; for builds --without-x
(eval-when-compile (require 'cl-lib))
1996-01-14 07:34:30 +00:00
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;; Misc comments:
1993-08-10 20:35:31 +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
;;; User Variables
(defgroup bookmark nil
"Setting, annotation and jumping to bookmarks."
:group 'matching)
(defcustom bookmark-use-annotations nil
"If non-nil, setting a bookmark queries for an annotation in a buffer."
:type 'boolean)
(defcustom bookmark-save-flag t
"Controls when Emacs saves bookmarks to a file.
--> nil means never save bookmarks, except when `bookmark-save' is
explicitly called (\\[bookmark-save]).
--> t means save bookmarks when Emacs is killed.
--> Otherwise, it should be a number that is the frequency with which
the bookmark list is saved (i.e.: the number of times which
Emacs's 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.
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
`bookmark-default-file'."
:type '(choice (const nil) integer (other t)))
(define-obsolete-variable-alias 'bookmark-old-default-file
'bookmark-default-file "27.1")
(define-obsolete-variable-alias 'bookmark-file 'bookmark-default-file "27.1")
(defcustom bookmark-default-file
(locate-user-emacs-file "bookmarks" ".emacs.bmk")
"File in which to save bookmarks by default."
;; The current default file is defined via the internal variable
;; `bookmark-bookmarks-timestamp'. This does not affect the value
;; of `bookmark-default-file'.
:type 'file)
(defcustom bookmark-watch-bookmark-file t
"If non-nil reload the default bookmark file if it was changed.
If this file has changed on disk since it was last loaded, query the user
whether to load it again. If the value is `silent' reload without querying.
This file defaults to `bookmark-default-file'. But during an Emacs session,
`bookmark-load' and `bookmark-save' can redefine the current default file."
:version "27.1"
:type '(choice (const :tag "Suggest to reload bookmark file if changed" t)
(const :tag "Silently reload bookmark file if changed" silent)
(const :tag "Ignore changes of bookmark file" nil))
:group 'bookmark)
(defcustom bookmark-version-control 'nospecial
"Whether or not to make numbered backups of the bookmark file.
It can have four values: t, nil, `never', or `nospecial'.
The first three have the same meaning that they do for the
variable `version-control'; the value `nospecial' (the default) means
just use the value of `version-control'."
:type '(choice (const :tag "If existing" nil)
(const :tag "Never" never)
(const :tag "Use value of option `version-control'" nospecial)
(other :tag "Always" t)))
(defcustom bookmark-completion-ignore-case t
"Non-nil means bookmark functions ignore case in completion."
:type 'boolean)
(defcustom bookmark-sort-flag t
"This controls the bookmark display sorting.
nil means they will be displayed in LIFO order (that is, most
recently created ones come first, oldest ones come last).
`last-modified' means that bookmarks will be displayed sorted
from most recently modified to least recently modified.
Other values means that bookmarks will be displayed sorted by
bookmark name."
:type '(choice (const :tag "By name" t)
(const :tag "By modified time" last-modified)
(const :tag "By creation time" nil)))
(defcustom bookmark-menu-confirm-deletion nil
"Non-nil means confirm before deleting bookmarks in a bookmark menu buffer.
Nil means don't prompt for confirmation."
:version "28.1"
:type 'boolean)
(defcustom bookmark-automatically-show-annotations t
"Non-nil means show annotations when jumping to a bookmark."
:type 'boolean)
(defvar bookmark-bmenu-buffer "*Bookmark List*"
"Name of buffer used for Bookmark List.")
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(defvar bookmark-bmenu-use-header-line t
"Non-nil means to use an immovable header line.
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
This is as opposed to inline text at the top of the buffer.")
(make-obsolete-variable 'bookmark-bmenu-use-header-line "no longer used." "28.1")
(defconst bookmark-bmenu-inline-header-height 2
"Number of lines used for the *Bookmark List* header.
\(This is only significant when `bookmark-bmenu-use-header-line'
is nil.)")
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(make-obsolete-variable 'bookmark-bmenu-inline-header-height "no longer used." "28.1")
(defconst bookmark-bmenu-marks-width 2
"Number of columns (chars) used for the *Bookmark List* marks column.
This includes the annotations column.")
(defcustom bookmark-bmenu-file-column 30
"Column at which to display filenames in a buffer listing bookmarks.
You can toggle whether files are shown with \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-toggle-filenames]."
Make some defcustom types more restrictive * lisp/abbrev.el (abbrev-suggest-hint-threshold): * lisp/bookmark.el (bookmark-bmenu-file-column) (bookmark-menu-length): * lisp/buff-menu.el (Buffer-menu-size-width) (Buffer-menu-mode-width): * lisp/calendar/calendar.el (calendar-week-start-day) (calendar-intermonth-spacing, calendar-column-width) (calendar-day-digit-width): * lisp/calc/calc.el (calc-undo-length): * lisp/calendar/timeclock.el (timeclock-workday): * lisp/comint.el (comint-buffer-maximum-size) (comint-input-ring-size): * lisp/doc-view.el (doc-view-resolution, doc-view-image-width): * lisp/emacs-lisp/bytecomp.el (byte-compile-docstring-max-column): * lisp/emacs-lisp/comp.el (native-comp-debug) (native-comp-verbose, native-comp-async-jobs-number): * lisp/emacs-lisp/package.el (package-name-column-width) (package-version-column-width, package-status-column-width) (package-archive-column-width): * lisp/eshell/esh-mode.el (eshell-buffer-maximum-lines): * lisp/frame.el (blink-cursor-blinks): * lisp/info.el (Info-breadcrumbs-depth): * lisp/jit-lock.el (jit-lock-chunk-size): * lisp/kmacro.el (kmacro-ring-max): * lisp/menu-bar.el (yank-menu-length, yank-menu-max-items): * lisp/midnight.el (clean-buffer-list-delay-general) (clean-buffer-list-delay-special): * lisp/net/dictionary.el (dictionary-port) (dictionary-proxy-port): * lisp/net/ldap.el (ldap-default-port): * lisp/net/pop3.el (pop3-port, pop3-stream-length): * lisp/net/rcirc.el (rcirc-default-port): * lisp/net/sieve-manage.el (sieve-manage-default-port): * lisp/play/spook.el (spook-phrase-default-count): * lisp/play/tetris.el (tetris-buffer-width) (tetris-buffer-height, tetris-width, tetris-height) (tetris-top-left-x, tetris-top-left-y): * lisp/profiler.el (profiler-sampling-interval): * lisp/progmodes/sql.el (sql-port): * lisp/recentf.el (recentf-max-menu-items): * lisp/strokes.el (strokes-grid-resolution): * lisp/tab-bar.el (tab-bar-tab-name-truncated-max): * lisp/term/xterm.el (xterm-max-cut-length): * lisp/time.el (display-time-interval, world-clock-timer-second): * lisp/url/url-cache.el (url-cache-expire-time): * lisp/url/url-cookie.el (url-cookie-save-interval): * lisp/url/url-history.el (url-history-save-interval): * lisp/url/url-queue.el (url-queue-parallel-processes) (url-queue-timeout): * lisp/url/url-vars.el (url-max-password-attempts) (url-max-redirections): * lisp/vc/emerge.el (emerge-min-visible-lines): * lisp/vc/vc.el (vc-log-show-limit): * lisp/window.el (window-min-height, window-min-width): * lisp/winner.el (winner-ring-size): Use :type natnum. * lisp/savehist.el (savehist-file-modes): Fix setting to nil value and use :type natnum.
2022-07-05 14:26:45 +00:00
:type 'natnum)
(defcustom bookmark-bmenu-toggle-filenames t
"Non-nil means show filenames when listing bookmarks.
Update docstrings and comments to use "init file" terminology. * bookmark.el (bookmark-bmenu-toggle-filenames): Doc fixes. * comint.el (comint-prompt-read-only): * custom.el (defcustom): * hi-lock.el (hi-lock-mode): * ibuffer.el (ibuffer-formats): * ielm.el (ielm-prompt-read-only): * novice.el (disable-command): * saveplace.el (toggle-save-place): * speedbar.el (speedbar-supported-extension-expressions): * startup.el (auto-save-list-file-prefix, init-file-user) (after-init-hook, inhibit-startup-echo-area-message): * strokes.el (strokes-help): * time-stamp.el (time-stamp): * calendar/calendar.el (calendar, diary-file): * calendar/diary-lib.el (diary-mail-entries, diary) (diary-list-entries-hook): * calendar/holidays.el (holidays, calendar-holidays): * calendar/lunar.el (lunar-phases): * calendar/solar.el (sunrise-sunset): * emulation/edt.el (edt-load-keys): * emulation/viper.el (viper-mode): * eshell/em-alias.el (eshell-command-aliases-list): * eshell/esh-util.el (eshell-convert-numeric-arguments): * international/ogonek.el (ogonek-information): * net/tramp-cmds.el (tramp-bug): * net/quickurl.el (quickurl-reread-hook-postfix): * play/decipher.el (decipher-font-lock-keywords): * progmodes/cc-styles.el (c-set-style): * progmodes/idlw-shell.el (idlwave-shell-prompt-pattern): * progmodes/inf-lisp.el (inferior-lisp-prompt): * progmodes/octave-mod.el (octave-mode): * progmodes/sql.el (sql-mode, sql-interactive-mode, sql-password): * progmodes/verilog-mode.el (verilog-read-defines): * textmodes/two-column.el (2C-mode): Likewise.
2012-09-17 05:41:04 +00:00
A non-nil value may result in truncated bookmark names."
:type 'boolean)
(defface bookmark-menu-bookmark
'((t (:weight bold)))
"Face used to highlight bookmark names in bookmark menu buffers.")
(defcustom bookmark-menu-length 70
"Maximum length of a bookmark name displayed on a popup menu."
Make some defcustom types more restrictive * lisp/abbrev.el (abbrev-suggest-hint-threshold): * lisp/bookmark.el (bookmark-bmenu-file-column) (bookmark-menu-length): * lisp/buff-menu.el (Buffer-menu-size-width) (Buffer-menu-mode-width): * lisp/calendar/calendar.el (calendar-week-start-day) (calendar-intermonth-spacing, calendar-column-width) (calendar-day-digit-width): * lisp/calc/calc.el (calc-undo-length): * lisp/calendar/timeclock.el (timeclock-workday): * lisp/comint.el (comint-buffer-maximum-size) (comint-input-ring-size): * lisp/doc-view.el (doc-view-resolution, doc-view-image-width): * lisp/emacs-lisp/bytecomp.el (byte-compile-docstring-max-column): * lisp/emacs-lisp/comp.el (native-comp-debug) (native-comp-verbose, native-comp-async-jobs-number): * lisp/emacs-lisp/package.el (package-name-column-width) (package-version-column-width, package-status-column-width) (package-archive-column-width): * lisp/eshell/esh-mode.el (eshell-buffer-maximum-lines): * lisp/frame.el (blink-cursor-blinks): * lisp/info.el (Info-breadcrumbs-depth): * lisp/jit-lock.el (jit-lock-chunk-size): * lisp/kmacro.el (kmacro-ring-max): * lisp/menu-bar.el (yank-menu-length, yank-menu-max-items): * lisp/midnight.el (clean-buffer-list-delay-general) (clean-buffer-list-delay-special): * lisp/net/dictionary.el (dictionary-port) (dictionary-proxy-port): * lisp/net/ldap.el (ldap-default-port): * lisp/net/pop3.el (pop3-port, pop3-stream-length): * lisp/net/rcirc.el (rcirc-default-port): * lisp/net/sieve-manage.el (sieve-manage-default-port): * lisp/play/spook.el (spook-phrase-default-count): * lisp/play/tetris.el (tetris-buffer-width) (tetris-buffer-height, tetris-width, tetris-height) (tetris-top-left-x, tetris-top-left-y): * lisp/profiler.el (profiler-sampling-interval): * lisp/progmodes/sql.el (sql-port): * lisp/recentf.el (recentf-max-menu-items): * lisp/strokes.el (strokes-grid-resolution): * lisp/tab-bar.el (tab-bar-tab-name-truncated-max): * lisp/term/xterm.el (xterm-max-cut-length): * lisp/time.el (display-time-interval, world-clock-timer-second): * lisp/url/url-cache.el (url-cache-expire-time): * lisp/url/url-cookie.el (url-cookie-save-interval): * lisp/url/url-history.el (url-history-save-interval): * lisp/url/url-queue.el (url-queue-parallel-processes) (url-queue-timeout): * lisp/url/url-vars.el (url-max-password-attempts) (url-max-redirections): * lisp/vc/emerge.el (emerge-min-visible-lines): * lisp/vc/vc.el (vc-log-show-limit): * lisp/window.el (window-min-height, window-min-width): * lisp/winner.el (winner-ring-size): Use :type natnum. * lisp/savehist.el (savehist-file-modes): Fix setting to nil value and use :type natnum.
2022-07-05 14:26:45 +00:00
:type 'natnum)
;; FIXME: Is it really worth a customization option?
(defcustom bookmark-search-delay 0.2
"Time before `bookmark-bmenu-search' updates the display."
Fix a bunch of custom types (thank you cus-test.el) * lisp/bookmark.el (bookmark-search-delay): * lisp/cus-start.el (vertical-centering-font-regexp): * lisp/ps-mule.el (ps-mule-font-info-database-default): * lisp/ps-print.el (ps-default-fg, ps-default-bg): * lisp/type-break.el (type-break-good-break-interval): * lisp/whitespace.el (whitespace-indentation-regexp) (whitespace-space-after-tab-regexp): * lisp/emacs-lisp/testcover.el (testcover-1value-functions) (testcover-noreturn-functions, testcover-progn-functions) (testcover-prog1-functions): * lisp/emulation/viper-init.el (viper-emacs-state-cursor-color): * lisp/erc/erc-desktop-notifications.el (erc-notifications-icon): * lisp/eshell/em-glob.el (eshell-glob-translate-alist): * lisp/gnus/gnus-art.el (gnus-article-date-headers, gnus-blocked-images): * lisp/gnus/gnus-async.el (gnus-async-post-fetch-function): * lisp/gnus/gnus-gravatar.el (gnus-gravatar-size, gnus-gravatar-properties): * lisp/gnus/gnus-html.el (gnus-html-image-cache-ttl): * lisp/gnus/gnus-notifications.el (gnus-notifications-timeout): * lisp/gnus/gnus-picon.el (gnus-picon-properties): * lisp/gnus/gnus-util.el (gnus-completion-styles): * lisp/gnus/gnus.el (gnus-other-frame-resume-function): * lisp/gnus/message.el (message-user-organization-file) (message-cite-reply-position): * lisp/gnus/nnir.el (nnir-summary-line-format) (nnir-retrieve-headers-override-function): * lisp/gnus/shr-color.el (shr-color-visible-luminance-min): * lisp/gnus/shr.el (shr-blocked-images): * lisp/gnus/spam-report.el (spam-report-resend-to): * lisp/gnus/spam.el (spam-summary-exit-behavior): * lisp/mh-e/mh-e.el (mh-sortm-args, mh-default-folder-for-message-function): * lisp/play/tetris.el (tetris-tty-colors): * lisp/progmodes/cpp.el (cpp-face-default-list): * lisp/progmodes/flymake.el (flymake-allowed-file-name-masks): * lisp/progmodes/idlw-help.el (idlwave-help-browser-generic-program) (idlwave-help-browser-generic-args): * lisp/progmodes/make-mode.el (makefile-special-targets-list): * lisp/progmodes/python.el (python-shell-virtualenv-path): * lisp/progmodes/verilog-mode.el (verilog-active-low-regexp) (verilog-auto-input-ignore-regexp, verilog-auto-inout-ignore-regexp) (verilog-auto-output-ignore-regexp, verilog-auto-tieoff-ignore-regexp) (verilog-auto-unused-ignore-regexp, verilog-typedef-regexp): * lisp/textmodes/reftex-vars.el (reftex-format-label-function): * lisp/textmodes/remember.el (remember-diary-file): Fix custom types. * lisp/cedet/semantic/db-find.el (semanticdb-find-throttle-custom-list): Fix value. * lisp/gnus/gnus-salt.el (gnus-selected-tree-face): Fix default.
2013-05-09 01:40:20 +00:00
:type 'number)
(define-fringe-bitmap 'bookmark-mark
[#b01111110
#b01111110
#b01111110
#b01111110
#b01111110
#b01111110
#b01100110
#b01000010])
(define-obsolete-variable-alias 'bookmark-set-fringe-mark
'bookmark-fringe-mark "29.1")
(defcustom bookmark-fringe-mark 'bookmark-mark
"The fringe bitmap to mark bookmarked lines with.
If nil, don't display a mark on the fringe."
:type '(choice (const nil) fringe-bitmap)
:set #'fringe-custom-set-bitmap
:version "29.1")
(defface bookmark-face
'((((class grayscale)
(background light))
:foreground "DimGray")
(((class grayscale)
(background dark))
:foreground "LightGray")
(((class color)
(background light))
:foreground "DarkOrange1" :distant-foreground "DarkOrange3")
(((class color)
(background dark))
:foreground "DarkOrange1" :distant-foreground "Orange1"))
"Face used to highlight current line."
:version "28.1")
;;; No user-serviceable parts beyond this point.
1993-08-10 20:35:31 +00:00
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;; Keymap stuff:
1993-08-10 20:35:31 +00:00
;; Set up these bindings dumping time *only*;
;; if the user alters them, don't override the user when loading bookmark.el.
;;;###autoload (keymap-set ctl-x-r-map "b" #'bookmark-jump)
;;;###autoload (keymap-set ctl-x-r-map "m" #'bookmark-set)
;;;###autoload (keymap-set ctl-x-r-map "M" #'bookmark-set-no-overwrite)
;;;###autoload (keymap-set ctl-x-r-map "l" #'bookmark-bmenu-list)
;;;###autoload
(defvar-keymap bookmark-map
:doc "Keymap containing bindings to bookmark functions.
1993-08-14 19:49:27 +00:00
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 variable `bookmark-map'. All interactive bookmark
functions have a binding in this keymap."
"x" #'bookmark-set
"m" #'bookmark-set ;"m"ark
"M" #'bookmark-set-no-overwrite ;"M"aybe mark
"j" #'bookmark-jump
"g" #'bookmark-jump ;"g"o
"o" #'bookmark-jump-other-window
"5" #'bookmark-jump-other-frame
"i" #'bookmark-insert
"e" #'edit-bookmarks
"f" #'bookmark-insert-location ;"f"ind
"r" #'bookmark-rename
"d" #'bookmark-delete
"D" #'bookmark-delete-all
"l" #'bookmark-load
"w" #'bookmark-write
"s" #'bookmark-save)
1993-08-10 20:35:31 +00:00
;;;###autoload (fset 'bookmark-map bookmark-map)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;; Core variables and data structures:
(defvar bookmark-alist ()
"Association list of bookmark names and their parameters.
Bookmark functions update the value automatically.
You probably do NOT want to change the value yourself.
The value is an alist whose elements are of the form
(BOOKMARK-NAME . PARAM-ALIST)
or the deprecated form (BOOKMARK-NAME PARAM-ALIST). The alist is
ordered from most recently created bookmark at the front to least
recently created bookmark at the end.
BOOKMARK-NAME is the name you gave to the bookmark when creating it.
PARAM-ALIST is an alist of bookmark information. The order of the
entries in PARAM-ALIST is not important. The default entries are
described below. An entry with a key but null value means the entry
is not used.
(filename . FILENAME)
(buf . BUFFER-OR-NAME)
(position . POS)
(front-context-string . STR-AFTER-POS)
(rear-context-string . STR-BEFORE-POS)
(handler . HANDLER)
(annotation . ANNOTATION)
FILENAME names the bookmarked file.
BUFFER-OR-NAME is a buffer or the name of a buffer that is used
if FILENAME is not defined or it refers to a non-existent file.
POS is the bookmarked buffer position.
STR-AFTER-POS is buffer text that immediately follows POS.
STR-BEFORE-POS is buffer text that immediately precedes POS.
ANNOTATION is a string that describes the bookmark.
See options `bookmark-use-annotations' and
`bookmark-automatically-show-annotations'.
HANDLER is a function that provides the `bookmark-jump' behavior for a
specific kind of bookmark instead of the default `bookmark-default-handler'.
This is the case for Info bookmarks, for instance. HANDLER must accept
a bookmark as its single argument.
A function `bookmark-make-record-function' may define additional entries
in PARAM-LIST that can be used by HANDLER.")
(define-obsolete-variable-alias 'bookmarks-already-loaded
'bookmark-bookmarks-timestamp "27.1")
(defvar bookmark-bookmarks-timestamp nil
"Timestamp of current default bookmark file.
The value is actually (FILE . MODTIME), where FILE is a bookmark file that
defaults to `bookmark-default-file' and MODTIME is its modification time.")
(defvar bookmark-file-coding-system nil
"The coding-system of the last loaded or saved bookmark file.")
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Prefer defvar-local in remaining libraries * lisp/align.el (align-mode-rules-list) (align-mode-exclude-rules-list): * lisp/bookmark.el (bookmark-current-bookmark) (bookmark-annotation-name) (bookmark--annotation-from-bookmark-list): * lisp/calc/calc-embed.el (calc-embedded-all-active) (calc-embedded-some-active): * lisp/comint.el (comint-password-function): * lisp/completion.el (completion-syntax-table): * lisp/dframe.el (dframe-track-mouse-function) (dframe-help-echo-function, dframe-mouse-click-function) (dframe-mouse-position-function, dframe-timer) (dframe-attached-frame, dframe-controlled): * lisp/ehelp.el (electric-help-orig-major-mode): * lisp/eshell/esh-util.el (eshell-path-env): * lisp/expand.el (expand-pos, expand-index, expand-point): * lisp/face-remap.el (text-scale-mode-remapping) (text-scale-mode-lighter, text-scale-mode-amount) (text-scale-remap-header-line, buffer-face-mode-remapping): * lisp/ffap.el (ffap-menu-alist): * lisp/files-x.el (connection-local-variables-alist): * lisp/foldout.el (foldout-fold-list, foldout-mode-line-string): * lisp/follow.el (follow-start-end-invalid): * lisp/forms.el (forms--mode-setup): * lisp/gnus/message.el (message-cross-post-old-target) (message-options): * lisp/help-mode.el (help-xref-stack, help-xref-forward-stack) (help-xref-stack-item, help-xref-stack-forward-item): * lisp/hexl.el (hexl-mode--old-var-vals, hexl-ascii-overlay): * lisp/hilit-chg.el (hilit-chg-string): * lisp/ido.el (ido-eoinput): * lisp/imenu.el (imenu-generic-expression) (imenu-create-index-function, imenu-default-goto-function) (imenu-prev-index-position-function) (imenu-extract-index-name-function, imenu-name-lookup-function) (imenu-syntax-alist, imenu-case-fold-search): * lisp/jka-compr.el (jka-compr-really-do-compress): * lisp/language/ethio-util.el (ethio-prefer-ascii-space): * lisp/leim/quail/hangul.el (hangul-input-method-help-text): * lisp/leim/quail/japanese.el (quail-japanese-package-saved): * lisp/linum.el (linum-overlays, linum-available): * lisp/man.el (Man-original-frame, Man-arguments, Man--sections) (Man--refpages, Man-page-list, Man-current-page) (Man-page-mode-string): * lisp/pcomplete.el (pcomplete-current-completions) (pcomplete-last-completion-length) (pcomplete-last-completion-stub, pcomplete-last-completion-raw) (pcomplete-last-window-config, pcomplete-window-restore-timer): * lisp/reveal.el (reveal-open-spots, reveal-last-tick): * lisp/ruler-mode.el (ruler-mode): * lisp/scroll-lock.el (scroll-lock-preserve-screen-pos-save): * lisp/server.el (server-buffer-clients, server-existing-buffer): * lisp/tab-line.el (tab-line-exclude): * lisp/tar-mode.el (tar-data-buffer, tar-data-swapped): * lisp/thumbs.el (thumbs-current-tmp-filename) (thumbs-current-image-filename, thumbs-extra-images) (thumbs-image-num, thumbs-buffer, thumbs-marked-list): * lisp/tutorial.el (tutorial--point-before-chkeys) (tutorial--point-after-chkeys, tutorial--lang): * lisp/url/url-vars.el (url-current-object) (url-current-mime-headers, url-current-lastloc): * lisp/view.el (view-mode, view-old-buffer-read-only) (view-old-Helper-return-blurb, view-page-size) (view-half-page-size, view-last-regexp, view-return-to-alist) (view-exit-action, view-overlay): * lisp/wid-edit.el (widget-global-map, widget-field-new) (widget-field-list, widget-field-last, widget-field-was): * lisp/woman.el (woman-imenu-done): Prefer defvar-local.
2021-02-02 08:55:40 +00:00
(defvar-local 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
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
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
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defvar bookmark-search-size 16
1993-08-14 19:49:27 +00:00
"Length of the context strings recorded on either side of a bookmark.")
1993-08-10 20:35:31 +00:00
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defvar bookmark-current-buffer nil
"The buffer in which a bookmark is currently being set or renamed.
Functions that insert strings into the minibuffer use this to know
the source buffer for that information; see `bookmark-yank-word'
for example.")
(defvar bookmark-yank-point 0
"The next point from which to pull source text for `bookmark-yank-word'.
This point is in `bookmark-current-buffer'.")
1993-08-10 20:35:31 +00:00
(defvar bookmark-quit-flag nil
"Non-nil means `bookmark-bmenu-search' quits immediately.")
(make-obsolete-variable 'bookmark-quit-flag "no longer used" "27.1")
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;; Helper functions and macros.
(defmacro with-buffer-modified-unmodified (&rest body)
"Run BODY while preserving the buffer's `buffer-modified-p' state."
(let ((was-modified (make-symbol "was-modified")))
`(let ((,was-modified (buffer-modified-p)))
(unwind-protect
(progn ,@body)
(set-buffer-modified-p ,was-modified)))))
;; Only functions below, in this page and the next one (file formats),
;; need to know anything about the format of bookmark-alist entries.
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;; Everyone else should go through them.
(defun bookmark-name-from-full-record (bookmark-record)
"Return the name of BOOKMARK-RECORD.
BOOKMARK-RECORD is, e.g., one element from `bookmark-alist'."
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(car bookmark-record))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-type-from-full-record (bookmark-record)
2022-11-17 02:34:28 +00:00
"Return the type of BOOKMARK-RECORD.
BOOKMARK-RECORD is, e.g., one element from `bookmark-alist'. Its
type is read from the symbol property named
`bookmark-handler-type' read on the record handler function."
(let ((handler (bookmark-get-handler bookmark-record)))
(when (autoloadp (symbol-function handler))
(autoload-do-load (symbol-function handler)))
(if (symbolp handler)
(get handler 'bookmark-handler-type)
"")))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-all-names ()
"Return a list of all current bookmark names."
(bookmark-maybe-load-default-file)
(mapcar 'bookmark-name-from-full-record bookmark-alist))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-get-bookmark (bookmark-name-or-record &optional noerror)
"Return the bookmark record corresponding to BOOKMARK-NAME-OR-RECORD.
If BOOKMARK-NAME-OR-RECORD is a string, look for the corresponding
bookmark record in `bookmark-alist'; return it if found, otherwise
error. If optional argument NOERROR is non-nil, return nil
instead of signaling an error. Else if BOOKMARK-NAME-OR-RECORD
is already a bookmark record, just return it."
(cond
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
((consp bookmark-name-or-record) bookmark-name-or-record)
((stringp bookmark-name-or-record)
(or (assoc-string bookmark-name-or-record bookmark-alist
bookmark-completion-ignore-case)
(unless noerror (error "Invalid bookmark %s"
bookmark-name-or-record))))))
(defun bookmark-get-bookmark-record (bookmark-name-or-record)
"Return the record portion of BOOKMARK-NAME-OR-RECORD in `bookmark-alist'.
In other words, return all information but the name."
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(let ((alist (cdr (bookmark-get-bookmark bookmark-name-or-record))))
;; The bookmark objects can either look like (NAME ALIST) or
;; (NAME . ALIST), so we have to distinguish the two here.
(if (and (null (cdr alist)) (consp (caar alist)))
(car alist) alist)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-set-name (bookmark-name-or-record newname)
"Set BOOKMARK-NAME-OR-RECORD's name to NEWNAME."
(setcar (bookmark-get-bookmark bookmark-name-or-record) newname))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-prop-get (bookmark-name-or-record prop)
"Return the property PROP of BOOKMARK-NAME-OR-RECORD, or nil if none."
(cdr (assq prop (bookmark-get-bookmark-record bookmark-name-or-record))))
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-prop-set (bookmark-name-or-record prop val)
"Set the property PROP of BOOKMARK-NAME-OR-RECORD to VAL."
(let ((cell (assq
prop (bookmark-get-bookmark-record bookmark-name-or-record))))
(if cell
(setcdr cell val)
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(nconc (bookmark-get-bookmark-record bookmark-name-or-record)
(list (cons prop val))))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-get-annotation (bookmark-name-or-record)
"Return the annotation of BOOKMARK-NAME-OR-RECORD, or nil if none."
(bookmark-prop-get bookmark-name-or-record 'annotation))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-set-annotation (bookmark-name-or-record ann)
"Set the annotation of BOOKMARK-NAME-OR-RECORD to ANN."
(bookmark-prop-set bookmark-name-or-record 'annotation ann))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-get-filename (bookmark-name-or-record)
"Return the full filename of BOOKMARK-NAME-OR-RECORD, or nil if none."
(bookmark-prop-get bookmark-name-or-record 'filename))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-set-filename (bookmark-name-or-record filename)
"Set the full filename of BOOKMARK-NAME-OR-RECORD to FILENAME."
(bookmark-prop-set bookmark-name-or-record 'filename filename))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-get-position (bookmark-name-or-record)
"Return the position (i.e.: point) of BOOKMARK-NAME-OR-RECORD, or nil if none."
(bookmark-prop-get bookmark-name-or-record 'position))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-set-position (bookmark-name-or-record position)
"Set the position (i.e.: point) of BOOKMARK-NAME-OR-RECORD to POSITION."
(bookmark-prop-set bookmark-name-or-record 'position position))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-get-front-context-string (bookmark-name-or-record)
"Return the front-context-string of BOOKMARK-NAME-OR-RECORD, or nil if none."
(bookmark-prop-get bookmark-name-or-record 'front-context-string))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-set-front-context-string (bookmark-name-or-record string)
"Set the front-context-string of BOOKMARK-NAME-OR-RECORD to STRING."
(bookmark-prop-set bookmark-name-or-record 'front-context-string string))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-get-rear-context-string (bookmark-name-or-record)
"Return the rear-context-string of BOOKMARK-NAME-OR-RECORD, or nil if none."
(bookmark-prop-get bookmark-name-or-record 'rear-context-string))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-set-rear-context-string (bookmark-name-or-record string)
"Set the rear-context-string of BOOKMARK-NAME-OR-RECORD to STRING."
(bookmark-prop-set bookmark-name-or-record 'rear-context-string string))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-get-handler (bookmark-name-or-record)
"Return the handler function for BOOKMARK-NAME-OR-RECORD, or nil if none."
(bookmark-prop-get bookmark-name-or-record 'handler))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-get-last-modified (bookmark-name-or-record)
"Return the last-modified for BOOKMARK-NAME-OR-RECORD, or nil if none."
(bookmark-prop-get bookmark-name-or-record 'last-modified))
(defun bookmark-update-last-modified (bookmark-name-or-record)
"Update the last-modified date of BOOKMARK-NAME-OR-RECORD to the current time."
(bookmark-prop-set bookmark-name-or-record 'last-modified (current-time)))
(defvar bookmark-history nil
"The history list for bookmark functions.")
(defun bookmark--set-fringe-mark ()
"Apply a colorized overlay to the bookmarked location.
See user option `bookmark-fringe-mark'."
(let ((bm (make-overlay (pos-bol) (1+ (pos-bol)))))
(overlay-put bm 'category 'bookmark)
(overlay-put bm 'evaporate t)
(overlay-put bm 'before-string
(propertize
"x" 'display
`(left-fringe bookmark-fringe-mark bookmark-face)))))
(defun bookmark--remove-fringe-mark (bm)
"Remove a bookmark's colorized overlay.
BM is a bookmark as returned from function `bookmark-get-bookmark'.
See user option `bookmark-fringe-mark'."
(let ((filename (cdr (assq 'filename bm)))
(pos (cdr (assq 'position bm)))
;; Don't expand file names for non-existing remote connections.
(non-essential t)
overlays found temp)
(when (and pos filename)
(dolist (buf (buffer-list))
(with-current-buffer buf
(let ((bkmk-fname (ignore-errors (bookmark-buffer-file-name))))
(when bkmk-fname
;; Normalize both filenames before comparing, because the
;; filename we receive from the bookmark wasn't
;; necessarily generated by `bookmark-buffer-file-name'.
;; For example, bookmarks set in Info nodes get a filename
;; based on `Info-current-file', and under certain
;; circumstances that can be an unexpanded path (e.g.,
;; when the Info page was under your home directory).
(let ((this-fname-normalized (expand-file-name filename))
(bkmk-fname-normalized (expand-file-name bkmk-fname)))
(when (equal this-fname-normalized bkmk-fname-normalized)
(setq overlays
(save-excursion
(save-restriction
;; Suppose bookmark "foo" was earlier set at
;; location X in a file, but now the file is
;; narrowed such that X is outside the
;; restriction. Then the `goto-char' below
;; would go to the wrong place and thus the
;; wrong overlays would be fetched. This is
;; why we temporarily `widen' before
;; fetching.
;;
;; (This circumstance can easily arise when
;; a bookmark was set on Info node X but now
;; the "*info*" buffer is showing some other
;; node Y, with X and Y physically located
;; in the same file, as is often the case
;; with Info nodes. See bug #70019, for
;; example.)
(widen)
(goto-char pos)
(overlays-in (pos-bol) (1+ (pos-bol))))))
(while (and (not found) (setq temp (pop overlays)))
(when (eq 'bookmark (overlay-get temp 'category))
(delete-overlay (setq found temp)))))))))))))
(defun bookmark-maybe-sort-alist ()
"Return `bookmark-alist' for display.
If `bookmark-sort-flag' is T, then return a sorted by name copy of the alist.
If `bookmark-sort-flag' is LAST-MODIFIED, then return a sorted by last modified
copy of the alist. Otherwise, just return `bookmark-alist', which by default
is ordered from most recently created to least recently created bookmark."
(let ((copy (copy-alist bookmark-alist)))
(cond ((eq bookmark-sort-flag t)
(sort copy (lambda (x y) (string-lessp (car x) (car y)))))
((eq bookmark-sort-flag 'last-modified)
(sort copy (lambda (x y)
(let ((tx (bookmark-get-last-modified x))
(ty (bookmark-get-last-modified y)))
(cond ((null tx) nil)
((null ty) t)
(t (time-less-p ty tx)))))))
(t copy))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-completing-read (prompt &optional default)
"Prompting with PROMPT, read a bookmark name in completion.
PROMPT will get a \": \" stuck on the end no matter what, so you
probably don't want to include one yourself.
Optional arg DEFAULT is a string to return if the user input is empty.
If DEFAULT is nil then return empty string for empty input."
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(bookmark-maybe-load-default-file) ; paranoia
(if (listp last-nonmenu-event)
(bookmark-menu-popup-paned-menu t prompt
(mapcar 'bookmark-name-from-full-record
(bookmark-maybe-sort-alist)))
(let* ((completion-ignore-case bookmark-completion-ignore-case)
Use format-prompt for many more prompts * lisp/bookmark.el (bookmark-completing-read): * lisp/calc/calc-prog.el (calc-user-define-formula): * lisp/calc/calc-store.el (calc-permanent-variable): * lisp/calc/calc-units.el (calc-convert-units) (calc-convert-exact-units, calc-convert-temperature): * lisp/cedet/semantic/complete.el (semantic-complete-read-tag-engine): * lisp/cus-edit.el (customize-read-group): * lisp/dired-aux.el (dired-do-chxxx): * lisp/dired-x.el (dired-mark-unmarked-files): * lisp/emacs-lisp/debug.el (cancel-debug-on-entry) (cancel-debug-on-variable-change): * lisp/emacs-lisp/edebug.el (edebug-cancel-on-entry) (edebug-remove-instrumentation): * lisp/epa.el (epa-read-file-name, epa-export-keys): * lisp/faces.el (read-face-name): * lisp/format.el (format-decode-buffer, format-decode-region): * lisp/gnus/gnus-art.el (gnus-read-save-file-name): * lisp/gnus/gnus-util.el (gnus-completing-read): * lisp/gnus/message.el (message-check-news-header-syntax): * lisp/info.el (Info-follow-reference): * lisp/international/mule-diag.el (describe-font) (describe-fontset): * lisp/international/quail.el (quail-show-keyboard-layout): * lisp/language/cyril-util.el (standard-display-cyrillic-translit): * lisp/mail/rmailkwd.el (rmail-read-label): * lisp/mail/rmailmm.el (rmail-mime-save): * lisp/mail/rmailout.el (rmail-output-read-file-name): * lisp/man.el (Man-goto-section, Man-follow-manual-reference): * lisp/menu-bar.el (emacs-index--prompt): * lisp/net/ange-ftp.el (ange-ftp-get-passwd): * lisp/proced.el (proced-send-signal): * lisp/progmodes/cpp.el (cpp-choose-face): * lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation): * lisp/progmodes/etags.el (visit-tags-table) (visit-tags-table-buffer): * lisp/progmodes/grep.el (grep-read-files): * lisp/progmodes/hideif.el (hide-ifdef-define): * lisp/progmodes/pascal.el (pascal-goto-defun): * lisp/progmodes/prolog.el (prolog-read-predicate): * lisp/progmodes/sql.el (sql-get-login-ext): * lisp/ses.el (ses-define-local-printer): * lisp/textmodes/artist.el (artist-figlet-choose-font): * lisp/textmodes/tex-mode.el (tex-compile): * lisp/vc/diff.el (diff): * lisp/vc/ediff-ptch.el (ediff-prompt-for-patch-file): * lisp/vc/ediff-util.el (ediff-read-file-name): * lisp/vc/pcvs.el (cvs-mode-mark-on-state): * lisp/vc/vc.el (vc-diff-build-argument-list-internal) (vc-revision-other-window, vc-retrieve-tag): * lisp/wid-edit.el: Prefer format-prompt unconditionally. * lisp/org/org-capture.el (org-capture-fill-template): * lisp/org/org-refile.el (org-refile-get-location): * lisp/progmodes/python.el (python-eldoc-at-point): * lisp/progmodes/verilog-mode.el (verilog-surelint-off) (verilog-goto-defun): * lisp/progmodes/xref.el (xref--read-identifier): Prefer format-prompt when it is fboundp.
2021-10-05 01:34:08 +00:00
(default (unless (equal "" default) default)))
(completing-read (format-prompt prompt default)
(lambda (string pred action)
(if (eq action 'metadata)
'(metadata (category . bookmark))
(complete-with-action
action bookmark-alist string pred)))
nil 0 nil 'bookmark-history default))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defmacro bookmark-maybe-historicize-string (string)
"Put STRING into the bookmark prompt history, if caller non-interactive.
We need this because sometimes bookmark functions are invoked
from other commands that pass in the bookmark name, so
`completing-read' never gets a chance to set `bookmark-history'."
2001-01-12 22:49:40 +00:00
`(or
(called-interactively-p 'interactive)
2001-01-12 22:49:40 +00:00
(setq bookmark-history (cons ,string bookmark-history))))
(defvar bookmark-make-record-function 'bookmark-make-record-default
"A function that should be called to create a bookmark record.
Modes may set this variable buffer-locally to enable bookmarking of
locations that should be treated specially, such as Info nodes,
news posts, images, pdf documents, etc.
The function will be called with no arguments.
It should signal a user error if it is unable to construct a record for
the current location.
The returned record should be a cons cell of the form (NAME . ALIST)
where ALIST is as described in `bookmark-alist' and may typically contain
a special cons (handler . HANDLER-FUNC) which specifies the handler function
that should be used instead of `bookmark-default-handler' to open this
bookmark. See the documentation for `bookmark-alist' for more.
NAME is a suggested name for the constructed bookmark. It can be nil
in which case a default heuristic will be used. The function can also
equivalently just return ALIST without NAME.")
(defcustom bookmark-inhibit-context-functions nil
"List of functions to call before making a bookmark record.
The functions take `buffer-file-name' as argument. If any of
these functions returns non-nil, the bookmark does not record
context strings from the current buffer."
:type 'hook
:version "29.1")
(defun bookmark-make-record ()
"Return a new bookmark record (NAME . ALIST) for the current location."
(let* ((bookmark-search-size
;; If we're in a buffer that's visiting an encrypted file,
;; don't include any context in the bookmark file, because
;; that would leak (possibly secret) data.
(if (and buffer-file-name
(run-hook-with-args-until-success
'bookmark-inhibit-context-functions buffer-file-name))
0
bookmark-search-size))
(record (funcall bookmark-make-record-function)))
;; Set up default name if the function does not provide one.
(unless (stringp (car record))
(if (car record) (push nil record))
(setcar record (or bookmark-current-bookmark (bookmark-buffer-name))))
;; Set up defaults.
(bookmark-prop-set
record 'defaults
(delq nil (delete-dups (append (bookmark-prop-get record 'defaults)
(list bookmark-current-bookmark
(car record)
(bookmark-buffer-name))))))
record))
(defun bookmark-store (name alist no-overwrite)
"Store the bookmark NAME with data ALIST.
If NO-OVERWRITE is non-nil and another bookmark of the same name already
exists in `bookmark-alist', record the new bookmark without throwing away the
old one."
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(bookmark-maybe-load-default-file)
(let ((stripped-name (copy-sequence name)))
(set-text-properties 0 (length stripped-name) nil stripped-name)
(if (and (not no-overwrite)
(bookmark-get-bookmark stripped-name 'noerror))
;; Already existing bookmark under that name and
;; no prefix arg means just overwrite old bookmark.
(let ((bm (bookmark-get-bookmark stripped-name)))
;; First clean up if previously location was fontified.
(when bookmark-fringe-mark
(bookmark--remove-fringe-mark bm))
;; Modify using the new (NAME . ALIST) format.
(setcdr bm alist))
2001-01-12 22:49:40 +00:00
;; Otherwise just put it onto the front of the list. Either the
;; bookmark doesn't exist already, or there is no prefix arg.
;; In either case, we want the new bookmark on the front of the
;; list, since the list is kept in reverse order of creation.
(push (cons stripped-name alist) bookmark-alist))
2001-01-12 22:49:40 +00:00
;; Added by db
(setq bookmark-current-bookmark stripped-name)
(setq bookmark-alist-modification-count
(1+ bookmark-alist-modification-count))
(if (bookmark-time-to-save-p)
(bookmark-save))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(setq bookmark-current-bookmark stripped-name)
(bookmark-bmenu-surreptitiously-rebuild-list)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-make-record-default (&optional no-file no-context posn)
"Return the record describing the location of a new bookmark.
Point should be at the buffer in which the bookmark is being set,
and normally should be at the position where the bookmark is desired,
but see the optional arguments for other possibilities.
If NO-FILE is non-nil, then only return the subset of the
record that pertains to the location within the buffer, leaving off
the part that records the filename.
If NO-CONTEXT is non-nil, do not include the front- and rear-context
strings in the record -- the position is enough.
If POSN is non-nil, record POSN as the point instead of `(point)'."
`(,@(unless no-file `((filename . ,(bookmark-buffer-file-name))))
,@(unless no-context `((front-context-string
. ,(if (>= (- (point-max) (point))
bookmark-search-size)
(buffer-substring-no-properties
(point)
(+ (point) bookmark-search-size))
nil))))
,@(unless no-context `((rear-context-string
. ,(if (>= (- (point) (point-min))
bookmark-search-size)
(buffer-substring-no-properties
(point)
(- (point) bookmark-search-size))
nil))))
(position . ,(or posn (point)))
(last-modified . ,(current-time))))
2001-01-12 22:49:40 +00:00
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;; File format stuff
;; *IMPORTANT NOTICE* If you are thinking about modifying (redefining)
;; the bookmark file format -- please don't. The current format
;; should be extensible enough. If you feel the need to change it,
;; please discuss it with other Emacs developers first.
;;
;; The format of `bookmark-alist' has changed twice in its lifetime.
;; This comment describes the three formats, FIRST, SECOND, and
;; CURRENT.
;;
;; The FIRST format was used prior to Emacs 20:
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;
;; ((BOOKMARK-NAME (FILENAME
;; STRING-IN-FRONT
;; STRING-BEHIND
;; POINT))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;; ...)
;;
;; The SECOND format was introduced in Emacs 20:
;;
;; ((BOOKMARK-NAME ((filename . FILENAME)
;; (position . POS)
;; (front-context-string . STR-AFTER-POS)
;; (rear-context-string . STR-BEFORE-POS)
;; (annotation . ANNOTATION)
;; (whatever . VALUE)
;; ...
;; ))
;; ...)
;;
;; The CURRENT format was introduced in Emacs 22:
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;
;; ((BOOKMARK-NAME (filename . FILENAME)
;; (position . POS)
;; (front-context-string . STR-AFTER-POS)
;; (rear-context-string . STR-BEFORE-POS)
;; (annotation . ANNOTATION)
;; (whatever . VALUE)
;; ...
;; )
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;; ...)
;;
;; Both FIRST and SECOND have the same level of nesting: the cadr of a
;; bookmark record is a list of entry information. FIRST and SECOND
;; differ in the form of the record information: FIRST uses a list of
;; atoms, and SECOND uses an alist. In the FIRST format, the order of
;; the list elements matters. In the SECOND format, the order of the
;; alist elements is unimportant. The SECOND format facilitates the
;; addition of new kinds of elements, to support new kinds of
;; bookmarks or code evolution.
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;
;; The CURRENT format removes a level of nesting wrt FIRST and SECOND,
;; saving one cons cell per bookmark: the cadr of a bookmark record is
;; no longer a cons. Why that change was made remains a mystery --
;; just be aware of it. (Be aware too that this explanatory comment
;; was incorrect in Emacs 22 and Emacs 23.1.)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;
;; To deal with the change from FIRST format to SECOND, conversion
;; code was added, which is no longer used and has been declared
;; obsolete. See `bookmark-maybe-upgrade-file-format'.
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;
;; No conversion from SECOND to CURRENT is done. Instead, the code
;; handles both formats OK. It must continue to do so.
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;
;; See the doc string of `bookmark-alist' for information about the
;; elements that define a bookmark (e.g. `filename').
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defconst bookmark-file-format-version 1
"The current version of the format used by bookmark files.
You should never need to change this.")
(defconst bookmark-end-of-version-stamp-marker
"-*- End Of Bookmark File Format Version Stamp -*-\n"
"This string marks the end of the version stamp in a bookmark file.")
(defun bookmark-alist-from-buffer ()
"Return a `bookmark-alist' from the current buffer.
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
The buffer must of course contain bookmark format information.
Does not care from where in the buffer it is called, and does not
affect point."
(save-excursion
(goto-char (point-min))
(if (search-forward bookmark-end-of-version-stamp-marker nil t)
(read (current-buffer))
(if buffer-file-name
(error "File not in bookmark format: %s" buffer-file-name)
(error "Buffer not in bookmark format: %s" (buffer-name))))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-upgrade-version-0-alist (old-list)
"Upgrade a version 0 alist OLD-LIST to the current version."
(declare (obsolete nil "27.1"))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(mapcar
(lambda (bookmark)
(let* ((name (car bookmark))
(record (car (cdr bookmark)))
(filename (nth 0 record))
(front-str (nth 1 record))
(rear-str (nth 2 record))
(position (nth 3 record))
(ann (nth 4 record)))
(list
name
2001-11-27 15:52:52 +00:00
`((filename . ,filename)
(front-context-string . ,(or front-str ""))
(rear-context-string . ,(or rear-str ""))
(position . ,position)
(annotation . ,ann)))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
old-list))
(defun bookmark-upgrade-file-format-from-0 ()
"Upgrade a bookmark file of format 0 (the original format) to format 1.
This expects to be called from `point-min' in a bookmark file."
(declare (obsolete nil "27.1"))
(let* ((reporter (make-progress-reporter
(format "Upgrading bookmark format from 0 to %d..."
bookmark-file-format-version)))
(old-list (bookmark-alist-from-buffer))
(new-list (with-suppressed-warnings
((obsolete bookmark-upgrade-version-0-alist))
(bookmark-upgrade-version-0-alist old-list))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(delete-region (point-min) (point-max))
(bookmark-insert-file-format-version-stamp buffer-file-coding-system)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(pp new-list (current-buffer))
(save-buffer)
(goto-char (point-min))
(progress-reporter-done reporter)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-grok-file-format-version ()
"Return an integer which is the file-format version of this bookmark file.
This expects to be called from `point-min' in a bookmark file."
(declare (obsolete nil "27.1"))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(if (looking-at "^;;;;")
(save-excursion
(save-match-data
(re-search-forward "[0-9]")
(forward-char -1)
(read (current-buffer))))
;; Else this is format version 0, the original one, which didn't
;; even have version stamps.
0))
(defun bookmark-maybe-upgrade-file-format ()
"Check the file-format version of this bookmark file.
If the version is not up-to-date, upgrade it automatically.
This expects to be called from `point-min' in a bookmark file."
(declare (obsolete nil "27.1"))
(let ((version
(with-suppressed-warnings
((obsolete bookmark-grok-file-format-version))
(bookmark-grok-file-format-version))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(cond
((= version bookmark-file-format-version)
) ; home free -- version is current
((= version 0)
(with-suppressed-warnings
((obsolete bookmark-upgrade-file-format-from-0))
(bookmark-upgrade-file-format-from-0)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(t
(error "Bookmark file format version strangeness")))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-insert-file-format-version-stamp (coding)
"Insert text indicating current version of bookmark file format.
CODING is the symbol of the coding-system in which the file is encoded."
(if (memq (coding-system-base coding) '(undecided prefer-utf-8))
(setq coding 'utf-8-emacs))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(insert
(format
";;;; Emacs Bookmark Format Version %d\
;;;; -*- coding: %S; mode: lisp-data -*-\n"
bookmark-file-format-version (coding-system-base coding)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(insert ";;; This format is meant to be slightly human-readable;\n"
";;; nevertheless, you probably don't want to edit it.\n"
";;; "
bookmark-end-of-version-stamp-marker))
;;; end file-format stuff
;;; Core code:
(define-obsolete-function-alias 'bookmark-maybe-message 'message "27.1")
(defvar-keymap bookmark-minibuffer-read-name-map
:parent minibuffer-local-map
"C-w" #'bookmark-yank-word)
(defun bookmark-set-internal (prompt name overwrite-or-push)
"Set a bookmark using specified NAME or prompting with PROMPT.
The bookmark is set at the current location.
If NAME is non-nil, use it as the name of the new bookmark. In
this case, the value of PROMPT is ignored.
Otherwise, prompt the user for the bookmark name. Begin the
interactive prompt with PROMPT, followed by a space, a generated
default name in parentheses, a colon and a space.
OVERWRITE-OR-PUSH controls what happens if there is already a
bookmark with the same name: nil means signal an error;
`overwrite' means replace any existing bookmark; `push' means
push the new bookmark onto the bookmark alist. The `push'
behavior means that among bookmarks with the same name, this most
recently set one becomes the one in effect, but the others are
still there, in order, if the topmost one is ever deleted."
(unwind-protect
(let* ((record (bookmark-make-record))
;; `defaults' is a transient element of the
;; extensible format described above in the section
;; `File format stuff'. Bookmark record functions
;; can use it to specify a list of default values
;; accessible via M-n while reading a bookmark name.
(defaults (bookmark-prop-get record 'defaults))
(default (if (consp defaults) (car defaults) defaults)))
(if defaults
;; Don't store default values in the record.
(setq record (assq-delete-all 'defaults record))
;; When no defaults in the record, use its first element.
(setq defaults (car record) default defaults))
(bookmark-maybe-load-default-file)
;; Don't set `bookmark-yank-point' and `bookmark-current-buffer'
;; if they have been already set in another buffer. (e.g gnus-art).
(unless (and bookmark-yank-point
bookmark-current-buffer)
(setq bookmark-yank-point (point))
(setq bookmark-current-buffer (current-buffer)))
(let ((str
(or name
(read-from-minibuffer
Use `format-prompt' when prompting with default values * lisp/woman.el (woman-file-name): * lisp/wid-edit.el (widget-file-prompt-value) (widget-coding-system-prompt-value): * lisp/w32-fns.el (w32-set-system-coding-system): * lisp/vc/vc.el (vc-print-root-log): * lisp/vc/vc-annotate.el (vc-annotate): * lisp/vc/emerge.el (emerge-read-file-name): * lisp/vc/ediff.el (ediff-directories) (ediff-directory-revisions, ediff-directories3) (ediff-merge-directories, ) (ediff-merge-directories-with-ancestor) (ediff-merge-directory-revisions) (ediff-merge-directory-revisions-with-ancestor) (ediff-merge-revisions, ediff-merge-revisions-with-ancestor) (ediff-revision): * lisp/vc/ediff-util.el (ediff-toggle-regexp-match): * lisp/vc/ediff-mult.el (ediff-filegroup-action): * lisp/vc/add-log.el (prompt-for-change-log-name): * lisp/textmodes/table.el (table-insert-row-column) (table-span-cell, table-split-cell-horizontally) (table-split-cell, table-justify, table-generate-source) (table-insert-sequence, table-capture) (table--read-from-minibuffer, table--query-justification): * lisp/textmodes/sgml-mode.el (sgml-tag, sgml-tag-help): * lisp/textmodes/reftex-ref.el (reftex-goto-label): * lisp/textmodes/refer.el (refer-get-bib-files): * lisp/textmodes/css-mode.el (css-lookup-symbol): * lisp/term.el (serial-read-name, serial-read-speed): * lisp/speedbar.el (speedbar-change-initial-expansion-list): * lisp/simple.el (previous-matching-history-element) (set-variable): * lisp/ses.el (ses-read-cell, ses-set-column-width): * lisp/replace.el (query-replace-read-from) (occur-read-primary-args): * lisp/rect.el (string-rectangle, string-insert-rectangle): * lisp/progmodes/tcl.el (tcl-help-on-word): * lisp/progmodes/sh-script.el (sh-set-shell): * lisp/progmodes/python.el (python-eldoc-at-point): * lisp/progmodes/octave.el (octave-completing-read) (octave-update-function-file-comment, octave-insert-defun): * lisp/progmodes/inf-lisp.el (lisp-symprompt): * lisp/progmodes/cperl-mode.el (cperl-info-on-command) (cperl-perldoc): * lisp/progmodes/compile.el (compilation-find-file): * lisp/net/rcirc.el (rcirc-prompt-for-encryption): * lisp/net/eww.el (eww): * lisp/net/browse-url.el (browse-url-with-browser-kind): * lisp/man.el (man): * lisp/mail/sendmail.el (sendmail-query-user-about-smtp): * lisp/mail/mailalias.el (build-mail-aliases): * lisp/mail/mailabbrev.el (merge-mail-abbrevs) (rebuild-mail-abbrevs): * lisp/locate.el (locate-prompt-for-search-string): * lisp/isearch.el (isearch-occur): * lisp/international/ogonek.el (ogonek-read-encoding) (ogonek-read-prefix): * lisp/international/mule.el (read-buffer-file-coding-system) (set-terminal-coding-system, set-keyboard-coding-system) (set-next-selection-coding-system, recode-region): * lisp/international/mule-cmds.el () (universal-coding-system-argument, search-unencodable-char) (select-safe-coding-system-interactively): * lisp/info.el (Info-search, Info-search-backward, Info-menu): * lisp/info-look.el (info-lookup-interactive-arguments): * lisp/imenu.el (imenu--completion-buffer): * lisp/ibuf-ext.el (mode, used-mode, ibuffer-mark-by-mode): * lisp/hi-lock.el (hi-lock-unface-buffer) (hi-lock-read-face-name): * lisp/help.el (view-emacs-news, where-is): * lisp/help-fns.el (describe-variable, describe-symbol) (describe-keymap): * lisp/gnus/mm-decode.el (mm-save-part): * lisp/gnus/gnus-sum.el (gnus-summary-browse-url): * lisp/gnus/gnus-group.el (gnus-group--read-bug-ids) (gnus-group-set-current-level): * lisp/frame.el (make-frame-on-monitor) (close-display-connection, select-frame-by-name): * lisp/format.el (format-encode-buffer, format-encode-region): * lisp/files.el (recode-file-name): * lisp/files-x.el (read-file-local-variable) (read-file-local-variable-value, ) (read-file-local-variable-mode): * lisp/ffap.el (ffap-menu-ask): * lisp/faces.el (face-read-string): * lisp/facemenu.el (facemenu-set-charset): * lisp/erc/erc-dcc.el (erc-dcc-do-GET-command): * lisp/emulation/edt-mapper.el (edt-mapper): * lisp/emacs-lisp/trace.el (trace--read-args) (trace-function-foreground, trace-function-background): * lisp/emacs-lisp/smie.el (smie-config-set-indent): * lisp/emacs-lisp/re-builder.el (reb-change-syntax): * lisp/emacs-lisp/package.el (describe-package): * lisp/emacs-lisp/find-func.el (read-library-name) (find-function-read): * lisp/emacs-lisp/ert.el (ert-read-test-name) (ert-run-tests-interactively): * lisp/emacs-lisp/disass.el (disassemble): * lisp/emacs-lisp/debug.el (debug-on-entry) (debug-on-variable-change): * lisp/emacs-lisp/advice.el (ad-read-advised-function) (ad-read-advice-class, ad-read-advice-name, ad-read-regexp): * lisp/dired-x.el (dired--mark-suffix-interactive-spec): * lisp/dired-aux.el (dired-diff): * lisp/cus-edit.el (custom-variable-prompt, customize-mode) (customize-changed-options): * lisp/completion.el (interactive-completion-string-reader): * lisp/calendar/timeclock.el (timeclock-ask-for-project): * lisp/calc/calcalg3.el (calc-get-fit-variables): * lisp/calc/calc-store.el (calc-edit-variable): * lisp/calc/calc-bin.el (calc-word-size): * lisp/bookmark.el (bookmark-set-internal): * lisp/abbrev.el (read-abbrev-file): Use `format-prompt' for prompting (bug#12443).
2020-09-06 14:56:44 +00:00
(format-prompt prompt default)
nil
bookmark-minibuffer-read-name-map
nil nil defaults))))
(and (string-equal str "") (setq str default))
(cond
((eq overwrite-or-push nil)
(if (bookmark-get-bookmark str t)
(error "A bookmark named \"%s\" already exists" str)
(bookmark-store str (cdr record) nil)))
((eq overwrite-or-push 'overwrite)
(bookmark-store str (cdr record) nil))
((eq overwrite-or-push 'push)
(bookmark-store str (cdr record) t))
(t
(error "Unrecognized value for `overwrite-or-push': %S"
overwrite-or-push)))
;; Ask for an annotation buffer for this bookmark
(when bookmark-use-annotations
(bookmark-edit-annotation str))
(when bookmark-fringe-mark
(bookmark--set-fringe-mark))))
(setq bookmark-yank-point nil)
(setq bookmark-current-buffer nil)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;;###autoload
(defun bookmark-set (&optional name no-overwrite)
"Set a bookmark named NAME at the current location.
If NAME is nil, then prompt the user.
With a prefix arg (non-nil NO-OVERWRITE), do not overwrite any
existing bookmark that has the same name as NAME, but instead push the
new bookmark onto the bookmark alist. The most recently set bookmark
with name NAME is thus the one in effect at any given time, but the
others are still there, should the user decide to delete the most
recent one.
To yank words from the text of the buffer and use them as part of the
bookmark name, type \\<bookmark-minibuffer-read-name-map>\
\\[bookmark-yank-word] while setting a bookmark. Successive \
\\[bookmark-yank-word]'s
yank successive words.
Docfix: use command substitution for 'universal-argument' * lisp/autoarg.el (autoarg-mode): * lisp/bookmark.el (bookmark-set, bookmark-set-no-overwrite) (bookmark-save): * lisp/calendar/todo-mode.el (todo-insert-item) (todo-filter-top-priorities) (todo-filter-top-priorities-multifile): * lisp/dired-x.el (dired-mark-extension, dired-mark-suffix): * lisp/eshell/eshell.el (eshell): * lisp/gnus/gnus-group.el (gnus-group-find-new-groups): * lisp/gnus/gnus-start.el (gnus-find-new-newsgroups): * lisp/gnus/gnus-sum.el (gnus-summary-show-article): * lisp/gnus/gnus.el (gnus-secondary-servers): * lisp/org/org-timer.el (org-timer-set-timer): * lisp/org/ox.el (org-export-dispatch-last-position): * lisp/printing.el (pr-ps-directory-preview) (pr-ps-directory-using-ghostscript, pr-ps-directory-print) (pr-ps-directory-ps-print, pr-ps-buffer-preview) (pr-ps-buffer-using-ghostscript, pr-ps-buffer-print) (pr-ps-buffer-ps-print, pr-despool-preview) (pr-despool-using-ghostscript, pr-despool-print) (pr-despool-ps-print, pr-ps-file-up-ps-print, pr-ps-fast-fire) (pr-txt-fast-fire): * lisp/progmodes/idlwave.el (idlwave-complete): * lisp/progmodes/sh-script.el (sh-set-shell): * lisp/replace.el (occur): * lisp/ses.el (ses--advice-yank): * lisp/simple.el (set-mark-command-repeat-pop): * lisp/sort.el (delete-duplicate-lines): * lisp/strokes.el (strokes-help): * lisp/textmodes/artist.el (artist-mode): * lisp/textmodes/reftex-cite.el (reftex-citation): * lisp/textmodes/reftex-dcr.el (reftex-view-crossref): * lisp/textmodes/reftex-index.el (reftex-index-selection-or-word) (reftex-display-index): * lisp/textmodes/reftex-ref.el (reftex-reference): * lisp/textmodes/reftex-toc.el (reftex-toc): * lisp/textmodes/reftex-vars.el (reftex-cite-prompt-optional-args) (reftex-enable-partial-scans): * lisp/textmodes/texnfo-upd.el (texinfo-master-menu): * lisp/windmove.el (windmove-display-in-direction) (windmove-delete-left, windmove-delete-up) (windmove-delete-right, windmove-delete-down): * lisp/window.el (recenter-window-group, recenter-other-window): Use command substitution for 'universal-argument' instead of raw "C-u".
2021-09-16 18:05:48 +00:00
Typing \\[universal-argument] inserts (at the bookmark name prompt) the name of the last
bookmark used in the document where the new bookmark is being set;
this helps you use a single bookmark name to track progress through a
large document. If there is no prior bookmark for this document, then
Docfix: use command substitution for 'universal-argument' * lisp/autoarg.el (autoarg-mode): * lisp/bookmark.el (bookmark-set, bookmark-set-no-overwrite) (bookmark-save): * lisp/calendar/todo-mode.el (todo-insert-item) (todo-filter-top-priorities) (todo-filter-top-priorities-multifile): * lisp/dired-x.el (dired-mark-extension, dired-mark-suffix): * lisp/eshell/eshell.el (eshell): * lisp/gnus/gnus-group.el (gnus-group-find-new-groups): * lisp/gnus/gnus-start.el (gnus-find-new-newsgroups): * lisp/gnus/gnus-sum.el (gnus-summary-show-article): * lisp/gnus/gnus.el (gnus-secondary-servers): * lisp/org/org-timer.el (org-timer-set-timer): * lisp/org/ox.el (org-export-dispatch-last-position): * lisp/printing.el (pr-ps-directory-preview) (pr-ps-directory-using-ghostscript, pr-ps-directory-print) (pr-ps-directory-ps-print, pr-ps-buffer-preview) (pr-ps-buffer-using-ghostscript, pr-ps-buffer-print) (pr-ps-buffer-ps-print, pr-despool-preview) (pr-despool-using-ghostscript, pr-despool-print) (pr-despool-ps-print, pr-ps-file-up-ps-print, pr-ps-fast-fire) (pr-txt-fast-fire): * lisp/progmodes/idlwave.el (idlwave-complete): * lisp/progmodes/sh-script.el (sh-set-shell): * lisp/replace.el (occur): * lisp/ses.el (ses--advice-yank): * lisp/simple.el (set-mark-command-repeat-pop): * lisp/sort.el (delete-duplicate-lines): * lisp/strokes.el (strokes-help): * lisp/textmodes/artist.el (artist-mode): * lisp/textmodes/reftex-cite.el (reftex-citation): * lisp/textmodes/reftex-dcr.el (reftex-view-crossref): * lisp/textmodes/reftex-index.el (reftex-index-selection-or-word) (reftex-display-index): * lisp/textmodes/reftex-ref.el (reftex-reference): * lisp/textmodes/reftex-toc.el (reftex-toc): * lisp/textmodes/reftex-vars.el (reftex-cite-prompt-optional-args) (reftex-enable-partial-scans): * lisp/textmodes/texnfo-upd.el (texinfo-master-menu): * lisp/windmove.el (windmove-display-in-direction) (windmove-delete-left, windmove-delete-up) (windmove-delete-right, windmove-delete-down): * lisp/window.el (recenter-window-group, recenter-other-window): Use command substitution for 'universal-argument' instead of raw "C-u".
2021-09-16 18:05:48 +00:00
\\[universal-argument] inserts an appropriate name based on the buffer or file.
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 (list nil current-prefix-arg))
(let ((prompt
(if no-overwrite "Add bookmark named" "Set bookmark named")))
(bookmark-set-internal prompt name (if no-overwrite 'push 'overwrite))))
;;;###autoload
(defun bookmark-set-no-overwrite (&optional name push-bookmark)
"Set a bookmark named NAME at the current location.
If NAME is nil, then prompt the user.
If a bookmark named NAME already exists and prefix argument
PUSH-BOOKMARK is non-nil, then push the new bookmark onto the
bookmark alist. Pushing it means that among bookmarks named
NAME, this one becomes the one in effect, but the others are
still there, in order, and become effective again if the user
ever deletes the most recent one.
Otherwise, if a bookmark named NAME already exists but PUSH-BOOKMARK
is nil, raise an error.
To yank words from the text of the buffer and use them as part of the
bookmark name, type \\<bookmark-minibuffer-read-name-map>\
\\[bookmark-yank-word] while setting a bookmark. Successive \
\\[bookmark-yank-word]'s
yank successive words.
Docfix: use command substitution for 'universal-argument' * lisp/autoarg.el (autoarg-mode): * lisp/bookmark.el (bookmark-set, bookmark-set-no-overwrite) (bookmark-save): * lisp/calendar/todo-mode.el (todo-insert-item) (todo-filter-top-priorities) (todo-filter-top-priorities-multifile): * lisp/dired-x.el (dired-mark-extension, dired-mark-suffix): * lisp/eshell/eshell.el (eshell): * lisp/gnus/gnus-group.el (gnus-group-find-new-groups): * lisp/gnus/gnus-start.el (gnus-find-new-newsgroups): * lisp/gnus/gnus-sum.el (gnus-summary-show-article): * lisp/gnus/gnus.el (gnus-secondary-servers): * lisp/org/org-timer.el (org-timer-set-timer): * lisp/org/ox.el (org-export-dispatch-last-position): * lisp/printing.el (pr-ps-directory-preview) (pr-ps-directory-using-ghostscript, pr-ps-directory-print) (pr-ps-directory-ps-print, pr-ps-buffer-preview) (pr-ps-buffer-using-ghostscript, pr-ps-buffer-print) (pr-ps-buffer-ps-print, pr-despool-preview) (pr-despool-using-ghostscript, pr-despool-print) (pr-despool-ps-print, pr-ps-file-up-ps-print, pr-ps-fast-fire) (pr-txt-fast-fire): * lisp/progmodes/idlwave.el (idlwave-complete): * lisp/progmodes/sh-script.el (sh-set-shell): * lisp/replace.el (occur): * lisp/ses.el (ses--advice-yank): * lisp/simple.el (set-mark-command-repeat-pop): * lisp/sort.el (delete-duplicate-lines): * lisp/strokes.el (strokes-help): * lisp/textmodes/artist.el (artist-mode): * lisp/textmodes/reftex-cite.el (reftex-citation): * lisp/textmodes/reftex-dcr.el (reftex-view-crossref): * lisp/textmodes/reftex-index.el (reftex-index-selection-or-word) (reftex-display-index): * lisp/textmodes/reftex-ref.el (reftex-reference): * lisp/textmodes/reftex-toc.el (reftex-toc): * lisp/textmodes/reftex-vars.el (reftex-cite-prompt-optional-args) (reftex-enable-partial-scans): * lisp/textmodes/texnfo-upd.el (texinfo-master-menu): * lisp/windmove.el (windmove-display-in-direction) (windmove-delete-left, windmove-delete-up) (windmove-delete-right, windmove-delete-down): * lisp/window.el (recenter-window-group, recenter-other-window): Use command substitution for 'universal-argument' instead of raw "C-u".
2021-09-16 18:05:48 +00:00
Typing \\[universal-argument] inserts (at the bookmark name prompt) the name of the last
bookmark used in the document where the new bookmark is being set;
this helps you use a single bookmark name to track progress through a
large document. If there is no prior bookmark for this document, then
Docfix: use command substitution for 'universal-argument' * lisp/autoarg.el (autoarg-mode): * lisp/bookmark.el (bookmark-set, bookmark-set-no-overwrite) (bookmark-save): * lisp/calendar/todo-mode.el (todo-insert-item) (todo-filter-top-priorities) (todo-filter-top-priorities-multifile): * lisp/dired-x.el (dired-mark-extension, dired-mark-suffix): * lisp/eshell/eshell.el (eshell): * lisp/gnus/gnus-group.el (gnus-group-find-new-groups): * lisp/gnus/gnus-start.el (gnus-find-new-newsgroups): * lisp/gnus/gnus-sum.el (gnus-summary-show-article): * lisp/gnus/gnus.el (gnus-secondary-servers): * lisp/org/org-timer.el (org-timer-set-timer): * lisp/org/ox.el (org-export-dispatch-last-position): * lisp/printing.el (pr-ps-directory-preview) (pr-ps-directory-using-ghostscript, pr-ps-directory-print) (pr-ps-directory-ps-print, pr-ps-buffer-preview) (pr-ps-buffer-using-ghostscript, pr-ps-buffer-print) (pr-ps-buffer-ps-print, pr-despool-preview) (pr-despool-using-ghostscript, pr-despool-print) (pr-despool-ps-print, pr-ps-file-up-ps-print, pr-ps-fast-fire) (pr-txt-fast-fire): * lisp/progmodes/idlwave.el (idlwave-complete): * lisp/progmodes/sh-script.el (sh-set-shell): * lisp/replace.el (occur): * lisp/ses.el (ses--advice-yank): * lisp/simple.el (set-mark-command-repeat-pop): * lisp/sort.el (delete-duplicate-lines): * lisp/strokes.el (strokes-help): * lisp/textmodes/artist.el (artist-mode): * lisp/textmodes/reftex-cite.el (reftex-citation): * lisp/textmodes/reftex-dcr.el (reftex-view-crossref): * lisp/textmodes/reftex-index.el (reftex-index-selection-or-word) (reftex-display-index): * lisp/textmodes/reftex-ref.el (reftex-reference): * lisp/textmodes/reftex-toc.el (reftex-toc): * lisp/textmodes/reftex-vars.el (reftex-cite-prompt-optional-args) (reftex-enable-partial-scans): * lisp/textmodes/texnfo-upd.el (texinfo-master-menu): * lisp/windmove.el (windmove-display-in-direction) (windmove-delete-left, windmove-delete-up) (windmove-delete-right, windmove-delete-down): * lisp/window.el (recenter-window-group, recenter-other-window): Use command substitution for 'universal-argument' instead of raw "C-u".
2021-09-16 18:05:48 +00:00
\\[universal-argument] inserts an appropriate name based on the buffer or file.
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 (list nil current-prefix-arg))
(bookmark-set-internal "Set bookmark" name (if push-bookmark 'push nil)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-kill-line (&optional newline-too)
"Kill from point to end of line.
If optional arg NEWLINE-TOO is non-nil, delete the newline too.
Does not affect the kill ring."
(let ((eol (pos-eol)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(delete-region (point) eol)
(when (and newline-too (= (following-char) ?\n))
(delete-char 1))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Prefer defvar-local in remaining libraries * lisp/align.el (align-mode-rules-list) (align-mode-exclude-rules-list): * lisp/bookmark.el (bookmark-current-bookmark) (bookmark-annotation-name) (bookmark--annotation-from-bookmark-list): * lisp/calc/calc-embed.el (calc-embedded-all-active) (calc-embedded-some-active): * lisp/comint.el (comint-password-function): * lisp/completion.el (completion-syntax-table): * lisp/dframe.el (dframe-track-mouse-function) (dframe-help-echo-function, dframe-mouse-click-function) (dframe-mouse-position-function, dframe-timer) (dframe-attached-frame, dframe-controlled): * lisp/ehelp.el (electric-help-orig-major-mode): * lisp/eshell/esh-util.el (eshell-path-env): * lisp/expand.el (expand-pos, expand-index, expand-point): * lisp/face-remap.el (text-scale-mode-remapping) (text-scale-mode-lighter, text-scale-mode-amount) (text-scale-remap-header-line, buffer-face-mode-remapping): * lisp/ffap.el (ffap-menu-alist): * lisp/files-x.el (connection-local-variables-alist): * lisp/foldout.el (foldout-fold-list, foldout-mode-line-string): * lisp/follow.el (follow-start-end-invalid): * lisp/forms.el (forms--mode-setup): * lisp/gnus/message.el (message-cross-post-old-target) (message-options): * lisp/help-mode.el (help-xref-stack, help-xref-forward-stack) (help-xref-stack-item, help-xref-stack-forward-item): * lisp/hexl.el (hexl-mode--old-var-vals, hexl-ascii-overlay): * lisp/hilit-chg.el (hilit-chg-string): * lisp/ido.el (ido-eoinput): * lisp/imenu.el (imenu-generic-expression) (imenu-create-index-function, imenu-default-goto-function) (imenu-prev-index-position-function) (imenu-extract-index-name-function, imenu-name-lookup-function) (imenu-syntax-alist, imenu-case-fold-search): * lisp/jka-compr.el (jka-compr-really-do-compress): * lisp/language/ethio-util.el (ethio-prefer-ascii-space): * lisp/leim/quail/hangul.el (hangul-input-method-help-text): * lisp/leim/quail/japanese.el (quail-japanese-package-saved): * lisp/linum.el (linum-overlays, linum-available): * lisp/man.el (Man-original-frame, Man-arguments, Man--sections) (Man--refpages, Man-page-list, Man-current-page) (Man-page-mode-string): * lisp/pcomplete.el (pcomplete-current-completions) (pcomplete-last-completion-length) (pcomplete-last-completion-stub, pcomplete-last-completion-raw) (pcomplete-last-window-config, pcomplete-window-restore-timer): * lisp/reveal.el (reveal-open-spots, reveal-last-tick): * lisp/ruler-mode.el (ruler-mode): * lisp/scroll-lock.el (scroll-lock-preserve-screen-pos-save): * lisp/server.el (server-buffer-clients, server-existing-buffer): * lisp/tab-line.el (tab-line-exclude): * lisp/tar-mode.el (tar-data-buffer, tar-data-swapped): * lisp/thumbs.el (thumbs-current-tmp-filename) (thumbs-current-image-filename, thumbs-extra-images) (thumbs-image-num, thumbs-buffer, thumbs-marked-list): * lisp/tutorial.el (tutorial--point-before-chkeys) (tutorial--point-after-chkeys, tutorial--lang): * lisp/url/url-vars.el (url-current-object) (url-current-mime-headers, url-current-lastloc): * lisp/view.el (view-mode, view-old-buffer-read-only) (view-old-Helper-return-blurb, view-page-size) (view-half-page-size, view-last-regexp, view-return-to-alist) (view-exit-action, view-overlay): * lisp/wid-edit.el (widget-global-map, widget-field-new) (widget-field-list, widget-field-last, widget-field-was): * lisp/woman.el (woman-imenu-done): Prefer defvar-local.
2021-02-02 08:55:40 +00:00
(defvar-local bookmark-annotation-name nil
"Name of bookmark under edit in `bookmark-edit-annotation-mode'.")
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Prefer defvar-local in remaining libraries * lisp/align.el (align-mode-rules-list) (align-mode-exclude-rules-list): * lisp/bookmark.el (bookmark-current-bookmark) (bookmark-annotation-name) (bookmark--annotation-from-bookmark-list): * lisp/calc/calc-embed.el (calc-embedded-all-active) (calc-embedded-some-active): * lisp/comint.el (comint-password-function): * lisp/completion.el (completion-syntax-table): * lisp/dframe.el (dframe-track-mouse-function) (dframe-help-echo-function, dframe-mouse-click-function) (dframe-mouse-position-function, dframe-timer) (dframe-attached-frame, dframe-controlled): * lisp/ehelp.el (electric-help-orig-major-mode): * lisp/eshell/esh-util.el (eshell-path-env): * lisp/expand.el (expand-pos, expand-index, expand-point): * lisp/face-remap.el (text-scale-mode-remapping) (text-scale-mode-lighter, text-scale-mode-amount) (text-scale-remap-header-line, buffer-face-mode-remapping): * lisp/ffap.el (ffap-menu-alist): * lisp/files-x.el (connection-local-variables-alist): * lisp/foldout.el (foldout-fold-list, foldout-mode-line-string): * lisp/follow.el (follow-start-end-invalid): * lisp/forms.el (forms--mode-setup): * lisp/gnus/message.el (message-cross-post-old-target) (message-options): * lisp/help-mode.el (help-xref-stack, help-xref-forward-stack) (help-xref-stack-item, help-xref-stack-forward-item): * lisp/hexl.el (hexl-mode--old-var-vals, hexl-ascii-overlay): * lisp/hilit-chg.el (hilit-chg-string): * lisp/ido.el (ido-eoinput): * lisp/imenu.el (imenu-generic-expression) (imenu-create-index-function, imenu-default-goto-function) (imenu-prev-index-position-function) (imenu-extract-index-name-function, imenu-name-lookup-function) (imenu-syntax-alist, imenu-case-fold-search): * lisp/jka-compr.el (jka-compr-really-do-compress): * lisp/language/ethio-util.el (ethio-prefer-ascii-space): * lisp/leim/quail/hangul.el (hangul-input-method-help-text): * lisp/leim/quail/japanese.el (quail-japanese-package-saved): * lisp/linum.el (linum-overlays, linum-available): * lisp/man.el (Man-original-frame, Man-arguments, Man--sections) (Man--refpages, Man-page-list, Man-current-page) (Man-page-mode-string): * lisp/pcomplete.el (pcomplete-current-completions) (pcomplete-last-completion-length) (pcomplete-last-completion-stub, pcomplete-last-completion-raw) (pcomplete-last-window-config, pcomplete-window-restore-timer): * lisp/reveal.el (reveal-open-spots, reveal-last-tick): * lisp/ruler-mode.el (ruler-mode): * lisp/scroll-lock.el (scroll-lock-preserve-screen-pos-save): * lisp/server.el (server-buffer-clients, server-existing-buffer): * lisp/tab-line.el (tab-line-exclude): * lisp/tar-mode.el (tar-data-buffer, tar-data-swapped): * lisp/thumbs.el (thumbs-current-tmp-filename) (thumbs-current-image-filename, thumbs-extra-images) (thumbs-image-num, thumbs-buffer, thumbs-marked-list): * lisp/tutorial.el (tutorial--point-before-chkeys) (tutorial--point-after-chkeys, tutorial--lang): * lisp/url/url-vars.el (url-current-object) (url-current-mime-headers, url-current-lastloc): * lisp/view.el (view-mode, view-old-buffer-read-only) (view-old-Helper-return-blurb, view-page-size) (view-half-page-size, view-last-regexp, view-return-to-alist) (view-exit-action, view-overlay): * lisp/wid-edit.el (widget-global-map, widget-field-new) (widget-field-list, widget-field-last, widget-field-was): * lisp/woman.el (woman-imenu-done): Prefer defvar-local.
2021-02-02 08:55:40 +00:00
(defvar-local bookmark--annotation-from-bookmark-list nil
"If non-nil, `bookmark-edit-annotation-mode' should return to bookmark list.")
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-default-annotation-text (bookmark-name)
"Return default annotation text for BOOKMARK-NAME.
* bookmark.el (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-set-name, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-location, bookmark-jump, bookmark-jump-other-window, bookmark-handle-bookmark, bookmark-relocate, bookmark-insert-location, bookmark-rename, bookmark-insert, bookmark-delete, bookmark-time-to-save-p, bookmark-edit-annotation-mode, bookmark-edit-annotation): Improve doc strings to say whether bookmark can be a string or a record or both, and make other consistency and clarity fixes. (bookmark-get-handler, bookmark--jump-via, bookmark-write-file, bookmark-default-annotation-text, bookmark-yank-word, bookmark-maybe-load-default-file, bookmark-maybe-sort-alist, bookmark-import-new-list, bookmark-maybe-rename, bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames, bookmark-bmenu-bookmark): Give these doc strings. (bookmark-bmenu-check-position): Give this a doc string, but also add a FIXME comment about how the function may be pointless. (bookmark-default-handler): Rework doc string and change a parameter name, to clarify that this takes a bookmark record not a bookmark name. (bookmark-set): Change a parameter name to indicate its meaning, and improve the doc string a bit. (Bug#4188)
2009-10-05 01:35:34 +00:00
The default annotation text is simply some text explaining how to use
annotations."
Prefer directed to neutral quotes Prefer directed to neutral quotes in docstings and diagnostics. In docstrings, escape apostrophes that would otherwise be translated to curved quotes using the newer, simpler rules. * admin/unidata/unidata-gen.el (unidata-gen-table): * lisp/align.el (align-region): * lisp/allout.el (allout-mode, allout-solicit-alternate-bullet): * lisp/bookmark.el (bookmark-default-annotation-text): * lisp/calc/calc-aent.el (math-read-if, math-read-factor): * lisp/calc/calc-lang.el (math-read-giac-subscr) (math-read-math-subscr): * lisp/calc/calc-misc.el (report-calc-bug): * lisp/calc/calc-prog.el (calc-fix-token-name) (calc-read-parse-table-part): * lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules): * lisp/cedet/semantic/complete.el (semantic-displayor-show-request): * lisp/dabbrev.el (dabbrev-expand): * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine): * lisp/emacs-lisp/elint.el (elint-get-top-forms): * lisp/emacs-lisp/lisp-mnt.el (lm-verify): * lisp/emulation/viper-cmd.el (viper-toggle-search-style): * lisp/erc/erc-button.el (erc-nick-popup): * lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login): * lisp/eshell/em-dirs.el (eshell/cd): * lisp/eshell/em-glob.el (eshell-glob-regexp): * lisp/eshell/em-pred.el (eshell-parse-modifiers): * lisp/eshell/esh-arg.el (eshell-parse-arguments): * lisp/eshell/esh-opt.el (eshell-show-usage): * lisp/files-x.el (modify-file-local-variable): * lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer) (filesets-update-pre010505): * lisp/find-cmd.el (find-generic, find-to-string): * lisp/gnus/auth-source.el (auth-source-netrc-parse-entries): * lisp/gnus/gnus-agent.el (gnus-agent-check-overview-buffer) (gnus-agent-fetch-headers): * lisp/gnus/gnus-int.el (gnus-start-news-server): * lisp/gnus/gnus-registry.el: (gnus-registry--split-fancy-with-parent-internal): * lisp/gnus/gnus-score.el (gnus-summary-increase-score): * lisp/gnus/gnus-start.el (gnus-convert-old-newsrc): * lisp/gnus/gnus-topic.el (gnus-topic-rename): * lisp/gnus/legacy-gnus-agent.el (gnus-agent-unlist-expire-days): * lisp/gnus/nnmairix.el (nnmairix-widget-create-query): * lisp/gnus/spam.el (spam-check-blackholes): * lisp/mail/feedmail.el (feedmail-run-the-queue): * lisp/mpc.el (mpc-playlist-rename): * lisp/net/ange-ftp.el (ange-ftp-shell-command): * lisp/net/mairix.el (mairix-widget-create-query): * lisp/net/tramp-cache.el: * lisp/obsolete/otodo-mode.el (todo-more-important-p): * lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region): * lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region): * lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region): * lisp/org/ob-core.el (org-babel-goto-named-src-block) (org-babel-goto-named-result): * lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap): * lisp/org/ob-ref.el (org-babel-ref-resolve): * lisp/org/org-agenda.el (org-agenda-prepare): * lisp/org/org-bibtex.el (org-bibtex-fields): * lisp/org/org-clock.el (org-clock-notify-once-if-expired) (org-clock-resolve): * lisp/org/org-feed.el (org-feed-parse-atom-entry): * lisp/org/org-habit.el (org-habit-parse-todo): * lisp/org/org-mouse.el (org-mouse-popup-global-menu) (org-mouse-context-menu): * lisp/org/org-table.el (org-table-edit-formulas): * lisp/org/ox.el (org-export-async-start): * lisp/play/dunnet.el (dun-score, dun-help, dun-endgame-question) (dun-rooms, dun-endgame-questions): * lisp/progmodes/ada-mode.el (ada-goto-matching-start): * lisp/progmodes/ada-xref.el (ada-find-executable): * lisp/progmodes/antlr-mode.el (antlr-options-alists): * lisp/progmodes/flymake.el (flymake-parse-err-lines) (flymake-start-syntax-check-process): * lisp/progmodes/python.el (python-define-auxiliary-skeleton): * lisp/progmodes/sql.el (sql-comint): * lisp/progmodes/verilog-mode.el (verilog-load-file-at-point): * lisp/server.el (server-get-auth-key): * lisp/subr.el (version-to-list): * lisp/textmodes/reftex-ref.el (reftex-label): * lisp/textmodes/reftex-toc.el (reftex-toc-rename-label): * lisp/vc/ediff-diff.el (ediff-same-contents): * lisp/vc/vc-cvs.el (vc-cvs-mode-line-string): * test/automated/tramp-tests.el (tramp-test33-asynchronous-requests): Use directed rather than neutral quotes in diagnostics.
2015-08-25 06:39:33 +00:00
(concat (format-message
Go back to grave quoting in source-code docstrings etc. This reverts almost all my recent changes to use curved quotes in docstrings and/or strings used for error diagnostics. There are a few exceptions, e.g., Bahá’í proper names. * admin/unidata/unidata-gen.el (unidata-gen-table): * lisp/abbrev.el (expand-region-abbrevs): * lisp/align.el (align-region): * lisp/allout.el (allout-mode, allout-solicit-alternate-bullet) (outlineify-sticky): * lisp/apropos.el (apropos-library): * lisp/bookmark.el (bookmark-default-annotation-text): * lisp/button.el (button-category-symbol, button-put) (make-text-button): * lisp/calc/calc-aent.el (math-read-if, math-read-factor): * lisp/calc/calc-embed.el (calc-do-embedded): * lisp/calc/calc-ext.el (calc-user-function-list): * lisp/calc/calc-graph.el (calc-graph-show-dumb): * lisp/calc/calc-help.el (calc-describe-key) (calc-describe-thing, calc-full-help): * lisp/calc/calc-lang.el (calc-c-language) (math-parse-fortran-vector-end, math-parse-tex-sum) (math-parse-eqn-matrix, math-parse-eqn-prime) (calc-yacas-language, calc-maxima-language, calc-giac-language) (math-read-giac-subscr, math-read-math-subscr) (math-read-big-rec, math-read-big-balance): * lisp/calc/calc-misc.el (calc-help, report-calc-bug): * lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes) (calc-auto-recompute): * lisp/calc/calc-prog.el (calc-fix-token-name) (calc-read-parse-table-part, calc-user-define-invocation) (math-do-arg-check): * lisp/calc/calc-store.el (calc-edit-variable): * lisp/calc/calc-units.el (math-build-units-table-buffer): * lisp/calc/calc-vec.el (math-read-brackets): * lisp/calc/calc-yank.el (calc-edit-mode): * lisp/calc/calc.el (calc, calc-do, calc-user-invocation): * lisp/calendar/appt.el (appt-display-message): * lisp/calendar/diary-lib.el (diary-check-diary-file) (diary-mail-entries, diary-from-outlook): * lisp/calendar/icalendar.el (icalendar-export-region) (icalendar--convert-float-to-ical) (icalendar--convert-date-to-ical) (icalendar--convert-ical-to-diary) (icalendar--convert-recurring-to-diary) (icalendar--add-diary-entry): * lisp/calendar/time-date.el (format-seconds): * lisp/calendar/timeclock.el (timeclock-mode-line-display) (timeclock-make-hours-explicit, timeclock-log-data): * lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category) (todo-item-mark, todo-check-format) (todo-insert-item--next-param, todo-edit-item--next-key) (todo-mode): * lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules): * lisp/cedet/mode-local.el (describe-mode-local-overload) (mode-local-print-binding, mode-local-describe-bindings-2): * lisp/cedet/semantic/complete.el (semantic-displayor-show-request): * lisp/cedet/srecode/srt-mode.el (srecode-macro-help): * lisp/cus-start.el (standard): * lisp/cus-theme.el (describe-theme-1): * lisp/custom.el (custom-add-dependencies, custom-check-theme) (custom--sort-vars-1, load-theme): * lisp/descr-text.el (describe-text-properties-1, describe-char): * lisp/dired-x.el (dired-do-run-mail): * lisp/dired.el (dired-log): * lisp/emacs-lisp/advice.el (ad-read-advised-function) (ad-read-advice-class, ad-read-advice-name, ad-enable-advice) (ad-disable-advice, ad-remove-advice, ad-set-argument) (ad-set-arguments, ad--defalias-fset, ad-activate) (ad-deactivate): * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand) (byte-compile-unfold-lambda, byte-optimize-form-code-walker) (byte-optimize-while, byte-optimize-apply): * lisp/emacs-lisp/byte-run.el (defun, defsubst): * lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode) (byte-compile-log-file, byte-compile-format-warn) (byte-compile-nogroup-warn, byte-compile-arglist-warn) (byte-compile-cl-warn) (byte-compile-warn-about-unresolved-functions) (byte-compile-file, byte-compile--declare-var) (byte-compile-file-form-defmumble, byte-compile-form) (byte-compile-normal-call, byte-compile-check-variable) (byte-compile-variable-ref, byte-compile-variable-set) (byte-compile-subr-wrong-args, byte-compile-setq-default) (byte-compile-negation-optimizer) (byte-compile-condition-case--old) (byte-compile-condition-case--new, byte-compile-save-excursion) (byte-compile-defvar, byte-compile-autoload) (byte-compile-lambda-form) (byte-compile-make-variable-buffer-local, display-call-tree) (batch-byte-compile): * lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use): * lisp/emacs-lisp/chart.el (chart-space-usage): * lisp/emacs-lisp/check-declare.el (check-declare-scan) (check-declare-warn, check-declare-file) (check-declare-directory): * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine) (checkdoc-message-text-engine): * lisp/emacs-lisp/cl-extra.el (cl-parse-integer) (cl--describe-class): * lisp/emacs-lisp/cl-generic.el (cl-defgeneric) (cl--generic-describe, cl-generic-generalizers): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody) (cl-symbol-macrolet): * lisp/emacs-lisp/cl.el (cl-unload-function, flet): * lisp/emacs-lisp/copyright.el (copyright) (copyright-update-directory): * lisp/emacs-lisp/edebug.el (edebug-read-list): * lisp/emacs-lisp/eieio-base.el (eieio-persistent-read): * lisp/emacs-lisp/eieio-core.el (eieio--slot-override) (eieio-oref): * lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor): * lisp/emacs-lisp/eieio-speedbar.el: (eieio-speedbar-child-make-tag-lines) (eieio-speedbar-child-description): * lisp/emacs-lisp/eieio.el (defclass, change-class): * lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms) (elint-init-form, elint-check-defalias-form) (elint-check-let-form): * lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu) (ert-results-pop-to-backtrace-for-test-at-point) (ert-results-pop-to-messages-for-test-at-point) (ert-results-pop-to-should-forms-for-test-at-point) (ert-describe-test): * lisp/emacs-lisp/find-func.el (find-function-search-for-symbol) (find-function-library): * lisp/emacs-lisp/generator.el (iter-yield): * lisp/emacs-lisp/gv.el (gv-define-simple-setter): * lisp/emacs-lisp/lisp-mnt.el (lm-verify): * lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning): * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): * lisp/emacs-lisp/nadvice.el (advice--make-docstring) (advice--make, define-advice): * lisp/emacs-lisp/package-x.el (package-upload-file): * lisp/emacs-lisp/package.el (package-version-join) (package-disabled-p, package-activate-1, package-activate) (package--download-one-archive) (package--download-and-read-archives) (package-compute-transaction, package-install-from-archive) (package-install, package-install-selected-packages) (package-delete, package-autoremove, describe-package-1) (package-install-button-action, package-delete-button-action) (package-menu-hide-package, package-menu--list-to-prompt) (package-menu--perform-transaction) (package-menu--find-and-notify-upgrades): * lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1): * lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode): * lisp/emacs-lisp/ring.el (ring-previous, ring-next): * lisp/emacs-lisp/rx.el (rx-check, rx-anything) (rx-check-any-string, rx-check-any, rx-check-not, rx-=) (rx-repeat, rx-check-backref, rx-syntax, rx-check-category) (rx-form): * lisp/emacs-lisp/smie.el (smie-config-save): * lisp/emacs-lisp/subr-x.el (internal--check-binding): * lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag): * lisp/emacs-lisp/testcover.el (testcover-1value): * lisp/emacs-lisp/timer.el (timer-event-handler): * lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments) (viper-toggle-search-style, viper-kill-buffer) (viper-brac-function): * lisp/emulation/viper-macs.el (viper-record-kbd-macro): * lisp/env.el (setenv): * lisp/erc/erc-button.el (erc-nick-popup): * lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english): * lisp/eshell/em-dirs.el (eshell/cd): * lisp/eshell/em-glob.el (eshell-glob-regexp) (eshell-glob-entries): * lisp/eshell/em-pred.el (eshell-parse-modifiers): * lisp/eshell/esh-opt.el (eshell-show-usage): * lisp/facemenu.el (facemenu-add-new-face) (facemenu-add-new-color): * lisp/faces.el (read-face-name, read-face-font, describe-face) (x-resolve-font-name): * lisp/files-x.el (modify-file-local-variable): * lisp/files.el (locate-user-emacs-file, find-alternate-file) (set-auto-mode, hack-one-local-variable--obsolete) (dir-locals-set-directory-class, write-file, basic-save-buffer) (delete-directory, copy-directory, recover-session) (recover-session-finish, insert-directory) (file-modes-char-to-who, file-modes-symbolic-to-number) (move-file-to-trash): * lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer): * lisp/find-cmd.el (find-generic, find-to-string): * lisp/finder.el (finder-commentary): * lisp/font-lock.el (font-lock-fontify-buffer): * lisp/format.el (format-write-file, format-find-file) (format-insert-file): * lisp/frame.el (get-device-terminal, select-frame-by-name): * lisp/fringe.el (fringe--check-style): * lisp/gnus/nnmairix.el (nnmairix-widget-create-query): * lisp/help-fns.el (help-fns--key-bindings) (help-fns--compiler-macro, help-fns--parent-mode) (help-fns--obsolete, help-fns--interactive-only) (describe-function-1, describe-variable): * lisp/help.el (describe-mode) (describe-minor-mode-from-indicator): * lisp/image.el (image-type): * lisp/international/ccl.el (ccl-dump): * lisp/international/fontset.el (x-must-resolve-font-name): * lisp/international/mule-cmds.el (prefer-coding-system) (select-safe-coding-system-interactively) (select-safe-coding-system, activate-input-method) (toggle-input-method, describe-current-input-method) (describe-language-environment): * lisp/international/mule-conf.el (code-offset): * lisp/international/mule-diag.el (describe-character-set) (list-input-methods-1): * lisp/mail/feedmail.el (feedmail-run-the-queue): * lisp/mouse.el (minor-mode-menu-from-indicator): * lisp/mpc.el (mpc-playlist-rename): * lisp/msb.el (msb--choose-menu): * lisp/net/ange-ftp.el (ange-ftp-shell-command): * lisp/net/imap.el (imap-interactive-login): * lisp/net/mairix.el (mairix-widget-create-query): * lisp/net/newst-backend.el (newsticker--sentinel-work): * lisp/net/newst-treeview.el (newsticker--treeview-load): * lisp/net/rlogin.el (rlogin): * lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer): * lisp/obsolete/otodo-mode.el (todo-more-important-p): * lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region): * lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region): * lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region): * lisp/org/ob-core.el (org-babel-goto-named-src-block) (org-babel-goto-named-result): * lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap): * lisp/org/ob-ref.el (org-babel-ref-resolve): * lisp/org/org-agenda.el (org-agenda-prepare): * lisp/org/org-clock.el (org-clock-notify-once-if-expired) (org-clock-resolve): * lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag): * lisp/org/org-feed.el (org-feed-parse-atom-entry): * lisp/org/org-habit.el (org-habit-parse-todo): * lisp/org/org-mouse.el (org-mouse-popup-global-menu) (org-mouse-context-menu): * lisp/org/org-table.el (org-table-edit-formulas): * lisp/org/ox.el (org-export-async-start): * lisp/proced.el (proced-log): * lisp/progmodes/ada-mode.el (ada-get-indent-case) (ada-check-matching-start, ada-goto-matching-start): * lisp/progmodes/ada-prj.el (ada-prj-display-page): * lisp/progmodes/ada-xref.el (ada-find-executable): * lisp/progmodes/ebrowse.el (ebrowse-tags-apropos): * lisp/progmodes/etags.el (etags-tags-apropos-additional): * lisp/progmodes/flymake.el (flymake-parse-err-lines) (flymake-start-syntax-check-process): * lisp/progmodes/python.el (python-shell-get-process-or-error) (python-define-auxiliary-skeleton): * lisp/progmodes/sql.el (sql-comint): * lisp/progmodes/verilog-mode.el (verilog-load-file-at-point): * lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate): * lisp/recentf.el (recentf-open-files): * lisp/replace.el (query-replace-read-from) (occur-after-change-function, occur-1): * lisp/scroll-bar.el (scroll-bar-columns): * lisp/server.el (server-get-auth-key): * lisp/simple.el (execute-extended-command) (undo-outer-limit-truncate, list-processes--refresh) (compose-mail, set-variable, choose-completion-string) (define-alternatives): * lisp/startup.el (site-run-file, tty-handle-args, command-line) (command-line-1): * lisp/subr.el (noreturn, define-error, add-to-list) (read-char-choice, version-to-list): * lisp/term/common-win.el (x-handle-xrm-switch) (x-handle-name-switch, x-handle-args): * lisp/term/x-win.el (x-handle-parent-id, x-handle-smid): * lisp/textmodes/reftex-ref.el (reftex-label): * lisp/textmodes/reftex-toc.el (reftex-toc-rename-label): * lisp/textmodes/two-column.el (2C-split): * lisp/tutorial.el (tutorial--describe-nonstandard-key) (tutorial--find-changed-keys): * lisp/type-break.el (type-break-noninteractive-query): * lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes) (wdired-do-perm-changes): * lisp/whitespace.el (whitespace-report-region): Prefer grave quoting in source-code strings used to generate help and diagnostics. * lisp/faces.el (face-documentation): No need to convert quotes, since the result is a docstring. * lisp/info.el (Info-virtual-index-find-node) (Info-virtual-index, info-apropos): Simplify by generating only curved quotes, since info files are typically that ways nowadays anyway. * lisp/international/mule-diag.el (list-input-methods): Don’t assume text quoting style is curved. * lisp/org/org-bibtex.el (org-bibtex-fields): Revert my recent changes, going back to the old quoting style.
2015-09-07 15:41:44 +00:00
"# Type the annotation for bookmark `%s' here.\n"
Prefer directed to neutral quotes Prefer directed to neutral quotes in docstings and diagnostics. In docstrings, escape apostrophes that would otherwise be translated to curved quotes using the newer, simpler rules. * admin/unidata/unidata-gen.el (unidata-gen-table): * lisp/align.el (align-region): * lisp/allout.el (allout-mode, allout-solicit-alternate-bullet): * lisp/bookmark.el (bookmark-default-annotation-text): * lisp/calc/calc-aent.el (math-read-if, math-read-factor): * lisp/calc/calc-lang.el (math-read-giac-subscr) (math-read-math-subscr): * lisp/calc/calc-misc.el (report-calc-bug): * lisp/calc/calc-prog.el (calc-fix-token-name) (calc-read-parse-table-part): * lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules): * lisp/cedet/semantic/complete.el (semantic-displayor-show-request): * lisp/dabbrev.el (dabbrev-expand): * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine): * lisp/emacs-lisp/elint.el (elint-get-top-forms): * lisp/emacs-lisp/lisp-mnt.el (lm-verify): * lisp/emulation/viper-cmd.el (viper-toggle-search-style): * lisp/erc/erc-button.el (erc-nick-popup): * lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login): * lisp/eshell/em-dirs.el (eshell/cd): * lisp/eshell/em-glob.el (eshell-glob-regexp): * lisp/eshell/em-pred.el (eshell-parse-modifiers): * lisp/eshell/esh-arg.el (eshell-parse-arguments): * lisp/eshell/esh-opt.el (eshell-show-usage): * lisp/files-x.el (modify-file-local-variable): * lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer) (filesets-update-pre010505): * lisp/find-cmd.el (find-generic, find-to-string): * lisp/gnus/auth-source.el (auth-source-netrc-parse-entries): * lisp/gnus/gnus-agent.el (gnus-agent-check-overview-buffer) (gnus-agent-fetch-headers): * lisp/gnus/gnus-int.el (gnus-start-news-server): * lisp/gnus/gnus-registry.el: (gnus-registry--split-fancy-with-parent-internal): * lisp/gnus/gnus-score.el (gnus-summary-increase-score): * lisp/gnus/gnus-start.el (gnus-convert-old-newsrc): * lisp/gnus/gnus-topic.el (gnus-topic-rename): * lisp/gnus/legacy-gnus-agent.el (gnus-agent-unlist-expire-days): * lisp/gnus/nnmairix.el (nnmairix-widget-create-query): * lisp/gnus/spam.el (spam-check-blackholes): * lisp/mail/feedmail.el (feedmail-run-the-queue): * lisp/mpc.el (mpc-playlist-rename): * lisp/net/ange-ftp.el (ange-ftp-shell-command): * lisp/net/mairix.el (mairix-widget-create-query): * lisp/net/tramp-cache.el: * lisp/obsolete/otodo-mode.el (todo-more-important-p): * lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region): * lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region): * lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region): * lisp/org/ob-core.el (org-babel-goto-named-src-block) (org-babel-goto-named-result): * lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap): * lisp/org/ob-ref.el (org-babel-ref-resolve): * lisp/org/org-agenda.el (org-agenda-prepare): * lisp/org/org-bibtex.el (org-bibtex-fields): * lisp/org/org-clock.el (org-clock-notify-once-if-expired) (org-clock-resolve): * lisp/org/org-feed.el (org-feed-parse-atom-entry): * lisp/org/org-habit.el (org-habit-parse-todo): * lisp/org/org-mouse.el (org-mouse-popup-global-menu) (org-mouse-context-menu): * lisp/org/org-table.el (org-table-edit-formulas): * lisp/org/ox.el (org-export-async-start): * lisp/play/dunnet.el (dun-score, dun-help, dun-endgame-question) (dun-rooms, dun-endgame-questions): * lisp/progmodes/ada-mode.el (ada-goto-matching-start): * lisp/progmodes/ada-xref.el (ada-find-executable): * lisp/progmodes/antlr-mode.el (antlr-options-alists): * lisp/progmodes/flymake.el (flymake-parse-err-lines) (flymake-start-syntax-check-process): * lisp/progmodes/python.el (python-define-auxiliary-skeleton): * lisp/progmodes/sql.el (sql-comint): * lisp/progmodes/verilog-mode.el (verilog-load-file-at-point): * lisp/server.el (server-get-auth-key): * lisp/subr.el (version-to-list): * lisp/textmodes/reftex-ref.el (reftex-label): * lisp/textmodes/reftex-toc.el (reftex-toc-rename-label): * lisp/vc/ediff-diff.el (ediff-same-contents): * lisp/vc/vc-cvs.el (vc-cvs-mode-line-string): * test/automated/tramp-tests.el (tramp-test33-asynchronous-requests): Use directed rather than neutral quotes in diagnostics.
2015-08-25 06:39:33 +00:00
bookmark-name)
(format-message
Go back to grave quoting in source-code docstrings etc. This reverts almost all my recent changes to use curved quotes in docstrings and/or strings used for error diagnostics. There are a few exceptions, e.g., Bahá’í proper names. * admin/unidata/unidata-gen.el (unidata-gen-table): * lisp/abbrev.el (expand-region-abbrevs): * lisp/align.el (align-region): * lisp/allout.el (allout-mode, allout-solicit-alternate-bullet) (outlineify-sticky): * lisp/apropos.el (apropos-library): * lisp/bookmark.el (bookmark-default-annotation-text): * lisp/button.el (button-category-symbol, button-put) (make-text-button): * lisp/calc/calc-aent.el (math-read-if, math-read-factor): * lisp/calc/calc-embed.el (calc-do-embedded): * lisp/calc/calc-ext.el (calc-user-function-list): * lisp/calc/calc-graph.el (calc-graph-show-dumb): * lisp/calc/calc-help.el (calc-describe-key) (calc-describe-thing, calc-full-help): * lisp/calc/calc-lang.el (calc-c-language) (math-parse-fortran-vector-end, math-parse-tex-sum) (math-parse-eqn-matrix, math-parse-eqn-prime) (calc-yacas-language, calc-maxima-language, calc-giac-language) (math-read-giac-subscr, math-read-math-subscr) (math-read-big-rec, math-read-big-balance): * lisp/calc/calc-misc.el (calc-help, report-calc-bug): * lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes) (calc-auto-recompute): * lisp/calc/calc-prog.el (calc-fix-token-name) (calc-read-parse-table-part, calc-user-define-invocation) (math-do-arg-check): * lisp/calc/calc-store.el (calc-edit-variable): * lisp/calc/calc-units.el (math-build-units-table-buffer): * lisp/calc/calc-vec.el (math-read-brackets): * lisp/calc/calc-yank.el (calc-edit-mode): * lisp/calc/calc.el (calc, calc-do, calc-user-invocation): * lisp/calendar/appt.el (appt-display-message): * lisp/calendar/diary-lib.el (diary-check-diary-file) (diary-mail-entries, diary-from-outlook): * lisp/calendar/icalendar.el (icalendar-export-region) (icalendar--convert-float-to-ical) (icalendar--convert-date-to-ical) (icalendar--convert-ical-to-diary) (icalendar--convert-recurring-to-diary) (icalendar--add-diary-entry): * lisp/calendar/time-date.el (format-seconds): * lisp/calendar/timeclock.el (timeclock-mode-line-display) (timeclock-make-hours-explicit, timeclock-log-data): * lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category) (todo-item-mark, todo-check-format) (todo-insert-item--next-param, todo-edit-item--next-key) (todo-mode): * lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules): * lisp/cedet/mode-local.el (describe-mode-local-overload) (mode-local-print-binding, mode-local-describe-bindings-2): * lisp/cedet/semantic/complete.el (semantic-displayor-show-request): * lisp/cedet/srecode/srt-mode.el (srecode-macro-help): * lisp/cus-start.el (standard): * lisp/cus-theme.el (describe-theme-1): * lisp/custom.el (custom-add-dependencies, custom-check-theme) (custom--sort-vars-1, load-theme): * lisp/descr-text.el (describe-text-properties-1, describe-char): * lisp/dired-x.el (dired-do-run-mail): * lisp/dired.el (dired-log): * lisp/emacs-lisp/advice.el (ad-read-advised-function) (ad-read-advice-class, ad-read-advice-name, ad-enable-advice) (ad-disable-advice, ad-remove-advice, ad-set-argument) (ad-set-arguments, ad--defalias-fset, ad-activate) (ad-deactivate): * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand) (byte-compile-unfold-lambda, byte-optimize-form-code-walker) (byte-optimize-while, byte-optimize-apply): * lisp/emacs-lisp/byte-run.el (defun, defsubst): * lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode) (byte-compile-log-file, byte-compile-format-warn) (byte-compile-nogroup-warn, byte-compile-arglist-warn) (byte-compile-cl-warn) (byte-compile-warn-about-unresolved-functions) (byte-compile-file, byte-compile--declare-var) (byte-compile-file-form-defmumble, byte-compile-form) (byte-compile-normal-call, byte-compile-check-variable) (byte-compile-variable-ref, byte-compile-variable-set) (byte-compile-subr-wrong-args, byte-compile-setq-default) (byte-compile-negation-optimizer) (byte-compile-condition-case--old) (byte-compile-condition-case--new, byte-compile-save-excursion) (byte-compile-defvar, byte-compile-autoload) (byte-compile-lambda-form) (byte-compile-make-variable-buffer-local, display-call-tree) (batch-byte-compile): * lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use): * lisp/emacs-lisp/chart.el (chart-space-usage): * lisp/emacs-lisp/check-declare.el (check-declare-scan) (check-declare-warn, check-declare-file) (check-declare-directory): * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine) (checkdoc-message-text-engine): * lisp/emacs-lisp/cl-extra.el (cl-parse-integer) (cl--describe-class): * lisp/emacs-lisp/cl-generic.el (cl-defgeneric) (cl--generic-describe, cl-generic-generalizers): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody) (cl-symbol-macrolet): * lisp/emacs-lisp/cl.el (cl-unload-function, flet): * lisp/emacs-lisp/copyright.el (copyright) (copyright-update-directory): * lisp/emacs-lisp/edebug.el (edebug-read-list): * lisp/emacs-lisp/eieio-base.el (eieio-persistent-read): * lisp/emacs-lisp/eieio-core.el (eieio--slot-override) (eieio-oref): * lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor): * lisp/emacs-lisp/eieio-speedbar.el: (eieio-speedbar-child-make-tag-lines) (eieio-speedbar-child-description): * lisp/emacs-lisp/eieio.el (defclass, change-class): * lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms) (elint-init-form, elint-check-defalias-form) (elint-check-let-form): * lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu) (ert-results-pop-to-backtrace-for-test-at-point) (ert-results-pop-to-messages-for-test-at-point) (ert-results-pop-to-should-forms-for-test-at-point) (ert-describe-test): * lisp/emacs-lisp/find-func.el (find-function-search-for-symbol) (find-function-library): * lisp/emacs-lisp/generator.el (iter-yield): * lisp/emacs-lisp/gv.el (gv-define-simple-setter): * lisp/emacs-lisp/lisp-mnt.el (lm-verify): * lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning): * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): * lisp/emacs-lisp/nadvice.el (advice--make-docstring) (advice--make, define-advice): * lisp/emacs-lisp/package-x.el (package-upload-file): * lisp/emacs-lisp/package.el (package-version-join) (package-disabled-p, package-activate-1, package-activate) (package--download-one-archive) (package--download-and-read-archives) (package-compute-transaction, package-install-from-archive) (package-install, package-install-selected-packages) (package-delete, package-autoremove, describe-package-1) (package-install-button-action, package-delete-button-action) (package-menu-hide-package, package-menu--list-to-prompt) (package-menu--perform-transaction) (package-menu--find-and-notify-upgrades): * lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1): * lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode): * lisp/emacs-lisp/ring.el (ring-previous, ring-next): * lisp/emacs-lisp/rx.el (rx-check, rx-anything) (rx-check-any-string, rx-check-any, rx-check-not, rx-=) (rx-repeat, rx-check-backref, rx-syntax, rx-check-category) (rx-form): * lisp/emacs-lisp/smie.el (smie-config-save): * lisp/emacs-lisp/subr-x.el (internal--check-binding): * lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag): * lisp/emacs-lisp/testcover.el (testcover-1value): * lisp/emacs-lisp/timer.el (timer-event-handler): * lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments) (viper-toggle-search-style, viper-kill-buffer) (viper-brac-function): * lisp/emulation/viper-macs.el (viper-record-kbd-macro): * lisp/env.el (setenv): * lisp/erc/erc-button.el (erc-nick-popup): * lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english): * lisp/eshell/em-dirs.el (eshell/cd): * lisp/eshell/em-glob.el (eshell-glob-regexp) (eshell-glob-entries): * lisp/eshell/em-pred.el (eshell-parse-modifiers): * lisp/eshell/esh-opt.el (eshell-show-usage): * lisp/facemenu.el (facemenu-add-new-face) (facemenu-add-new-color): * lisp/faces.el (read-face-name, read-face-font, describe-face) (x-resolve-font-name): * lisp/files-x.el (modify-file-local-variable): * lisp/files.el (locate-user-emacs-file, find-alternate-file) (set-auto-mode, hack-one-local-variable--obsolete) (dir-locals-set-directory-class, write-file, basic-save-buffer) (delete-directory, copy-directory, recover-session) (recover-session-finish, insert-directory) (file-modes-char-to-who, file-modes-symbolic-to-number) (move-file-to-trash): * lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer): * lisp/find-cmd.el (find-generic, find-to-string): * lisp/finder.el (finder-commentary): * lisp/font-lock.el (font-lock-fontify-buffer): * lisp/format.el (format-write-file, format-find-file) (format-insert-file): * lisp/frame.el (get-device-terminal, select-frame-by-name): * lisp/fringe.el (fringe--check-style): * lisp/gnus/nnmairix.el (nnmairix-widget-create-query): * lisp/help-fns.el (help-fns--key-bindings) (help-fns--compiler-macro, help-fns--parent-mode) (help-fns--obsolete, help-fns--interactive-only) (describe-function-1, describe-variable): * lisp/help.el (describe-mode) (describe-minor-mode-from-indicator): * lisp/image.el (image-type): * lisp/international/ccl.el (ccl-dump): * lisp/international/fontset.el (x-must-resolve-font-name): * lisp/international/mule-cmds.el (prefer-coding-system) (select-safe-coding-system-interactively) (select-safe-coding-system, activate-input-method) (toggle-input-method, describe-current-input-method) (describe-language-environment): * lisp/international/mule-conf.el (code-offset): * lisp/international/mule-diag.el (describe-character-set) (list-input-methods-1): * lisp/mail/feedmail.el (feedmail-run-the-queue): * lisp/mouse.el (minor-mode-menu-from-indicator): * lisp/mpc.el (mpc-playlist-rename): * lisp/msb.el (msb--choose-menu): * lisp/net/ange-ftp.el (ange-ftp-shell-command): * lisp/net/imap.el (imap-interactive-login): * lisp/net/mairix.el (mairix-widget-create-query): * lisp/net/newst-backend.el (newsticker--sentinel-work): * lisp/net/newst-treeview.el (newsticker--treeview-load): * lisp/net/rlogin.el (rlogin): * lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer): * lisp/obsolete/otodo-mode.el (todo-more-important-p): * lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region): * lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region): * lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region): * lisp/org/ob-core.el (org-babel-goto-named-src-block) (org-babel-goto-named-result): * lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap): * lisp/org/ob-ref.el (org-babel-ref-resolve): * lisp/org/org-agenda.el (org-agenda-prepare): * lisp/org/org-clock.el (org-clock-notify-once-if-expired) (org-clock-resolve): * lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag): * lisp/org/org-feed.el (org-feed-parse-atom-entry): * lisp/org/org-habit.el (org-habit-parse-todo): * lisp/org/org-mouse.el (org-mouse-popup-global-menu) (org-mouse-context-menu): * lisp/org/org-table.el (org-table-edit-formulas): * lisp/org/ox.el (org-export-async-start): * lisp/proced.el (proced-log): * lisp/progmodes/ada-mode.el (ada-get-indent-case) (ada-check-matching-start, ada-goto-matching-start): * lisp/progmodes/ada-prj.el (ada-prj-display-page): * lisp/progmodes/ada-xref.el (ada-find-executable): * lisp/progmodes/ebrowse.el (ebrowse-tags-apropos): * lisp/progmodes/etags.el (etags-tags-apropos-additional): * lisp/progmodes/flymake.el (flymake-parse-err-lines) (flymake-start-syntax-check-process): * lisp/progmodes/python.el (python-shell-get-process-or-error) (python-define-auxiliary-skeleton): * lisp/progmodes/sql.el (sql-comint): * lisp/progmodes/verilog-mode.el (verilog-load-file-at-point): * lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate): * lisp/recentf.el (recentf-open-files): * lisp/replace.el (query-replace-read-from) (occur-after-change-function, occur-1): * lisp/scroll-bar.el (scroll-bar-columns): * lisp/server.el (server-get-auth-key): * lisp/simple.el (execute-extended-command) (undo-outer-limit-truncate, list-processes--refresh) (compose-mail, set-variable, choose-completion-string) (define-alternatives): * lisp/startup.el (site-run-file, tty-handle-args, command-line) (command-line-1): * lisp/subr.el (noreturn, define-error, add-to-list) (read-char-choice, version-to-list): * lisp/term/common-win.el (x-handle-xrm-switch) (x-handle-name-switch, x-handle-args): * lisp/term/x-win.el (x-handle-parent-id, x-handle-smid): * lisp/textmodes/reftex-ref.el (reftex-label): * lisp/textmodes/reftex-toc.el (reftex-toc-rename-label): * lisp/textmodes/two-column.el (2C-split): * lisp/tutorial.el (tutorial--describe-nonstandard-key) (tutorial--find-changed-keys): * lisp/type-break.el (type-break-noninteractive-query): * lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes) (wdired-do-perm-changes): * lisp/whitespace.el (whitespace-report-region): Prefer grave quoting in source-code strings used to generate help and diagnostics. * lisp/faces.el (face-documentation): No need to convert quotes, since the result is a docstring. * lisp/info.el (Info-virtual-index-find-node) (Info-virtual-index, info-apropos): Simplify by generating only curved quotes, since info files are typically that ways nowadays anyway. * lisp/international/mule-diag.el (list-input-methods): Don’t assume text quoting style is curved. * lisp/org/org-bibtex.el (org-bibtex-fields): Revert my recent changes, going back to the old quoting style.
2015-09-07 15:41:44 +00:00
"# All lines which start with a `#' will be deleted.\n")
(substitute-command-keys
(concat
"# Type \\[bookmark-edit-annotation-confirm] when done. Type "
"\\[bookmark-edit-annotation-cancel] to cancel.\n#\n"))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
"# Author: " (user-full-name) " <" (user-login-name) "@"
(system-name) ">\n"
"# Date: " (current-time-string) "\n"))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defvar bookmark-edit-annotation-text-func 'bookmark-default-annotation-text
"Function to return default text to use for a bookmark annotation.
It takes one argument, the name of the bookmark, as a string.")
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defvar-keymap bookmark-edit-annotation-mode-map
:doc "Keymap for editing an annotation of a bookmark."
:parent text-mode-map
"C-c C-c" #'bookmark-edit-annotation-confirm
"C-c C-k" #'bookmark-edit-annotation-cancel)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Use define-derived-mode (and derived-mode-p). * lisp/play/snake.el (snake-mode): * lisp/play/mpuz.el (mpuz-mode): * lisp/play/landmark.el (lm-mode): * lisp/play/blackbox.el (blackbox-mode): * lisp/play/5x5.el (5x5-mode): * lisp/obsolete/options.el (Edit-options-mode): * lisp/net/quickurl.el (quickurl-list-mode): * lisp/net/newst-treeview.el (newsticker-treeview-mode): * lisp/mail/rmailsum.el (rmail-summary-mode): * lisp/mail/mspools.el (mspools-mode): * lisp/locate.el (locate-mode): * lisp/ibuffer.el (ibuffer-mode): * lisp/emulation/ws-mode.el (wordstar-mode): * lisp/emacs-lisp/debug.el (debugger-mode): * lisp/array.el (array-mode): * lisp/net/eudc.el (eudc-mode): Use define-derived-mode. * lisp/net/mairix.el (mairix-searches-mode-font-lock-keywords): Move initialization into declaration. (mairix-searches-mode): Use define-derived-mode. * lisp/net/eudc-hotlist.el (eudc-hotlist-mode): Use define-derived-mode. (eudc-edit-hotlist): Use dolist. * lisp/man.el (Man-mode-syntax-table): Rename from man-mode-syntax-table. (Man-mode): Use define-derived-mode. * lisp/info.el (Info-edit-mode-map): Rename from Info-edit-map. (Info-edit-mode): Use define-derived-mode. (Info-cease-edit): Use Info-mode. * lisp/eshell/esh-mode.el (eshell-mode-syntax-table): Move initialization into declaration. (eshell-mode): Use define-derived-mode. * lisp/chistory.el (command-history-mode-map): Rename from command-history-map. (command-history-mode): Use define-derived-mode. * lisp/calc/calc.el (calc-trail-mode-map): New var. (calc-trail-mode): Use define-derived-mode. (calc-trail-buffer): Set calc-main-buffer manually. * lisp/bookmark.el (bookmark-insert-annotation): New function. (bookmark-edit-annotation): Use it. (bookmark-edit-annotation-mode): Make it a proper major mode. (bookmark-send-edited-annotation): Use derived-mode-p. * lisp/arc-mode.el (archive-mode): Move kill-all-local-variables a tiny bit closer to its ideal place. Use \' to match EOS. * lisp/cedet/semantic/grammar.el (semantic-grammar-mode): Use define-derived-mode. (semantic-grammar-mode-syntax-table): Rename from semantic-grammar-syntax-table. (semantic-grammar-mode-map): Rename from semantic-grammar-map. * lisp/cedet/data-debug.el (data-debug-mode-map): Rename from data-debug-map. (data-debug-mode): Use define-derived-mode. * lisp/gnus/score-mode.el (gnus-score-mode-map): Move initialization into declaration. (gnus-score-mode): Use define-derived-mode. * lisp/gnus/gnus-srvr.el (gnus-browse-mode): Use define-derived-mode. * lisp/gnus/gnus-kill.el (gnus-kill-file-mode-map): Move initialization into declaration. (gnus-kill-file-mode): Use define-derived-mode. (gnus-kill-file-edit-file, gnus-kill-file-enter-kill, gnus-kill): Use derived-mode-p. * lisp/gnus/gnus-group.el (gnus-group-mode): Use define-derived-mode. (gnus-group-setup-buffer, gnus-group-name-at-point) (gnus-group-make-web-group, gnus-group-enter-directory) (gnus-group-suspend): Use derived-mode-p. * lisp/gnus/gnus-cus.el (gnus-custom-mode): Use define-derived-mode. * lisp/gnus/gnus-bookmark.el (gnus-bookmark-bmenu-mode): Use define-derived-mode. * lisp/gnus/gnus-art.el (gnus-article-mode): Use define-derived-mode. (gnus-article-setup-buffer, gnus-article-prepare) (gnus-article-prepare-display, gnus-sticky-article) (gnus-kill-sticky-article-buffer, gnus-kill-sticky-article-buffers) (gnus-bind-safe-url-regexp, gnus-article-check-buffer) (gnus-article-read-summary-keys): Use derived-mode-p.
2013-09-11 03:31:56 +00:00
(defun bookmark-insert-annotation (bookmark-name-or-record)
"Insert annotation for BOOKMARK-NAME-OR-RECORD at point."
(when (not (bookmark-get-bookmark bookmark-name-or-record t))
(error "Invalid bookmark: %s" bookmark-name-or-record))
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(insert (funcall bookmark-edit-annotation-text-func bookmark-name-or-record))
(let ((annotation (bookmark-get-annotation bookmark-name-or-record)))
(bookmark-load): Use `bookmark-import-new-list' to load the new list carefully, renaming bookmarks as necessary. In docstring, mention new renaming behavior. Optional arg OVERWRITE replaces inaccurately-named REVERT. If file loaded was bookmark-default-file, then set bookmarks-already-loaded to t. (bookmark-import-new-list): New func. (bookmark-maybe-rename): New func, helper to above. (bookmark-set-name): Accept bookmark as either string (behaves same as before) or list (treat it as a bookmark record). (bookmark-set, bookmark-maybe-load-default-file) (bookmark-jump-noselect, bookmark-rename) (bookmark-show-annotation): Discard pointless `progn's. (bookmark-bmenu-mark, bookmark-bmenu-unmark) (bookmark-bmenu-backup-unmark, bookmark-bmenu-delete-backwards): Renormalize position after all else is done. (bookmark-edit-annotation-mode, bookmark-bmenu-list) (bookmark-show-annotation, bookmark-show-all-annotations): Use `x' instead of `(not (eq x nil))'. (bookmark-yank-word): Inner save-excursion changed to progn. (bookmark-send-annotation, bookmark-send-edited-annotation) (bookmark-insert): Use buffer-string instead of buffer-substring. (bookmark-make-cell): Make sure annotation and info-node strings contain no text properties. (bookmark-relocate): Remember to rebuild bmenu buffer after a bookmark has been relocated. (bookmark-bmenu-check-position): Return a meaningful value -- callers have apparently been assuming this anyway. (bookmark-build-xemacs-menu): Unused function deleted. (bookmark-version): Removed this variable; the Emacs version suffices.
1997-08-22 19:14:10 +00:00
(if (and annotation (not (string-equal annotation "")))
Use define-derived-mode (and derived-mode-p). * lisp/play/snake.el (snake-mode): * lisp/play/mpuz.el (mpuz-mode): * lisp/play/landmark.el (lm-mode): * lisp/play/blackbox.el (blackbox-mode): * lisp/play/5x5.el (5x5-mode): * lisp/obsolete/options.el (Edit-options-mode): * lisp/net/quickurl.el (quickurl-list-mode): * lisp/net/newst-treeview.el (newsticker-treeview-mode): * lisp/mail/rmailsum.el (rmail-summary-mode): * lisp/mail/mspools.el (mspools-mode): * lisp/locate.el (locate-mode): * lisp/ibuffer.el (ibuffer-mode): * lisp/emulation/ws-mode.el (wordstar-mode): * lisp/emacs-lisp/debug.el (debugger-mode): * lisp/array.el (array-mode): * lisp/net/eudc.el (eudc-mode): Use define-derived-mode. * lisp/net/mairix.el (mairix-searches-mode-font-lock-keywords): Move initialization into declaration. (mairix-searches-mode): Use define-derived-mode. * lisp/net/eudc-hotlist.el (eudc-hotlist-mode): Use define-derived-mode. (eudc-edit-hotlist): Use dolist. * lisp/man.el (Man-mode-syntax-table): Rename from man-mode-syntax-table. (Man-mode): Use define-derived-mode. * lisp/info.el (Info-edit-mode-map): Rename from Info-edit-map. (Info-edit-mode): Use define-derived-mode. (Info-cease-edit): Use Info-mode. * lisp/eshell/esh-mode.el (eshell-mode-syntax-table): Move initialization into declaration. (eshell-mode): Use define-derived-mode. * lisp/chistory.el (command-history-mode-map): Rename from command-history-map. (command-history-mode): Use define-derived-mode. * lisp/calc/calc.el (calc-trail-mode-map): New var. (calc-trail-mode): Use define-derived-mode. (calc-trail-buffer): Set calc-main-buffer manually. * lisp/bookmark.el (bookmark-insert-annotation): New function. (bookmark-edit-annotation): Use it. (bookmark-edit-annotation-mode): Make it a proper major mode. (bookmark-send-edited-annotation): Use derived-mode-p. * lisp/arc-mode.el (archive-mode): Move kill-all-local-variables a tiny bit closer to its ideal place. Use \' to match EOS. * lisp/cedet/semantic/grammar.el (semantic-grammar-mode): Use define-derived-mode. (semantic-grammar-mode-syntax-table): Rename from semantic-grammar-syntax-table. (semantic-grammar-mode-map): Rename from semantic-grammar-map. * lisp/cedet/data-debug.el (data-debug-mode-map): Rename from data-debug-map. (data-debug-mode): Use define-derived-mode. * lisp/gnus/score-mode.el (gnus-score-mode-map): Move initialization into declaration. (gnus-score-mode): Use define-derived-mode. * lisp/gnus/gnus-srvr.el (gnus-browse-mode): Use define-derived-mode. * lisp/gnus/gnus-kill.el (gnus-kill-file-mode-map): Move initialization into declaration. (gnus-kill-file-mode): Use define-derived-mode. (gnus-kill-file-edit-file, gnus-kill-file-enter-kill, gnus-kill): Use derived-mode-p. * lisp/gnus/gnus-group.el (gnus-group-mode): Use define-derived-mode. (gnus-group-setup-buffer, gnus-group-name-at-point) (gnus-group-make-web-group, gnus-group-enter-directory) (gnus-group-suspend): Use derived-mode-p. * lisp/gnus/gnus-cus.el (gnus-custom-mode): Use define-derived-mode. * lisp/gnus/gnus-bookmark.el (gnus-bookmark-bmenu-mode): Use define-derived-mode. * lisp/gnus/gnus-art.el (gnus-article-mode): Use define-derived-mode. (gnus-article-setup-buffer, gnus-article-prepare) (gnus-article-prepare-display, gnus-sticky-article) (gnus-kill-sticky-article-buffer, gnus-kill-sticky-article-buffers) (gnus-bind-safe-url-regexp, gnus-article-check-buffer) (gnus-article-read-summary-keys): Use derived-mode-p.
2013-09-11 03:31:56 +00:00
(insert annotation))))
(define-derived-mode bookmark-edit-annotation-mode
text-mode "Edit Bookmark Annotation"
"Mode for editing the annotation of bookmarks.
\\<bookmark-edit-annotation-mode-map>\
When you have finished composing, type \\[bookmark-edit-annotation-confirm] \
or \\[bookmark-edit-annotation-cancel] to cancel.
Use define-derived-mode (and derived-mode-p). * lisp/play/snake.el (snake-mode): * lisp/play/mpuz.el (mpuz-mode): * lisp/play/landmark.el (lm-mode): * lisp/play/blackbox.el (blackbox-mode): * lisp/play/5x5.el (5x5-mode): * lisp/obsolete/options.el (Edit-options-mode): * lisp/net/quickurl.el (quickurl-list-mode): * lisp/net/newst-treeview.el (newsticker-treeview-mode): * lisp/mail/rmailsum.el (rmail-summary-mode): * lisp/mail/mspools.el (mspools-mode): * lisp/locate.el (locate-mode): * lisp/ibuffer.el (ibuffer-mode): * lisp/emulation/ws-mode.el (wordstar-mode): * lisp/emacs-lisp/debug.el (debugger-mode): * lisp/array.el (array-mode): * lisp/net/eudc.el (eudc-mode): Use define-derived-mode. * lisp/net/mairix.el (mairix-searches-mode-font-lock-keywords): Move initialization into declaration. (mairix-searches-mode): Use define-derived-mode. * lisp/net/eudc-hotlist.el (eudc-hotlist-mode): Use define-derived-mode. (eudc-edit-hotlist): Use dolist. * lisp/man.el (Man-mode-syntax-table): Rename from man-mode-syntax-table. (Man-mode): Use define-derived-mode. * lisp/info.el (Info-edit-mode-map): Rename from Info-edit-map. (Info-edit-mode): Use define-derived-mode. (Info-cease-edit): Use Info-mode. * lisp/eshell/esh-mode.el (eshell-mode-syntax-table): Move initialization into declaration. (eshell-mode): Use define-derived-mode. * lisp/chistory.el (command-history-mode-map): Rename from command-history-map. (command-history-mode): Use define-derived-mode. * lisp/calc/calc.el (calc-trail-mode-map): New var. (calc-trail-mode): Use define-derived-mode. (calc-trail-buffer): Set calc-main-buffer manually. * lisp/bookmark.el (bookmark-insert-annotation): New function. (bookmark-edit-annotation): Use it. (bookmark-edit-annotation-mode): Make it a proper major mode. (bookmark-send-edited-annotation): Use derived-mode-p. * lisp/arc-mode.el (archive-mode): Move kill-all-local-variables a tiny bit closer to its ideal place. Use \' to match EOS. * lisp/cedet/semantic/grammar.el (semantic-grammar-mode): Use define-derived-mode. (semantic-grammar-mode-syntax-table): Rename from semantic-grammar-syntax-table. (semantic-grammar-mode-map): Rename from semantic-grammar-map. * lisp/cedet/data-debug.el (data-debug-mode-map): Rename from data-debug-map. (data-debug-mode): Use define-derived-mode. * lisp/gnus/score-mode.el (gnus-score-mode-map): Move initialization into declaration. (gnus-score-mode): Use define-derived-mode. * lisp/gnus/gnus-srvr.el (gnus-browse-mode): Use define-derived-mode. * lisp/gnus/gnus-kill.el (gnus-kill-file-mode-map): Move initialization into declaration. (gnus-kill-file-mode): Use define-derived-mode. (gnus-kill-file-edit-file, gnus-kill-file-enter-kill, gnus-kill): Use derived-mode-p. * lisp/gnus/gnus-group.el (gnus-group-mode): Use define-derived-mode. (gnus-group-setup-buffer, gnus-group-name-at-point) (gnus-group-make-web-group, gnus-group-enter-directory) (gnus-group-suspend): Use derived-mode-p. * lisp/gnus/gnus-cus.el (gnus-custom-mode): Use define-derived-mode. * lisp/gnus/gnus-bookmark.el (gnus-bookmark-bmenu-mode): Use define-derived-mode. * lisp/gnus/gnus-art.el (gnus-article-mode): Use define-derived-mode. (gnus-article-setup-buffer, gnus-article-prepare) (gnus-article-prepare-display, gnus-sticky-article) (gnus-kill-sticky-article-buffer, gnus-kill-sticky-article-buffers) (gnus-bind-safe-url-regexp, gnus-article-check-buffer) (gnus-article-read-summary-keys): Use derived-mode-p.
2013-09-11 03:31:56 +00:00
\\{bookmark-edit-annotation-mode-map}")
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defmacro bookmark-edit-annotation--maybe-display-list (&rest body)
"Display bookmark list after editing if appropriate."
`(let ((from-bookmark-list bookmark--annotation-from-bookmark-list)
(old-buffer (current-buffer)))
,@body
(quit-window)
(bookmark-bmenu-surreptitiously-rebuild-list)
(when from-bookmark-list
(pop-to-buffer (get-buffer bookmark-bmenu-buffer))
(goto-char (point-min))
(bookmark-bmenu-bookmark))
(kill-buffer old-buffer)))
(defun bookmark-edit-annotation-cancel ()
"Cancel the current annotation edit."
(interactive nil bookmark-edit-annotation-mode)
(bookmark-edit-annotation--maybe-display-list
(message "Canceled by user")))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-edit-annotation-confirm ()
"Use buffer contents as annotation for a bookmark.
Lines beginning with `#' are ignored."
(interactive nil bookmark-edit-annotation-mode)
Use define-derived-mode (and derived-mode-p). * lisp/play/snake.el (snake-mode): * lisp/play/mpuz.el (mpuz-mode): * lisp/play/landmark.el (lm-mode): * lisp/play/blackbox.el (blackbox-mode): * lisp/play/5x5.el (5x5-mode): * lisp/obsolete/options.el (Edit-options-mode): * lisp/net/quickurl.el (quickurl-list-mode): * lisp/net/newst-treeview.el (newsticker-treeview-mode): * lisp/mail/rmailsum.el (rmail-summary-mode): * lisp/mail/mspools.el (mspools-mode): * lisp/locate.el (locate-mode): * lisp/ibuffer.el (ibuffer-mode): * lisp/emulation/ws-mode.el (wordstar-mode): * lisp/emacs-lisp/debug.el (debugger-mode): * lisp/array.el (array-mode): * lisp/net/eudc.el (eudc-mode): Use define-derived-mode. * lisp/net/mairix.el (mairix-searches-mode-font-lock-keywords): Move initialization into declaration. (mairix-searches-mode): Use define-derived-mode. * lisp/net/eudc-hotlist.el (eudc-hotlist-mode): Use define-derived-mode. (eudc-edit-hotlist): Use dolist. * lisp/man.el (Man-mode-syntax-table): Rename from man-mode-syntax-table. (Man-mode): Use define-derived-mode. * lisp/info.el (Info-edit-mode-map): Rename from Info-edit-map. (Info-edit-mode): Use define-derived-mode. (Info-cease-edit): Use Info-mode. * lisp/eshell/esh-mode.el (eshell-mode-syntax-table): Move initialization into declaration. (eshell-mode): Use define-derived-mode. * lisp/chistory.el (command-history-mode-map): Rename from command-history-map. (command-history-mode): Use define-derived-mode. * lisp/calc/calc.el (calc-trail-mode-map): New var. (calc-trail-mode): Use define-derived-mode. (calc-trail-buffer): Set calc-main-buffer manually. * lisp/bookmark.el (bookmark-insert-annotation): New function. (bookmark-edit-annotation): Use it. (bookmark-edit-annotation-mode): Make it a proper major mode. (bookmark-send-edited-annotation): Use derived-mode-p. * lisp/arc-mode.el (archive-mode): Move kill-all-local-variables a tiny bit closer to its ideal place. Use \' to match EOS. * lisp/cedet/semantic/grammar.el (semantic-grammar-mode): Use define-derived-mode. (semantic-grammar-mode-syntax-table): Rename from semantic-grammar-syntax-table. (semantic-grammar-mode-map): Rename from semantic-grammar-map. * lisp/cedet/data-debug.el (data-debug-mode-map): Rename from data-debug-map. (data-debug-mode): Use define-derived-mode. * lisp/gnus/score-mode.el (gnus-score-mode-map): Move initialization into declaration. (gnus-score-mode): Use define-derived-mode. * lisp/gnus/gnus-srvr.el (gnus-browse-mode): Use define-derived-mode. * lisp/gnus/gnus-kill.el (gnus-kill-file-mode-map): Move initialization into declaration. (gnus-kill-file-mode): Use define-derived-mode. (gnus-kill-file-edit-file, gnus-kill-file-enter-kill, gnus-kill): Use derived-mode-p. * lisp/gnus/gnus-group.el (gnus-group-mode): Use define-derived-mode. (gnus-group-setup-buffer, gnus-group-name-at-point) (gnus-group-make-web-group, gnus-group-enter-directory) (gnus-group-suspend): Use derived-mode-p. * lisp/gnus/gnus-cus.el (gnus-custom-mode): Use define-derived-mode. * lisp/gnus/gnus-bookmark.el (gnus-bookmark-bmenu-mode): Use define-derived-mode. * lisp/gnus/gnus-art.el (gnus-article-mode): Use define-derived-mode. (gnus-article-setup-buffer, gnus-article-prepare) (gnus-article-prepare-display, gnus-sticky-article) (gnus-kill-sticky-article-buffer, gnus-kill-sticky-article-buffers) (gnus-bind-safe-url-regexp, gnus-article-check-buffer) (gnus-article-read-summary-keys): Use derived-mode-p.
2013-09-11 03:31:56 +00:00
(if (not (derived-mode-p 'bookmark-edit-annotation-mode))
(error "Not in bookmark-edit-annotation-mode"))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(goto-char (point-min))
(while (< (point) (point-max))
(if (= (following-char) ?#)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(bookmark-kill-line t)
(forward-line 1)))
;; Take no chances with text properties.
(bookmark-edit-annotation--maybe-display-list
(let ((annotation (buffer-substring-no-properties (point-min) (point-max)))
(bookmark-name bookmark-annotation-name))
(bookmark-set-annotation bookmark-name annotation)
(bookmark-update-last-modified bookmark-name)
(setq bookmark-alist-modification-count
(1+ bookmark-alist-modification-count))
(message "Annotation updated for \"%s\"" bookmark-name))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-edit-annotation (bookmark-name-or-record &optional from-bookmark-list)
"Pop up a buffer for editing bookmark BOOKMARK-NAME-OR-RECORD's annotation.
If optional argument FROM-BOOKMARK-LIST is non-nil, return to the
bookmark list when editing is done."
(pop-to-buffer (generate-new-buffer-name "*Bookmark Annotation Compose*"))
Use define-derived-mode (and derived-mode-p). * lisp/play/snake.el (snake-mode): * lisp/play/mpuz.el (mpuz-mode): * lisp/play/landmark.el (lm-mode): * lisp/play/blackbox.el (blackbox-mode): * lisp/play/5x5.el (5x5-mode): * lisp/obsolete/options.el (Edit-options-mode): * lisp/net/quickurl.el (quickurl-list-mode): * lisp/net/newst-treeview.el (newsticker-treeview-mode): * lisp/mail/rmailsum.el (rmail-summary-mode): * lisp/mail/mspools.el (mspools-mode): * lisp/locate.el (locate-mode): * lisp/ibuffer.el (ibuffer-mode): * lisp/emulation/ws-mode.el (wordstar-mode): * lisp/emacs-lisp/debug.el (debugger-mode): * lisp/array.el (array-mode): * lisp/net/eudc.el (eudc-mode): Use define-derived-mode. * lisp/net/mairix.el (mairix-searches-mode-font-lock-keywords): Move initialization into declaration. (mairix-searches-mode): Use define-derived-mode. * lisp/net/eudc-hotlist.el (eudc-hotlist-mode): Use define-derived-mode. (eudc-edit-hotlist): Use dolist. * lisp/man.el (Man-mode-syntax-table): Rename from man-mode-syntax-table. (Man-mode): Use define-derived-mode. * lisp/info.el (Info-edit-mode-map): Rename from Info-edit-map. (Info-edit-mode): Use define-derived-mode. (Info-cease-edit): Use Info-mode. * lisp/eshell/esh-mode.el (eshell-mode-syntax-table): Move initialization into declaration. (eshell-mode): Use define-derived-mode. * lisp/chistory.el (command-history-mode-map): Rename from command-history-map. (command-history-mode): Use define-derived-mode. * lisp/calc/calc.el (calc-trail-mode-map): New var. (calc-trail-mode): Use define-derived-mode. (calc-trail-buffer): Set calc-main-buffer manually. * lisp/bookmark.el (bookmark-insert-annotation): New function. (bookmark-edit-annotation): Use it. (bookmark-edit-annotation-mode): Make it a proper major mode. (bookmark-send-edited-annotation): Use derived-mode-p. * lisp/arc-mode.el (archive-mode): Move kill-all-local-variables a tiny bit closer to its ideal place. Use \' to match EOS. * lisp/cedet/semantic/grammar.el (semantic-grammar-mode): Use define-derived-mode. (semantic-grammar-mode-syntax-table): Rename from semantic-grammar-syntax-table. (semantic-grammar-mode-map): Rename from semantic-grammar-map. * lisp/cedet/data-debug.el (data-debug-mode-map): Rename from data-debug-map. (data-debug-mode): Use define-derived-mode. * lisp/gnus/score-mode.el (gnus-score-mode-map): Move initialization into declaration. (gnus-score-mode): Use define-derived-mode. * lisp/gnus/gnus-srvr.el (gnus-browse-mode): Use define-derived-mode. * lisp/gnus/gnus-kill.el (gnus-kill-file-mode-map): Move initialization into declaration. (gnus-kill-file-mode): Use define-derived-mode. (gnus-kill-file-edit-file, gnus-kill-file-enter-kill, gnus-kill): Use derived-mode-p. * lisp/gnus/gnus-group.el (gnus-group-mode): Use define-derived-mode. (gnus-group-setup-buffer, gnus-group-name-at-point) (gnus-group-make-web-group, gnus-group-enter-directory) (gnus-group-suspend): Use derived-mode-p. * lisp/gnus/gnus-cus.el (gnus-custom-mode): Use define-derived-mode. * lisp/gnus/gnus-bookmark.el (gnus-bookmark-bmenu-mode): Use define-derived-mode. * lisp/gnus/gnus-art.el (gnus-article-mode): Use define-derived-mode. (gnus-article-setup-buffer, gnus-article-prepare) (gnus-article-prepare-display, gnus-sticky-article) (gnus-kill-sticky-article-buffer, gnus-kill-sticky-article-buffers) (gnus-bind-safe-url-regexp, gnus-article-check-buffer) (gnus-article-read-summary-keys): Use derived-mode-p.
2013-09-11 03:31:56 +00:00
(bookmark-edit-annotation-mode)
(bookmark-insert-annotation bookmark-name-or-record)
(setq bookmark--annotation-from-bookmark-list from-bookmark-list)
(setq bookmark-annotation-name bookmark-name-or-record))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
1993-08-10 20:35:31 +00:00
(defun bookmark-buffer-name ()
"Return the name of the current buffer in a form usable as a bookmark name.
If the buffer is associated with a file or directory, use that name."
(cond
;; Or are we a file?
(buffer-file-name (file-name-nondirectory buffer-file-name))
;; Or are we a directory?
((and (boundp 'dired-directory) dired-directory)
(let* ((dirname (if (stringp dired-directory)
dired-directory
(car dired-directory)))
(idx (1- (length dirname))))
;; Strip the trailing slash.
(if (= ?/ (aref dirname idx))
(file-name-nondirectory (substring dirname 0 idx))
;; Else return the current-buffer
(buffer-name (current-buffer)))))
;; If all else fails, use the buffer's name.
(t
(buffer-name (current-buffer)))))
1993-08-10 20:35:31 +00:00
(defun bookmark-yank-word ()
"Get the next word from buffer `bookmark-current-buffer' and append
it to the name of the bookmark currently being set, advancing
`bookmark-yank-point' by one word."
1993-08-10 20:35:31 +00:00
(interactive)
(let ((string (with-current-buffer bookmark-current-buffer
(goto-char bookmark-yank-point)
(buffer-substring-no-properties
(point)
(progn
(forward-word 1)
(setq bookmark-yank-point (point)))))))
1993-08-10 20:35:31 +00:00
(insert string)))
(defun bookmark-buffer-file-name ()
2008-03-13 01:57:05 +00:00
"Return the current buffer's file in a way useful for bookmarks."
;; Abbreviate the path, both so it's shorter and so it's more
;; portable. E.g., the user's home dir might be a different
;; path on different machines, but "~/" will still reach it.
* align.el: * allout.el: * apropos.el: * arc-mode.el: * autoinsert.el: * avoid.el: * battery.el: * bookmark.el: * buff-menu.el: * calculator.el: * chistory.el: * cmuscheme.el: * comint.el: * compare-w.el: * dabbrev.el: * delim-col.el: * desktop.el: * diff-mode.el: * diff.el: * dired-aux.el: * dired-x.el: * dired.el: * dos-vars.el: * ediff-diff.el: * ediff-help.el: * ediff-init.el: * ediff-merg.el: * ediff-mult.el: * ediff-ptch.el: * ediff-vers.el: * ediff-wind.el: * ediff.el: * emerge.el: * facemenu.el: * faces.el: * ffap.el: * filecache.el: * find-dired.el: * font-core.el: * font-lock.el: * forms.el: * fringe.el: * help-at-pt.el: * hippie-exp.el: * ido.el: * image-file.el: * imenu.el: * indent.el: * info.el: * isearchb.el: * iswitchb.el: * jit-lock.el: * jka-compr.el: * log-edit.el: * lpr.el: * ls-lisp.el: * man.el: * menu-bar.el: * midnight.el: * mouse-sel.el: * mouse.el: * msb.el: * outline.el: * paren.el: * pcmpl-cvs.el: * pcmpl-gnu.el: * pcomplete.el: * pcvs-info.el: * pcvs-parse.el: * printing.el: * ps-mule.el: * ps-print.el: * replace.el: * ruler-mode.el: * saveplace.el: * sb-image.el: * scroll-bar.el: * sha1.el: * shadowfile.el: * shell.el: * sort.el: * speedbar.el: * strokes.el: * tempo.el: * term.el: * terminal.el: * time-stamp.el: * time.el: * tree-widget.el: * type-break.el: * vc-cvs.el: * vc-hg.el: * vc-mcvs.el: * vc-rcs.el: * vc-sccs.el: * vc.el: * view.el: * w32-vars.el: * whitespace.el: * wid-edit.el: Remove leading * from docstrings of defcustoms, deffaces, defconsts and defuns.
2008-12-03 05:48:14 +00:00
(abbreviate-file-name
(cond
(buffer-file-name buffer-file-name)
((and (boundp 'dired-directory) dired-directory)
(if (stringp dired-directory)
dired-directory
(car dired-directory)))
((and (boundp 'Info-current-file) (stringp Info-current-file))
Info-current-file)
(t (error "Buffer not visiting a file or directory")))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defvar bookmark--watch-already-asked-mtime nil
"Mtime for which we already queried about reloading.")
(defun bookmark--watch-file-already-queried-p (new-mtime)
;; Don't ask repeatedly if user already said "no" to reloading a
;; file with this mtime:
(prog1 (time-equal-p new-mtime bookmark--watch-already-asked-mtime)
(setq bookmark--watch-already-asked-mtime new-mtime)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-maybe-load-default-file ()
* bookmark.el (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-set-name, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-location, bookmark-jump, bookmark-jump-other-window, bookmark-handle-bookmark, bookmark-relocate, bookmark-insert-location, bookmark-rename, bookmark-insert, bookmark-delete, bookmark-time-to-save-p, bookmark-edit-annotation-mode, bookmark-edit-annotation): Improve doc strings to say whether bookmark can be a string or a record or both, and make other consistency and clarity fixes. (bookmark-get-handler, bookmark--jump-via, bookmark-write-file, bookmark-default-annotation-text, bookmark-yank-word, bookmark-maybe-load-default-file, bookmark-maybe-sort-alist, bookmark-import-new-list, bookmark-maybe-rename, bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames, bookmark-bmenu-bookmark): Give these doc strings. (bookmark-bmenu-check-position): Give this a doc string, but also add a FIXME comment about how the function may be pointless. (bookmark-default-handler): Rework doc string and change a parameter name, to clarify that this takes a bookmark record not a bookmark name. (bookmark-set): Change a parameter name to indicate its meaning, and improve the doc string a bit. (Bug#4188)
2009-10-05 01:35:34 +00:00
"If bookmarks have not been loaded from the default place, load them."
(cond ((and (not bookmark-bookmarks-timestamp)
(null bookmark-alist)
(file-readable-p bookmark-default-file)
(bookmark-load bookmark-default-file t t)))
((and bookmark-watch-bookmark-file
(let ((new-mtime (nth 5 (file-attributes
(car bookmark-bookmarks-timestamp))))
(old-mtime (cdr bookmark-bookmarks-timestamp)))
(and (not (time-equal-p new-mtime old-mtime))
(not (bookmark--watch-file-already-queried-p new-mtime))
(or (eq 'silent bookmark-watch-bookmark-file)
(yes-or-no-p
(format "Bookmarks %s changed on disk. Reload? "
(car bookmark-bookmarks-timestamp)))))))
(bookmark-load (car bookmark-bookmarks-timestamp) t t))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defvar bookmark-after-jump-hook nil
"Hook run after `bookmark-jump' jumps to a bookmark.
Useful for example to unhide text in `outline-mode'.")
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark--jump-via (bookmark-name-or-record display-function)
"Handle BOOKMARK-NAME-OR-RECORD, then call DISPLAY-FUNCTION.
DISPLAY-FUNCTION is called with the current buffer as argument.
* bookmark.el (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-set-name, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-location, bookmark-jump, bookmark-jump-other-window, bookmark-handle-bookmark, bookmark-relocate, bookmark-insert-location, bookmark-rename, bookmark-insert, bookmark-delete, bookmark-time-to-save-p, bookmark-edit-annotation-mode, bookmark-edit-annotation): Improve doc strings to say whether bookmark can be a string or a record or both, and make other consistency and clarity fixes. (bookmark-get-handler, bookmark--jump-via, bookmark-write-file, bookmark-default-annotation-text, bookmark-yank-word, bookmark-maybe-load-default-file, bookmark-maybe-sort-alist, bookmark-import-new-list, bookmark-maybe-rename, bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames, bookmark-bmenu-bookmark): Give these doc strings. (bookmark-bmenu-check-position): Give this a doc string, but also add a FIXME comment about how the function may be pointless. (bookmark-default-handler): Rework doc string and change a parameter name, to clarify that this takes a bookmark record not a bookmark name. (bookmark-set): Change a parameter name to indicate its meaning, and improve the doc string a bit. (Bug#4188)
2009-10-05 01:35:34 +00:00
After calling DISPLAY-FUNCTION, set window point to the point specified
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
by BOOKMARK-NAME-OR-RECORD, if necessary, run `bookmark-after-jump-hook',
and then show any annotations for this bookmark."
(bookmark-handle-bookmark bookmark-name-or-record)
;; Store `point' now, because `display-function' might change it.
(let ((point (point)))
(save-current-buffer
(funcall display-function (current-buffer)))
(let ((win (get-buffer-window (current-buffer) 0)))
(if win (set-window-point win point))))
;; FIXME: we used to only run bookmark-after-jump-hook in
;; `bookmark-jump' itself, but in none of the other commands.
(when bookmark-fringe-mark
(let ((overlays (overlays-in (pos-bol) (1+ (pos-bol))))
temp found)
(while (and (not found) (setq temp (pop overlays)))
(when (eq 'bookmark (overlay-get temp 'category))
(setq found t)))
(unless found
(bookmark--set-fringe-mark))))
(run-hooks 'bookmark-after-jump-hook)
(if bookmark-automatically-show-annotations
;; if there is an annotation for this bookmark,
;; show it in a buffer.
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(bookmark-show-annotation bookmark-name-or-record)))
;;;###autoload
(defun bookmark-jump (bookmark &optional display-func)
2001-01-12 22:49:40 +00:00
"Jump to bookmark BOOKMARK (a point in some file).
1993-08-14 19:49:27 +00:00
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.
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
If the file pointed to by BOOKMARK no longer exists, you will be asked
if you wish to give the bookmark a new location, and `bookmark-jump'
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
will then jump to the new location, as well as recording it in place
* bookmark.el (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-set-name, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-location, bookmark-jump, bookmark-jump-other-window, bookmark-handle-bookmark, bookmark-relocate, bookmark-insert-location, bookmark-rename, bookmark-insert, bookmark-delete, bookmark-time-to-save-p, bookmark-edit-annotation-mode, bookmark-edit-annotation): Improve doc strings to say whether bookmark can be a string or a record or both, and make other consistency and clarity fixes. (bookmark-get-handler, bookmark--jump-via, bookmark-write-file, bookmark-default-annotation-text, bookmark-yank-word, bookmark-maybe-load-default-file, bookmark-maybe-sort-alist, bookmark-import-new-list, bookmark-maybe-rename, bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames, bookmark-bmenu-bookmark): Give these doc strings. (bookmark-bmenu-check-position): Give this a doc string, but also add a FIXME comment about how the function may be pointless. (bookmark-default-handler): Rework doc string and change a parameter name, to clarify that this takes a bookmark record not a bookmark name. (bookmark-set): Change a parameter name to indicate its meaning, and improve the doc string a bit. (Bug#4188)
2009-10-05 01:35:34 +00:00
of the old one in the permanent bookmark record.
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
BOOKMARK is usually a bookmark name (a string). It can also be a
bookmark record, but this is usually only done by programmatic callers.
If DISPLAY-FUNC is non-nil, it is a function to invoke to display the
bookmark. It defaults to `pop-to-buffer-same-window'. A typical value for
DISPLAY-FUNC would be `switch-to-buffer-other-window'."
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(interactive
(list (bookmark-completing-read "Jump to bookmark"
bookmark-current-bookmark)))
(unless bookmark
(error "No bookmark specified"))
(bookmark-maybe-historicize-string bookmark)
;; Don't use `switch-to-buffer' because it would let the
;; window-point override the bookmark's point when
;; `switch-to-buffer-preserve-window-point' is non-nil.
(bookmark--jump-via bookmark (or display-func 'pop-to-buffer-same-window)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;;###autoload
(defun bookmark-jump-other-window (bookmark)
* bookmark.el (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-set-name, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-location, bookmark-jump, bookmark-jump-other-window, bookmark-handle-bookmark, bookmark-relocate, bookmark-insert-location, bookmark-rename, bookmark-insert, bookmark-delete, bookmark-time-to-save-p, bookmark-edit-annotation-mode, bookmark-edit-annotation): Improve doc strings to say whether bookmark can be a string or a record or both, and make other consistency and clarity fixes. (bookmark-get-handler, bookmark--jump-via, bookmark-write-file, bookmark-default-annotation-text, bookmark-yank-word, bookmark-maybe-load-default-file, bookmark-maybe-sort-alist, bookmark-import-new-list, bookmark-maybe-rename, bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames, bookmark-bmenu-bookmark): Give these doc strings. (bookmark-bmenu-check-position): Give this a doc string, but also add a FIXME comment about how the function may be pointless. (bookmark-default-handler): Rework doc string and change a parameter name, to clarify that this takes a bookmark record not a bookmark name. (bookmark-set): Change a parameter name to indicate its meaning, and improve the doc string a bit. (Bug#4188)
2009-10-05 01:35:34 +00:00
"Jump to BOOKMARK in another window. See `bookmark-jump' for more."
(interactive
(list (bookmark-completing-read "Jump to bookmark (in another window)"
bookmark-current-bookmark)))
(bookmark-jump bookmark 'switch-to-buffer-other-window))
;;;###autoload
(defun bookmark-jump-other-frame (bookmark)
"Jump to BOOKMARK in another frame. See `bookmark-jump' for more."
(interactive
(list (bookmark-completing-read "Jump to bookmark (in another frame)"
bookmark-current-bookmark)))
(let ((pop-up-frames t))
(bookmark-jump-other-window bookmark)))
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-handle-bookmark (bookmark-name-or-record)
"Call BOOKMARK-NAME-OR-RECORD's handler or `bookmark-default-handler'
if it has none. This changes current buffer and point and returns nil,
* lisp/simple.el (special-mode-map): Bind "h" to `describe-mode'; bind "z" to `kill-this-buffer'. (completion-list-mode-map): Bind "z" to `kill-this-buffer'. * lisp/apropos.el (apropos-mode-map): Inherit from `special-mode-map'. (apropos-mode): Inherit from `special-mode'. * lisp/arc-mode.el (archive-mode-map): Inherit from `special-mode-map'. * lisp/bookmark.el (bookmark-bmenu-mode): Define using `define-derived-mode' inheriting from `special-mode'. * lisp/dired.el (dired-mode-map): Inherit from `special-mode-map'. * lisp/image-mode.el (image-mode-map): Ditto. * lisp/replace.el (occur-mode): Define using `define-derived-mode' inheriting from `special-mode'. * lisp/tar-mode.el (tar-mode): Inherit from `special-mode'. * lisp/calendar/diary-lib.el (diary-fancy-display-mode): Inherit from `special-mode-map'. * lisp/emacs-lisp/ert.el (ert-simple-view-mode, ert-results-mode): Inherit from `special-mode'. * lisp/emacs-lisp/package.el (package-menu-mode-map): Copy from `special-mode-map'. (package-menu-mode): Define using `define-derived-mode' inheriting from `special-mode'. * erc/erc-list.el (erc-list-menu-mode): Inherit from `special-mode'. * lisp/net/xesam.el (xesam-mode): Inherit from `special-mode'. (xesam-mode-map): Define separately. * lisp/play/solitaire.el (solitaire-mode): Inherit from `special-mode'. * lisp/progmodes/compile.el (compilation-minor-mode-map) (compilation-mode-map): Inherit from `special-mode-map'. * lisp/vc/diff-mode.el (diff-mode-shared-map): Inherit from `special-mode-map'. * lisp/vc/log-view.el (log-view-mode-map): Add a comment.
2011-02-01 21:22:21 +00:00
or signals a `file-error'.
* bookmark.el (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-set-name, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-location, bookmark-jump, bookmark-jump-other-window, bookmark-handle-bookmark, bookmark-relocate, bookmark-insert-location, bookmark-rename, bookmark-insert, bookmark-delete, bookmark-time-to-save-p, bookmark-edit-annotation-mode, bookmark-edit-annotation): Improve doc strings to say whether bookmark can be a string or a record or both, and make other consistency and clarity fixes. (bookmark-get-handler, bookmark--jump-via, bookmark-write-file, bookmark-default-annotation-text, bookmark-yank-word, bookmark-maybe-load-default-file, bookmark-maybe-sort-alist, bookmark-import-new-list, bookmark-maybe-rename, bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames, bookmark-bmenu-bookmark): Give these doc strings. (bookmark-bmenu-check-position): Give this a doc string, but also add a FIXME comment about how the function may be pointless. (bookmark-default-handler): Rework doc string and change a parameter name, to clarify that this takes a bookmark record not a bookmark name. (bookmark-set): Change a parameter name to indicate its meaning, and improve the doc string a bit. (Bug#4188)
2009-10-05 01:35:34 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
If BOOKMARK-NAME-OR-RECORD has no file, this is a no-op. If
BOOKMARK-NAME-OR-RECORD has a file, but that file no longer exists,
then offer interactively to relocate BOOKMARK-NAME-OR-RECORD."
(condition-case err
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(funcall (or (bookmark-get-handler bookmark-name-or-record)
'bookmark-default-handler)
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(bookmark-get-bookmark bookmark-name-or-record))
(bookmark-error-no-filename ;file-error
;; We were unable to find the marked file, so ask if user wants to
;; relocate the bookmark, else remind them to consider deletion.
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(when (stringp bookmark-name-or-record)
;; `bookmark-name-or-record' can be either a bookmark name
;; (from `bookmark-alist') or a bookmark object. If it's an
;; object, we assume it's a bookmark used internally by some
;; other package.
(let ((file (bookmark-get-filename bookmark-name-or-record)))
(when file ;Don't know how to relocate if there's no `file'.
;; If file is not a dir, directory-file-name just returns file.
(let ((display-name (directory-file-name file)))
(ding)
;; Dialog boxes can accept a file target, but usually don't
;; know how to accept a directory target (at least, this
;; is true in Gnome on GNU/Linux, and Bug#4230 says it's
;; true on Windows as well). So we suppress file dialogs
;; when relocating.
(let ((use-dialog-box nil)
(use-file-dialog nil))
(if (y-or-n-p (concat display-name " nonexistent. Relocate \""
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
bookmark-name-or-record "\"? "))
(progn
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(bookmark-relocate bookmark-name-or-record)
;; Try again.
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(funcall (or (bookmark-get-handler bookmark-name-or-record)
'bookmark-default-handler)
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(bookmark-get-bookmark bookmark-name-or-record)))
(message
"Bookmark not relocated; consider removing it (%s)."
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
bookmark-name-or-record)
(signal (car err) (cdr err))))))))))
;; Added by db.
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(when (stringp bookmark-name-or-record)
(setq bookmark-current-bookmark bookmark-name-or-record))
nil)
(define-error 'bookmark-errors
"Bookmark error")
* lisp/subr.el (define-error): New function. * doc/lispref/control.texi (Signaling Errors): Refer to define-error. (Error Symbols): Add `define-error'. * doc/lispref/errors.texi (Standard Errors): Don't refer to `error-conditions'. * lisp/progmodes/ada-xref.el (ada-error-file-not-found): Rename from error-file-not-found and define with define-error. * lisp/emacs-lisp/cl-lib.el (cl-assertion-failed): Move here from subr.el and define with define-error. * lisp/userlock.el (file-locked, file-supersession): * lisp/simple.el (mark-inactive): * lisp/progmodes/js.el (js-moz-bad-rpc, js-js-error): * lisp/progmodes/ada-mode.el (ada-mode-errors): * lisp/play/life.el (life-extinct): * lisp/nxml/xsd-regexp.el (xsdre-invalid-regexp, xsdre-parse-error): * lisp/nxml/xmltok.el (xmltok-markup-declaration-parse-error): * lisp/nxml/rng-util.el (rng-error): * lisp/nxml/rng-uri.el (rng-uri-error): * lisp/nxml/rng-match.el (rng-compile-error): * lisp/nxml/rng-cmpct.el (rng-c-incorrect-schema): * lisp/nxml/nxml-util.el (nxml-error, nxml-file-parse-error): * lisp/nxml/nxml-rap.el (nxml-scan-error): * lisp/nxml/nxml-outln.el (nxml-outline-error): * lisp/net/soap-client.el (soap-error): * lisp/net/gnutls.el (gnutls-error): * lisp/net/ange-ftp.el (ftp-error): * lisp/mpc.el (mpc-proc-error): * lisp/json.el (json-error, json-readtable-error, json-unknown-keyword) (json-number-format, json-string-escape, json-string-format) (json-key-format, json-object-format): * lisp/jka-compr.el (compression-error): * lisp/international/quail.el (quail-error): * lisp/international/kkc.el (kkc-error): * lisp/emacs-lisp/ert.el (ert-test-failed): * lisp/calc/calc.el (calc-error, inexact-result, math-overflow) (math-underflow): * lisp/bookmark.el (bookmark-error-no-filename): * lisp/epg.el (epg-error): Define with define-error.
2013-08-09 21:22:44 +00:00
(define-error 'bookmark-error-no-filename
"Bookmark has no associated file (or directory)" 'bookmark-errors)
* bookmark.el (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-set-name, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-location, bookmark-jump, bookmark-jump-other-window, bookmark-handle-bookmark, bookmark-relocate, bookmark-insert-location, bookmark-rename, bookmark-insert, bookmark-delete, bookmark-time-to-save-p, bookmark-edit-annotation-mode, bookmark-edit-annotation): Improve doc strings to say whether bookmark can be a string or a record or both, and make other consistency and clarity fixes. (bookmark-get-handler, bookmark--jump-via, bookmark-write-file, bookmark-default-annotation-text, bookmark-yank-word, bookmark-maybe-load-default-file, bookmark-maybe-sort-alist, bookmark-import-new-list, bookmark-maybe-rename, bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames, bookmark-bmenu-bookmark): Give these doc strings. (bookmark-bmenu-check-position): Give this a doc string, but also add a FIXME comment about how the function may be pointless. (bookmark-default-handler): Rework doc string and change a parameter name, to clarify that this takes a bookmark record not a bookmark name. (bookmark-set): Change a parameter name to indicate its meaning, and improve the doc string a bit. (Bug#4188)
2009-10-05 01:35:34 +00:00
(defun bookmark-default-handler (bmk-record)
"Default handler to jump to a particular bookmark location.
* bookmark.el (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-set-name, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-location, bookmark-jump, bookmark-jump-other-window, bookmark-handle-bookmark, bookmark-relocate, bookmark-insert-location, bookmark-rename, bookmark-insert, bookmark-delete, bookmark-time-to-save-p, bookmark-edit-annotation-mode, bookmark-edit-annotation): Improve doc strings to say whether bookmark can be a string or a record or both, and make other consistency and clarity fixes. (bookmark-get-handler, bookmark--jump-via, bookmark-write-file, bookmark-default-annotation-text, bookmark-yank-word, bookmark-maybe-load-default-file, bookmark-maybe-sort-alist, bookmark-import-new-list, bookmark-maybe-rename, bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames, bookmark-bmenu-bookmark): Give these doc strings. (bookmark-bmenu-check-position): Give this a doc string, but also add a FIXME comment about how the function may be pointless. (bookmark-default-handler): Rework doc string and change a parameter name, to clarify that this takes a bookmark record not a bookmark name. (bookmark-set): Change a parameter name to indicate its meaning, and improve the doc string a bit. (Bug#4188)
2009-10-05 01:35:34 +00:00
BMK-RECORD is a bookmark record, not a bookmark name (i.e., not a string).
Changes current buffer and point and returns nil, or signals a `file-error'.
If BMK-RECORD has a property called `buffer', it should be a live
buffer object, and this buffer will be selected."
(let ((file (bookmark-get-filename bmk-record))
(buf (bookmark-prop-get bmk-record 'buffer))
(forward-str (bookmark-get-front-context-string bmk-record))
(behind-str (bookmark-get-rear-context-string bmk-record))
(place (bookmark-get-position bmk-record)))
(set-buffer
(cond
((and file (file-readable-p file) (not (buffer-live-p buf)))
(find-file-noselect file))
;; No file found. See if buffer BUF has been created.
((and buf (get-buffer buf)))
(t ;; If not, raise error.
(signal 'bookmark-error-no-filename (list 'stringp file)))))
(if place (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.
(when (and forward-str (search-forward forward-str (point-max) t))
(goto-char (match-beginning 0)))
(when (and behind-str (search-backward behind-str (point-min) t))
(goto-char (match-end 0)))
nil))
;;;###autoload
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-relocate (bookmark-name)
"Relocate BOOKMARK-NAME to another file, reading file name with minibuffer.
* bookmark.el (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-set-name, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-location, bookmark-jump, bookmark-jump-other-window, bookmark-handle-bookmark, bookmark-relocate, bookmark-insert-location, bookmark-rename, bookmark-insert, bookmark-delete, bookmark-time-to-save-p, bookmark-edit-annotation-mode, bookmark-edit-annotation): Improve doc strings to say whether bookmark can be a string or a record or both, and make other consistency and clarity fixes. (bookmark-get-handler, bookmark--jump-via, bookmark-write-file, bookmark-default-annotation-text, bookmark-yank-word, bookmark-maybe-load-default-file, bookmark-maybe-sort-alist, bookmark-import-new-list, bookmark-maybe-rename, bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames, bookmark-bmenu-bookmark): Give these doc strings. (bookmark-bmenu-check-position): Give this a doc string, but also add a FIXME comment about how the function may be pointless. (bookmark-default-handler): Rework doc string and change a parameter name, to clarify that this takes a bookmark record not a bookmark name. (bookmark-set): Change a parameter name to indicate its meaning, and improve the doc string a bit. (Bug#4188)
2009-10-05 01:35:34 +00:00
This makes an already existing 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."
(interactive (list (bookmark-completing-read "Bookmark to relocate")))
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(bookmark-maybe-historicize-string bookmark-name)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(bookmark-maybe-load-default-file)
(let ((bmrk-filename (bookmark-get-filename bookmark-name)))
;; FIXME: Make `bookmark-relocate' support bookmark Types
;; besides files and directories.
(unless bmrk-filename
(user-error "Cannot relocate bookmark of type \"%s\""
(bookmark-type-from-full-record
(bookmark-get-bookmark bookmark-name))))
(let ((newloc (abbreviate-file-name
(expand-file-name
(read-file-name
(format "Relocate %s to: " bookmark-name)
(file-name-directory bmrk-filename))))))
(bookmark-set-filename bookmark-name newloc)
(bookmark-update-last-modified bookmark-name)
(setq bookmark-alist-modification-count
(1+ bookmark-alist-modification-count))
(when (bookmark-time-to-save-p)
(bookmark-save))
(bookmark-bmenu-surreptitiously-rebuild-list))))
;;;###autoload
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-insert-location (bookmark-name &optional no-history)
"Insert the name of the file associated with BOOKMARK-NAME.
* bookmark.el (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-set-name, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-location, bookmark-jump, bookmark-jump-other-window, bookmark-handle-bookmark, bookmark-relocate, bookmark-insert-location, bookmark-rename, bookmark-insert, bookmark-delete, bookmark-time-to-save-p, bookmark-edit-annotation-mode, bookmark-edit-annotation): Improve doc strings to say whether bookmark can be a string or a record or both, and make other consistency and clarity fixes. (bookmark-get-handler, bookmark--jump-via, bookmark-write-file, bookmark-default-annotation-text, bookmark-yank-word, bookmark-maybe-load-default-file, bookmark-maybe-sort-alist, bookmark-import-new-list, bookmark-maybe-rename, bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames, bookmark-bmenu-bookmark): Give these doc strings. (bookmark-bmenu-check-position): Give this a doc string, but also add a FIXME comment about how the function may be pointless. (bookmark-default-handler): Rework doc string and change a parameter name, to clarify that this takes a bookmark record not a bookmark name. (bookmark-set): Change a parameter name to indicate its meaning, and improve the doc string a bit. (Bug#4188)
2009-10-05 01:35:34 +00:00
Optional second arg NO-HISTORY means don't record this in the
minibuffer history list `bookmark-history'."
(interactive (list (bookmark-completing-read "Insert bookmark location")))
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(or no-history (bookmark-maybe-historicize-string bookmark-name))
(insert (bookmark-location bookmark-name)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;;###autoload
(defalias 'bookmark-locate 'bookmark-insert-location)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-location (bookmark-name-or-record)
"Return a description of the location of BOOKMARK-NAME-OR-RECORD."
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(bookmark-maybe-load-default-file)
;; We could call the `handler' and ask for it to construct a description
;; dynamically: it would open up several new possibilities, but it
;; would have the major disadvantage of forcing to load each and
;; every handler when the user calls bookmark-menu.
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(or (bookmark-prop-get bookmark-name-or-record 'location)
(bookmark-get-filename bookmark-name-or-record)
"-- Unknown location --"))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;;###autoload
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-rename (old-name &optional new-name)
"Change the name of OLD-NAME bookmark to NEW-NAME name.
If called from keyboard, prompt for OLD-NAME and NEW-NAME.
If called from menubar, select OLD-NAME from a menu and prompt for NEW-NAME.
* bookmark.el (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-set-name, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-location, bookmark-jump, bookmark-jump-other-window, bookmark-handle-bookmark, bookmark-relocate, bookmark-insert-location, bookmark-rename, bookmark-insert, bookmark-delete, bookmark-time-to-save-p, bookmark-edit-annotation-mode, bookmark-edit-annotation): Improve doc strings to say whether bookmark can be a string or a record or both, and make other consistency and clarity fixes. (bookmark-get-handler, bookmark--jump-via, bookmark-write-file, bookmark-default-annotation-text, bookmark-yank-word, bookmark-maybe-load-default-file, bookmark-maybe-sort-alist, bookmark-import-new-list, bookmark-maybe-rename, bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames, bookmark-bmenu-bookmark): Give these doc strings. (bookmark-bmenu-check-position): Give this a doc string, but also add a FIXME comment about how the function may be pointless. (bookmark-default-handler): Rework doc string and change a parameter name, to clarify that this takes a bookmark record not a bookmark name. (bookmark-set): Change a parameter name to indicate its meaning, and improve the doc string a bit. (Bug#4188)
2009-10-05 01:35:34 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
If called from Lisp, prompt for NEW-NAME if only OLD-NAME was passed
as an argument. If called with two strings, then no prompting is done.
You must pass at least OLD-NAME when calling from Lisp.
1993-08-14 19:49:27 +00:00
While you are entering the new name, consecutive \
\\<bookmark-minibuffer-read-name-map>\\[bookmark-yank-word]'s insert
consecutive words from the text of the buffer into the new bookmark
name."
(interactive (list (bookmark-completing-read "Old bookmark name")))
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(bookmark-maybe-historicize-string old-name)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(bookmark-maybe-load-default-file)
(bookmark-load): Use `bookmark-import-new-list' to load the new list carefully, renaming bookmarks as necessary. In docstring, mention new renaming behavior. Optional arg OVERWRITE replaces inaccurately-named REVERT. If file loaded was bookmark-default-file, then set bookmarks-already-loaded to t. (bookmark-import-new-list): New func. (bookmark-maybe-rename): New func, helper to above. (bookmark-set-name): Accept bookmark as either string (behaves same as before) or list (treat it as a bookmark record). (bookmark-set, bookmark-maybe-load-default-file) (bookmark-jump-noselect, bookmark-rename) (bookmark-show-annotation): Discard pointless `progn's. (bookmark-bmenu-mark, bookmark-bmenu-unmark) (bookmark-bmenu-backup-unmark, bookmark-bmenu-delete-backwards): Renormalize position after all else is done. (bookmark-edit-annotation-mode, bookmark-bmenu-list) (bookmark-show-annotation, bookmark-show-all-annotations): Use `x' instead of `(not (eq x nil))'. (bookmark-yank-word): Inner save-excursion changed to progn. (bookmark-send-annotation, bookmark-send-edited-annotation) (bookmark-insert): Use buffer-string instead of buffer-substring. (bookmark-make-cell): Make sure annotation and info-node strings contain no text properties. (bookmark-relocate): Remember to rebuild bmenu buffer after a bookmark has been relocated. (bookmark-bmenu-check-position): Return a meaningful value -- callers have apparently been assuming this anyway. (bookmark-build-xemacs-menu): Unused function deleted. (bookmark-version): Removed this variable; the Emacs version suffices.
1997-08-22 19:14:10 +00:00
(setq bookmark-yank-point (point))
(setq bookmark-current-buffer (current-buffer))
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(let ((final-new-name
(or new-name ; use second arg, if non-nil
(bookmark-load): Use `bookmark-import-new-list' to load the new list carefully, renaming bookmarks as necessary. In docstring, mention new renaming behavior. Optional arg OVERWRITE replaces inaccurately-named REVERT. If file loaded was bookmark-default-file, then set bookmarks-already-loaded to t. (bookmark-import-new-list): New func. (bookmark-maybe-rename): New func, helper to above. (bookmark-set-name): Accept bookmark as either string (behaves same as before) or list (treat it as a bookmark record). (bookmark-set, bookmark-maybe-load-default-file) (bookmark-jump-noselect, bookmark-rename) (bookmark-show-annotation): Discard pointless `progn's. (bookmark-bmenu-mark, bookmark-bmenu-unmark) (bookmark-bmenu-backup-unmark, bookmark-bmenu-delete-backwards): Renormalize position after all else is done. (bookmark-edit-annotation-mode, bookmark-bmenu-list) (bookmark-show-annotation, bookmark-show-all-annotations): Use `x' instead of `(not (eq x nil))'. (bookmark-yank-word): Inner save-excursion changed to progn. (bookmark-send-annotation, bookmark-send-edited-annotation) (bookmark-insert): Use buffer-string instead of buffer-substring. (bookmark-make-cell): Make sure annotation and info-node strings contain no text properties. (bookmark-relocate): Remember to rebuild bmenu buffer after a bookmark has been relocated. (bookmark-bmenu-check-position): Return a meaningful value -- callers have apparently been assuming this anyway. (bookmark-build-xemacs-menu): Unused function deleted. (bookmark-version): Removed this variable; the Emacs version suffices.
1997-08-22 19:14:10 +00:00
(read-from-minibuffer
(format-prompt "Rename \"%s\" to" nil old-name)
(bookmark-load): Use `bookmark-import-new-list' to load the new list carefully, renaming bookmarks as necessary. In docstring, mention new renaming behavior. Optional arg OVERWRITE replaces inaccurately-named REVERT. If file loaded was bookmark-default-file, then set bookmarks-already-loaded to t. (bookmark-import-new-list): New func. (bookmark-maybe-rename): New func, helper to above. (bookmark-set-name): Accept bookmark as either string (behaves same as before) or list (treat it as a bookmark record). (bookmark-set, bookmark-maybe-load-default-file) (bookmark-jump-noselect, bookmark-rename) (bookmark-show-annotation): Discard pointless `progn's. (bookmark-bmenu-mark, bookmark-bmenu-unmark) (bookmark-bmenu-backup-unmark, bookmark-bmenu-delete-backwards): Renormalize position after all else is done. (bookmark-edit-annotation-mode, bookmark-bmenu-list) (bookmark-show-annotation, bookmark-show-all-annotations): Use `x' instead of `(not (eq x nil))'. (bookmark-yank-word): Inner save-excursion changed to progn. (bookmark-send-annotation, bookmark-send-edited-annotation) (bookmark-insert): Use buffer-string instead of buffer-substring. (bookmark-make-cell): Make sure annotation and info-node strings contain no text properties. (bookmark-relocate): Remember to rebuild bmenu buffer after a bookmark has been relocated. (bookmark-bmenu-check-position): Return a meaningful value -- callers have apparently been assuming this anyway. (bookmark-build-xemacs-menu): Unused function deleted. (bookmark-version): Removed this variable; the Emacs version suffices.
1997-08-22 19:14:10 +00:00
nil
(define-keymap
:parent minibuffer-local-map
"C-w" #'bookmark-yank-word)
(bookmark-load): Use `bookmark-import-new-list' to load the new list carefully, renaming bookmarks as necessary. In docstring, mention new renaming behavior. Optional arg OVERWRITE replaces inaccurately-named REVERT. If file loaded was bookmark-default-file, then set bookmarks-already-loaded to t. (bookmark-import-new-list): New func. (bookmark-maybe-rename): New func, helper to above. (bookmark-set-name): Accept bookmark as either string (behaves same as before) or list (treat it as a bookmark record). (bookmark-set, bookmark-maybe-load-default-file) (bookmark-jump-noselect, bookmark-rename) (bookmark-show-annotation): Discard pointless `progn's. (bookmark-bmenu-mark, bookmark-bmenu-unmark) (bookmark-bmenu-backup-unmark, bookmark-bmenu-delete-backwards): Renormalize position after all else is done. (bookmark-edit-annotation-mode, bookmark-bmenu-list) (bookmark-show-annotation, bookmark-show-all-annotations): Use `x' instead of `(not (eq x nil))'. (bookmark-yank-word): Inner save-excursion changed to progn. (bookmark-send-annotation, bookmark-send-edited-annotation) (bookmark-insert): Use buffer-string instead of buffer-substring. (bookmark-make-cell): Make sure annotation and info-node strings contain no text properties. (bookmark-relocate): Remember to rebuild bmenu buffer after a bookmark has been relocated. (bookmark-bmenu-check-position): Return a meaningful value -- callers have apparently been assuming this anyway. (bookmark-build-xemacs-menu): Unused function deleted. (bookmark-version): Removed this variable; the Emacs version suffices.
1997-08-22 19:14:10 +00:00
nil
'bookmark-history))))
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(bookmark-set-name old-name final-new-name)
(bookmark-update-last-modified final-new-name)
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(setq bookmark-current-bookmark final-new-name)
(bookmark-load): Use `bookmark-import-new-list' to load the new list carefully, renaming bookmarks as necessary. In docstring, mention new renaming behavior. Optional arg OVERWRITE replaces inaccurately-named REVERT. If file loaded was bookmark-default-file, then set bookmarks-already-loaded to t. (bookmark-import-new-list): New func. (bookmark-maybe-rename): New func, helper to above. (bookmark-set-name): Accept bookmark as either string (behaves same as before) or list (treat it as a bookmark record). (bookmark-set, bookmark-maybe-load-default-file) (bookmark-jump-noselect, bookmark-rename) (bookmark-show-annotation): Discard pointless `progn's. (bookmark-bmenu-mark, bookmark-bmenu-unmark) (bookmark-bmenu-backup-unmark, bookmark-bmenu-delete-backwards): Renormalize position after all else is done. (bookmark-edit-annotation-mode, bookmark-bmenu-list) (bookmark-show-annotation, bookmark-show-all-annotations): Use `x' instead of `(not (eq x nil))'. (bookmark-yank-word): Inner save-excursion changed to progn. (bookmark-send-annotation, bookmark-send-edited-annotation) (bookmark-insert): Use buffer-string instead of buffer-substring. (bookmark-make-cell): Make sure annotation and info-node strings contain no text properties. (bookmark-relocate): Remember to rebuild bmenu buffer after a bookmark has been relocated. (bookmark-bmenu-check-position): Return a meaningful value -- callers have apparently been assuming this anyway. (bookmark-build-xemacs-menu): Unused function deleted. (bookmark-version): Removed this variable; the Emacs version suffices.
1997-08-22 19:14:10 +00:00
(bookmark-bmenu-surreptitiously-rebuild-list)
(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
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;;###autoload
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-insert (bookmark-name)
"Insert the text of the file pointed to by bookmark BOOKMARK-NAME.
BOOKMARK-NAME is a bookmark name (a string), not a bookmark record.
* bookmark.el (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-set-name, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-location, bookmark-jump, bookmark-jump-other-window, bookmark-handle-bookmark, bookmark-relocate, bookmark-insert-location, bookmark-rename, bookmark-insert, bookmark-delete, bookmark-time-to-save-p, bookmark-edit-annotation-mode, bookmark-edit-annotation): Improve doc strings to say whether bookmark can be a string or a record or both, and make other consistency and clarity fixes. (bookmark-get-handler, bookmark--jump-via, bookmark-write-file, bookmark-default-annotation-text, bookmark-yank-word, bookmark-maybe-load-default-file, bookmark-maybe-sort-alist, bookmark-import-new-list, bookmark-maybe-rename, bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames, bookmark-bmenu-bookmark): Give these doc strings. (bookmark-bmenu-check-position): Give this a doc string, but also add a FIXME comment about how the function may be pointless. (bookmark-default-handler): Rework doc string and change a parameter name, to clarify that this takes a bookmark record not a bookmark name. (bookmark-set): Change a parameter name to indicate its meaning, and improve the doc string a bit. (Bug#4188)
2009-10-05 01:35:34 +00:00
1993-08-14 19:49:27 +00:00
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."
(interactive (list (bookmark-completing-read "Insert bookmark contents")))
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(bookmark-maybe-historicize-string bookmark-name)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(bookmark-maybe-load-default-file)
(let ((orig-point (point))
(str-to-insert
(save-current-buffer
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(bookmark-handle-bookmark bookmark-name)
(buffer-string))))
(insert str-to-insert)
(push-mark)
(goto-char orig-point)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;;###autoload
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-delete (bookmark-name &optional batch)
"Delete BOOKMARK-NAME from the bookmark list.
* bookmark.el (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-set-name, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-location, bookmark-jump, bookmark-jump-other-window, bookmark-handle-bookmark, bookmark-relocate, bookmark-insert-location, bookmark-rename, bookmark-insert, bookmark-delete, bookmark-time-to-save-p, bookmark-edit-annotation-mode, bookmark-edit-annotation): Improve doc strings to say whether bookmark can be a string or a record or both, and make other consistency and clarity fixes. (bookmark-get-handler, bookmark--jump-via, bookmark-write-file, bookmark-default-annotation-text, bookmark-yank-word, bookmark-maybe-load-default-file, bookmark-maybe-sort-alist, bookmark-import-new-list, bookmark-maybe-rename, bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames, bookmark-bmenu-bookmark): Give these doc strings. (bookmark-bmenu-check-position): Give this a doc string, but also add a FIXME comment about how the function may be pointless. (bookmark-default-handler): Rework doc string and change a parameter name, to clarify that this takes a bookmark record not a bookmark name. (bookmark-set): Change a parameter name to indicate its meaning, and improve the doc string a bit. (Bug#4188)
2009-10-05 01:35:34 +00:00
1993-08-14 19:49:27 +00:00
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).
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Optional second arg BATCH means don't update the bookmark list buffer,
probably because we were called from there."
(interactive
(list (bookmark-completing-read "Delete bookmark"
bookmark-current-bookmark)))
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(bookmark-maybe-historicize-string bookmark-name)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(bookmark-maybe-load-default-file)
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(let ((will-go (bookmark-get-bookmark bookmark-name 'noerror)))
(bookmark--remove-fringe-mark will-go)
1993-08-13 00:59:51 +00:00
(setq bookmark-alist (delq will-go bookmark-alist))
;; Added by db, nil bookmark-current-bookmark if the last
;; occurrence has been deleted
(or (bookmark-get-bookmark bookmark-current-bookmark 'noerror)
1993-08-13 00:59:51 +00:00
(setq bookmark-current-bookmark nil)))
(unless batch
(bookmark-bmenu-surreptitiously-rebuild-list))
(setq bookmark-alist-modification-count
(1+ bookmark-alist-modification-count))
(when (bookmark-time-to-save-p)
(bookmark-save)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
1993-08-10 20:35:31 +00:00
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
;;;###autoload
(defun bookmark-delete-all (&optional no-confirm)
"Permanently delete all bookmarks.
If optional argument NO-CONFIRM is non-nil, don't ask for
confirmation."
(interactive "P")
;; We don't use `bookmark-menu-confirm-deletion' here because that
;; variable is specifically to control confirmation prompting in a
;; bookmark menu buffer, where the user has the marked-for-deletion
;; bookmarks arrayed in front of them and might have accidentally
;; hit the key that executes the deletions. The UI situation here
;; is quite different, by contrast: the user got to this point by a
;; sequence of keystrokes unlikely to be typed by chance.
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
(when (or no-confirm
(yes-or-no-p "Permanently delete all bookmarks? "))
(bookmark-maybe-load-default-file)
(setq bookmark-alist-modification-count
(+ bookmark-alist-modification-count (length bookmark-alist)))
(setq bookmark-alist nil)
(bookmark-bmenu-surreptitiously-rebuild-list)
(when (bookmark-time-to-save-p)
(bookmark-save))))
* bookmark.el (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-set-name, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-location, bookmark-jump, bookmark-jump-other-window, bookmark-handle-bookmark, bookmark-relocate, bookmark-insert-location, bookmark-rename, bookmark-insert, bookmark-delete, bookmark-time-to-save-p, bookmark-edit-annotation-mode, bookmark-edit-annotation): Improve doc strings to say whether bookmark can be a string or a record or both, and make other consistency and clarity fixes. (bookmark-get-handler, bookmark--jump-via, bookmark-write-file, bookmark-default-annotation-text, bookmark-yank-word, bookmark-maybe-load-default-file, bookmark-maybe-sort-alist, bookmark-import-new-list, bookmark-maybe-rename, bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames, bookmark-bmenu-bookmark): Give these doc strings. (bookmark-bmenu-check-position): Give this a doc string, but also add a FIXME comment about how the function may be pointless. (bookmark-default-handler): Rework doc string and change a parameter name, to clarify that this takes a bookmark record not a bookmark name. (bookmark-set): Change a parameter name to indicate its meaning, and improve the doc string a bit. (Bug#4188)
2009-10-05 01:35:34 +00:00
(defun bookmark-time-to-save-p (&optional final-time)
"Return t if it is time to save bookmarks to disk, nil otherwise.
Optional argument FINAL-TIME means this is being called when Emacs
is being killed, so save even if `bookmark-save-flag' is a number and
is greater than `bookmark-alist-modification-count'."
;; By Gregory M. Saunders <saunders{_AT_}cis.ohio-state.edu>
(cond (final-time
1993-08-10 20:35:31 +00:00
(and (> bookmark-alist-modification-count 0)
bookmark-save-flag))
((numberp bookmark-save-flag)
(>= bookmark-alist-modification-count bookmark-save-flag))
(t
nil)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;;###autoload
1993-08-10 20:35:31 +00:00
(defun bookmark-write ()
"Write bookmarks to a file (reading the file name with the minibuffer)."
(declare (interactive-only bookmark-save))
1993-08-10 20:35:31 +00:00
(interactive)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(bookmark-maybe-load-default-file)
1993-08-10 20:35:31 +00:00
(bookmark-save t))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;;###autoload
(defun bookmark-save (&optional parg file make-default)
"Save currently defined bookmarks in FILE.
FILE defaults to `bookmark-default-file'.
With prefix PARG, query user for a file to save in.
Docfix: use command substitution for 'universal-argument' * lisp/autoarg.el (autoarg-mode): * lisp/bookmark.el (bookmark-set, bookmark-set-no-overwrite) (bookmark-save): * lisp/calendar/todo-mode.el (todo-insert-item) (todo-filter-top-priorities) (todo-filter-top-priorities-multifile): * lisp/dired-x.el (dired-mark-extension, dired-mark-suffix): * lisp/eshell/eshell.el (eshell): * lisp/gnus/gnus-group.el (gnus-group-find-new-groups): * lisp/gnus/gnus-start.el (gnus-find-new-newsgroups): * lisp/gnus/gnus-sum.el (gnus-summary-show-article): * lisp/gnus/gnus.el (gnus-secondary-servers): * lisp/org/org-timer.el (org-timer-set-timer): * lisp/org/ox.el (org-export-dispatch-last-position): * lisp/printing.el (pr-ps-directory-preview) (pr-ps-directory-using-ghostscript, pr-ps-directory-print) (pr-ps-directory-ps-print, pr-ps-buffer-preview) (pr-ps-buffer-using-ghostscript, pr-ps-buffer-print) (pr-ps-buffer-ps-print, pr-despool-preview) (pr-despool-using-ghostscript, pr-despool-print) (pr-despool-ps-print, pr-ps-file-up-ps-print, pr-ps-fast-fire) (pr-txt-fast-fire): * lisp/progmodes/idlwave.el (idlwave-complete): * lisp/progmodes/sh-script.el (sh-set-shell): * lisp/replace.el (occur): * lisp/ses.el (ses--advice-yank): * lisp/simple.el (set-mark-command-repeat-pop): * lisp/sort.el (delete-duplicate-lines): * lisp/strokes.el (strokes-help): * lisp/textmodes/artist.el (artist-mode): * lisp/textmodes/reftex-cite.el (reftex-citation): * lisp/textmodes/reftex-dcr.el (reftex-view-crossref): * lisp/textmodes/reftex-index.el (reftex-index-selection-or-word) (reftex-display-index): * lisp/textmodes/reftex-ref.el (reftex-reference): * lisp/textmodes/reftex-toc.el (reftex-toc): * lisp/textmodes/reftex-vars.el (reftex-cite-prompt-optional-args) (reftex-enable-partial-scans): * lisp/textmodes/texnfo-upd.el (texinfo-master-menu): * lisp/windmove.el (windmove-display-in-direction) (windmove-delete-left, windmove-delete-up) (windmove-delete-right, windmove-delete-down): * lisp/window.el (recenter-window-group, recenter-other-window): Use command substitution for 'universal-argument' instead of raw "C-u".
2021-09-16 18:05:48 +00:00
If MAKE-DEFAULT is non-nil (interactively with prefix \\[universal-argument] \\[universal-argument])
the file we save in becomes the new default in the current Emacs
session (without affecting the value of `bookmark-default-file'.).
1993-08-10 20:35:31 +00:00
1993-08-13 00:59:51 +00:00
When you want to load in the bookmarks from a file, use
`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
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
`bookmark-default-file'."
(interactive
(list current-prefix-arg nil (equal '(16) current-prefix-arg)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(bookmark-maybe-load-default-file)
(unless file
(setq file
(let ((default (or (car bookmark-bookmarks-timestamp)
bookmark-default-file)))
(if parg
;; This should be part of the `interactive' spec.
(read-file-name (format "File to save bookmarks in: (%s) "
default)
(file-name-directory default) default)
default))))
(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)
(if make-default
(let ((default (expand-file-name file)))
(setq bookmark-bookmarks-timestamp
(cons default (nth 5 (file-attributes default)))))
(let ((default (car bookmark-bookmarks-timestamp)))
(if (string= default (expand-file-name file))
(setq bookmark-bookmarks-timestamp
(cons default (nth 5 (file-attributes default))))))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
1993-08-10 20:35:31 +00:00
(defun bookmark-write-file (file)
* bookmark.el (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-set-name, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-location, bookmark-jump, bookmark-jump-other-window, bookmark-handle-bookmark, bookmark-relocate, bookmark-insert-location, bookmark-rename, bookmark-insert, bookmark-delete, bookmark-time-to-save-p, bookmark-edit-annotation-mode, bookmark-edit-annotation): Improve doc strings to say whether bookmark can be a string or a record or both, and make other consistency and clarity fixes. (bookmark-get-handler, bookmark--jump-via, bookmark-write-file, bookmark-default-annotation-text, bookmark-yank-word, bookmark-maybe-load-default-file, bookmark-maybe-sort-alist, bookmark-import-new-list, bookmark-maybe-rename, bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames, bookmark-bmenu-bookmark): Give these doc strings. (bookmark-bmenu-check-position): Give this a doc string, but also add a FIXME comment about how the function may be pointless. (bookmark-default-handler): Rework doc string and change a parameter name, to clarify that this takes a bookmark record not a bookmark name. (bookmark-set): Change a parameter name to indicate its meaning, and improve the doc string a bit. (Bug#4188)
2009-10-05 01:35:34 +00:00
"Write `bookmark-alist' to FILE."
(let ((reporter (make-progress-reporter
(format "Saving bookmarks to file %s..." file))))
(with-current-buffer (get-buffer-create " *Bookmarks*")
(goto-char (point-min))
(delete-region (point-min) (point-max))
(let ((coding-system-for-write
(or coding-system-for-write
bookmark-file-coding-system 'utf-8-emacs))
(print-length nil)
(print-level nil)
;; See bug #12503 for why we bind `print-circle'. Users
;; can define their own bookmark types, which can result in
;; arbitrary Lisp objects being stored in bookmark records,
;; and some users create objects containing circularities.
(print-circle t))
(insert "(")
;; Rather than a single call to `pp' we make one per bookmark.
;; Apparently `pp' has a poor algorithmic complexity, so this
;; scales a lot better. bug#4485.
(dolist (i bookmark-alist) (pp i (current-buffer)))
(insert ")\n")
;; Make sure the specified encoding can safely encode the
;; bookmarks. If it cannot, suggest utf-8-emacs as default.
(with-coding-priority '(utf-8-emacs)
(setq coding-system-for-write
(select-safe-coding-system (point-min) (point-max)
(list t coding-system-for-write))))
(goto-char (point-min))
(bookmark-insert-file-format-version-stamp coding-system-for-write)
(let ((version-control
(cond
((null bookmark-version-control) nil)
((eq 'never bookmark-version-control) 'never)
((eq 'nospecial bookmark-version-control) version-control)
(t t))))
(condition-case nil
;; There was a stretch of time (about 15 years) when we
;; used `write-region' below instead of `write-file',
;; before going back to `write-file' again. So if you're
;; considering changing it to `write-region', please see
;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=12507.
;; That bug tells the story of how we first started using
;; `write-region' in 2005...
;;
;; commit a506054af7cd86a63fda996056c09310966f32ef
;; Author: Karl Fogel <kfogel@red-bean.com>
;; AuthorDate: Sat Nov 12 20:30:22 2005 +0000
;;
;; (bookmark-write-file): Don't visit the
;; destination file, just write the data to it
;; using write-region. This is similar to
;; 2005-05-29T08:36:26Z!rms@gnu.org of saveplace.el,
;; but with an additional change to avoid visiting
;; the file in the first place.
;;
;; ...and of how further inquiry led us to investigate (in
;; 2012 and then again in 2020) and eventually decide that
;; matching the saveplace.el change doesn't make sense for
;; bookmark.el. Therefore we reverted to `write-file',
;; which means numbered backups may now be created,
;; depending on `bookmark-version-control' as per above.
(write-file file)
(file-error (message "Can't write %s" file)))
(setq bookmark-file-coding-system coding-system-for-write)
(kill-buffer (current-buffer))
(progress-reporter-done reporter))))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(bookmark-load): Use `bookmark-import-new-list' to load the new list carefully, renaming bookmarks as necessary. In docstring, mention new renaming behavior. Optional arg OVERWRITE replaces inaccurately-named REVERT. If file loaded was bookmark-default-file, then set bookmarks-already-loaded to t. (bookmark-import-new-list): New func. (bookmark-maybe-rename): New func, helper to above. (bookmark-set-name): Accept bookmark as either string (behaves same as before) or list (treat it as a bookmark record). (bookmark-set, bookmark-maybe-load-default-file) (bookmark-jump-noselect, bookmark-rename) (bookmark-show-annotation): Discard pointless `progn's. (bookmark-bmenu-mark, bookmark-bmenu-unmark) (bookmark-bmenu-backup-unmark, bookmark-bmenu-delete-backwards): Renormalize position after all else is done. (bookmark-edit-annotation-mode, bookmark-bmenu-list) (bookmark-show-annotation, bookmark-show-all-annotations): Use `x' instead of `(not (eq x nil))'. (bookmark-yank-word): Inner save-excursion changed to progn. (bookmark-send-annotation, bookmark-send-edited-annotation) (bookmark-insert): Use buffer-string instead of buffer-substring. (bookmark-make-cell): Make sure annotation and info-node strings contain no text properties. (bookmark-relocate): Remember to rebuild bmenu buffer after a bookmark has been relocated. (bookmark-bmenu-check-position): Return a meaningful value -- callers have apparently been assuming this anyway. (bookmark-build-xemacs-menu): Unused function deleted. (bookmark-version): Removed this variable; the Emacs version suffices.
1997-08-22 19:14:10 +00:00
(defun bookmark-import-new-list (new-list)
"Add NEW-LIST of bookmarks to `bookmark-alist'.
Rename new bookmarks as needed using suffix \"<N>\" (N=1,2,3...), when
they conflict with existing bookmark names."
(let ((names (bookmark-all-names)))
(dolist (full-record new-list)
(bookmark-maybe-rename full-record names)
(setq bookmark-alist (nconc bookmark-alist (list full-record)))
(push (bookmark-name-from-full-record full-record) names))))
(bookmark-load): Use `bookmark-import-new-list' to load the new list carefully, renaming bookmarks as necessary. In docstring, mention new renaming behavior. Optional arg OVERWRITE replaces inaccurately-named REVERT. If file loaded was bookmark-default-file, then set bookmarks-already-loaded to t. (bookmark-import-new-list): New func. (bookmark-maybe-rename): New func, helper to above. (bookmark-set-name): Accept bookmark as either string (behaves same as before) or list (treat it as a bookmark record). (bookmark-set, bookmark-maybe-load-default-file) (bookmark-jump-noselect, bookmark-rename) (bookmark-show-annotation): Discard pointless `progn's. (bookmark-bmenu-mark, bookmark-bmenu-unmark) (bookmark-bmenu-backup-unmark, bookmark-bmenu-delete-backwards): Renormalize position after all else is done. (bookmark-edit-annotation-mode, bookmark-bmenu-list) (bookmark-show-annotation, bookmark-show-all-annotations): Use `x' instead of `(not (eq x nil))'. (bookmark-yank-word): Inner save-excursion changed to progn. (bookmark-send-annotation, bookmark-send-edited-annotation) (bookmark-insert): Use buffer-string instead of buffer-substring. (bookmark-make-cell): Make sure annotation and info-node strings contain no text properties. (bookmark-relocate): Remember to rebuild bmenu buffer after a bookmark has been relocated. (bookmark-bmenu-check-position): Return a meaningful value -- callers have apparently been assuming this anyway. (bookmark-build-xemacs-menu): Unused function deleted. (bookmark-version): Removed this variable; the Emacs version suffices.
1997-08-22 19:14:10 +00:00
(defun bookmark-maybe-rename (full-record names)
"Rename bookmark FULL-RECORD if its current name is already used.
This is a helper for `bookmark-import-new-list'."
(let ((found-name (bookmark-name-from-full-record full-record)))
(bookmark-load): Use `bookmark-import-new-list' to load the new list carefully, renaming bookmarks as necessary. In docstring, mention new renaming behavior. Optional arg OVERWRITE replaces inaccurately-named REVERT. If file loaded was bookmark-default-file, then set bookmarks-already-loaded to t. (bookmark-import-new-list): New func. (bookmark-maybe-rename): New func, helper to above. (bookmark-set-name): Accept bookmark as either string (behaves same as before) or list (treat it as a bookmark record). (bookmark-set, bookmark-maybe-load-default-file) (bookmark-jump-noselect, bookmark-rename) (bookmark-show-annotation): Discard pointless `progn's. (bookmark-bmenu-mark, bookmark-bmenu-unmark) (bookmark-bmenu-backup-unmark, bookmark-bmenu-delete-backwards): Renormalize position after all else is done. (bookmark-edit-annotation-mode, bookmark-bmenu-list) (bookmark-show-annotation, bookmark-show-all-annotations): Use `x' instead of `(not (eq x nil))'. (bookmark-yank-word): Inner save-excursion changed to progn. (bookmark-send-annotation, bookmark-send-edited-annotation) (bookmark-insert): Use buffer-string instead of buffer-substring. (bookmark-make-cell): Make sure annotation and info-node strings contain no text properties. (bookmark-relocate): Remember to rebuild bmenu buffer after a bookmark has been relocated. (bookmark-bmenu-check-position): Return a meaningful value -- callers have apparently been assuming this anyway. (bookmark-build-xemacs-menu): Unused function deleted. (bookmark-version): Removed this variable; the Emacs version suffices.
1997-08-22 19:14:10 +00:00
(if (member found-name names)
;; We've got a conflict, so generate a new name
(let ((count 2)
(new-name found-name))
(while (member new-name names)
(setq new-name (concat found-name (format "<%d>" count)))
(setq count (1+ count)))
(bookmark-set-name full-record new-name)))))
;;;###autoload
(defun bookmark-load (file &optional overwrite no-msg default)
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 argument OVERWRITE is non-nil, existing bookmarks are destroyed.
Optional third arg NO-MSG means don't display any messages while loading.
If DEFAULT is non-nil make FILE the new bookmark file to watch.
Interactively, a prefix arg makes OVERWRITE and DEFAULT non-nil.
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
place. Your own personal bookmark file, specified by the variable
`bookmark-default-file', is maintained automatically by Emacs; you
shouldn't need to load it explicitly.
(bookmark-load): Use `bookmark-import-new-list' to load the new list carefully, renaming bookmarks as necessary. In docstring, mention new renaming behavior. Optional arg OVERWRITE replaces inaccurately-named REVERT. If file loaded was bookmark-default-file, then set bookmarks-already-loaded to t. (bookmark-import-new-list): New func. (bookmark-maybe-rename): New func, helper to above. (bookmark-set-name): Accept bookmark as either string (behaves same as before) or list (treat it as a bookmark record). (bookmark-set, bookmark-maybe-load-default-file) (bookmark-jump-noselect, bookmark-rename) (bookmark-show-annotation): Discard pointless `progn's. (bookmark-bmenu-mark, bookmark-bmenu-unmark) (bookmark-bmenu-backup-unmark, bookmark-bmenu-delete-backwards): Renormalize position after all else is done. (bookmark-edit-annotation-mode, bookmark-bmenu-list) (bookmark-show-annotation, bookmark-show-all-annotations): Use `x' instead of `(not (eq x nil))'. (bookmark-yank-word): Inner save-excursion changed to progn. (bookmark-send-annotation, bookmark-send-edited-annotation) (bookmark-insert): Use buffer-string instead of buffer-substring. (bookmark-make-cell): Make sure annotation and info-node strings contain no text properties. (bookmark-relocate): Remember to rebuild bmenu buffer after a bookmark has been relocated. (bookmark-bmenu-check-position): Return a meaningful value -- callers have apparently been assuming this anyway. (bookmark-build-xemacs-menu): Unused function deleted. (bookmark-version): Removed this variable; the Emacs version suffices.
1997-08-22 19:14:10 +00:00
If you load a file containing bookmarks with the same names as
bookmarks already present in your Emacs, the new bookmarks will get
unique numeric suffixes \"<2>\", \"<3>\", etc."
1993-08-10 20:35:31 +00:00
(interactive
(let ((default (abbreviate-file-name
(or (car bookmark-bookmarks-timestamp)
(expand-file-name bookmark-default-file))))
(prefix current-prefix-arg))
(list (read-file-name (format "Load bookmarks from: (%s) " default)
(file-name-directory default) default 'confirm)
prefix nil prefix)))
(let* ((file (expand-file-name file))
(afile (abbreviate-file-name file)))
(unless (file-readable-p file)
(user-error "Cannot read bookmark file %s" afile))
(let ((reporter
(unless no-msg
(make-progress-reporter
(format "Loading bookmarks from %s..." file)))))
(with-current-buffer (let (enable-local-variables)
(find-file-noselect file))
(goto-char (point-min))
(let ((blist (bookmark-alist-from-buffer)))
(unless (listp blist)
(error "Invalid bookmark list in %s" file))
;; RW: Upon loading the bookmarks, we could add to each bookmark
;; in `bookmark-alist' an extra key `bookmark-file', so that
;; upon reloading the bookmarks with OVERWRITE non-nil,
;; we overwrite only those bookmarks for which the key `bookmark-file'
;; matches FILE. `bookmark-save' can ignore this key.
;; Would this be a useful option?
(if overwrite
(setq bookmark-alist blist
bookmark-alist-modification-count 0)
(bookmark-import-new-list blist)
(setq bookmark-alist-modification-count
(1+ bookmark-alist-modification-count)))
(if (or default
(string= file (or (car bookmark-bookmarks-timestamp)
(expand-file-name bookmark-default-file))))
(setq bookmark-bookmarks-timestamp
(cons file (nth 5 (file-attributes file)))))
(bookmark-bmenu-surreptitiously-rebuild-list)
(setq bookmark-file-coding-system buffer-file-coding-system))
(kill-buffer (current-buffer)))
(unless no-msg
(progress-reporter-done reporter)))))
1993-08-10 20:35:31 +00:00
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;; Code supporting the dired-like bookmark list.
;; Prefix is "bookmark-bmenu" for "buffer-menu":
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defvar bookmark-bmenu-hidden-bookmarks ())
(defvar-keymap bookmark-bmenu-mode-map
:doc "Keymap for `bookmark-bmenu-mode'."
:parent tabulated-list-mode-map
"v" #'bookmark-bmenu-select
"w" #'bookmark-bmenu-locate
"5" #'bookmark-bmenu-other-frame
"2" #'bookmark-bmenu-2-window
"1" #'bookmark-bmenu-1-window
"j" #'bookmark-bmenu-this-window
"C-c C-c" #'bookmark-bmenu-this-window
"f" #'bookmark-bmenu-this-window
"C-m" #'bookmark-bmenu-this-window
"o" #'bookmark-bmenu-other-window
"C-o" #'bookmark-bmenu-switch-other-window
"s" #'bookmark-bmenu-save
"C-x C-s" #'bookmark-bmenu-save
"k" #'bookmark-bmenu-delete
"C-d" #'bookmark-bmenu-delete-backwards
"x" #'bookmark-bmenu-execute-deletions
"d" #'bookmark-bmenu-delete
"D" #'bookmark-bmenu-delete-all
"S-SPC" #'previous-line
"SPC" #'next-line
"DEL" #'bookmark-bmenu-backup-unmark
"u" #'bookmark-bmenu-unmark
"U" #'bookmark-bmenu-unmark-all
"m" #'bookmark-bmenu-mark
"M" #'bookmark-bmenu-mark-all
"l" #'bookmark-bmenu-load
"r" #'bookmark-bmenu-rename
"R" #'bookmark-bmenu-relocate
"t" #'bookmark-bmenu-toggle-filenames
"a" #'bookmark-bmenu-show-annotation
"A" #'bookmark-bmenu-show-all-annotations
"e" #'bookmark-bmenu-edit-annotation
"J" #'bookmark-jump
"/" #'bookmark-bmenu-search
"<mouse-2>" #'bookmark-bmenu-other-window-with-mouse)
Move keymap initialization into declaration. * lisp/textmodes/enriched.el (enriched-mode-map): * lisp/textmodes/bib-mode.el (bib-mode-map): * lisp/term/lk201.el (lk201-function-map): * lisp/tar-mode.el (tar-mode-map): * lisp/replace.el (occur-mode-map): * lisp/progmodes/idlwave.el (idlwave-rinfo-mouse-map, idlwave-rinfo-map): * lisp/progmodes/idlw-help.el (idlwave-help-mode-map): * lisp/progmodes/gdb-mi.el (gdb-memory-format-menu, gdb-memory-unit-menu): * lisp/play/solitaire.el (solitaire-mode-map): * lisp/play/snake.el (snake-mode-map, snake-null-map): * lisp/play/pong.el (pong-mode-map): * lisp/play/handwrite.el (menu-bar-handwrite-map): * lisp/play/gametree.el (gametree-mode-map): * lisp/net/rcirc.el (rcirc-mode-map, rcirc-browse-url-map (rcirc-multiline-minor-mode-map, rcirc-track-minor-mode-map): * lisp/net/newst-plainview.el (newsticker-menu, newsticker-mode-map) (newsticker--url-keymap): * lisp/net/net-utils.el (nslookup-mode-map, ftp-mode-map): * lisp/menu-bar.el (menu-bar-file-menu, menu-bar-i-search-menu) (menu-bar-search-menu, menu-bar-replace-menu, menu-bar-goto-menu) (menu-bar-edit-menu, menu-bar-custom-menu) (menu-bar-showhide-fringe-ind-menu, menu-bar-showhide-fringe-menu) (menu-bar-showhide-scroll-bar-menu, menu-bar-showhide-menu) (menu-bar-line-wrapping-menu, menu-bar-options-menu) (menu-bar-games-menu, menu-bar-encryption-decryption-menu) (menu-bar-tools-menu, menu-bar-describe-menu) (menu-bar-search-documentation-menu, menu-bar-manuals-menu) (menu-bar-help-menu): * lisp/mail/rmailsum.el (rmail-summary-mode-map): * lisp/kmacro.el (kmacro-step-edit-map): * lisp/ibuffer.el (ibuffer-mode-groups-popup, ibuffer-mode-map) (ibuffer-mode-operate-map): * lisp/hi-lock.el (hi-lock-menu, hi-lock-map): * lisp/emulation/vip.el (vip-mode-map): * lisp/emacs-lisp/re-builder.el (reb-lisp-mode-map): * lisp/bookmark.el (bookmark-bmenu-mode-map): * lisp/help-mode.el (help-mode-map): * lisp/erc/erc-list.el (erc-list-menu-mode-map): * lisp/org/org-remember.el (org-remember-mode-map): * lisp/org/org-src.el (org-src-mode-map): Move initialization into declaration.
2011-02-10 16:56:00 +00:00
(easy-menu-define bookmark-menu bookmark-bmenu-mode-map
"Menu for `bookmark-bmenu'."
'("Bookmark"
["Select Bookmark in This Window" bookmark-bmenu-this-window t]
["Select Bookmark in Full-Frame Window" bookmark-bmenu-1-window t]
["Select Bookmark in Other Window" bookmark-bmenu-other-window t]
["Select Bookmark in Other Frame" bookmark-bmenu-other-frame t]
["Select Marked Bookmarks" bookmark-bmenu-select t]
"---"
["Mark Bookmark" bookmark-bmenu-mark t]
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
["Mark all Bookmarks" bookmark-bmenu-mark-all t]
["Unmark Bookmark" bookmark-bmenu-unmark t]
["Unmark Backwards" bookmark-bmenu-backup-unmark t]
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
["Unmark all Bookmarks" bookmark-bmenu-unmark-all t]
["Toggle Display of Filenames" bookmark-bmenu-toggle-filenames t]
["Display Location of Bookmark" bookmark-bmenu-locate t]
"---"
("Edit Bookmarks"
["Rename Bookmark" bookmark-bmenu-rename t]
["Relocate Bookmark's File" bookmark-bmenu-relocate t]
["Mark Bookmark for Deletion" bookmark-bmenu-delete t]
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
["Mark all Bookmarks for Deletion" bookmark-bmenu-delete-all t]
["Delete Marked Bookmarks" bookmark-bmenu-execute-deletions t])
("Annotations"
["Show Annotation for Current Bookmark" bookmark-bmenu-show-annotation t]
["Show Annotations for All Bookmarks" bookmark-bmenu-show-all-annotations t]
["Edit Annotation for Current Bookmark." bookmark-bmenu-edit-annotation t])
"---"
["Save Bookmarks" bookmark-bmenu-save t]
["Load Bookmarks" bookmark-bmenu-load t]))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;; Bookmark Buffer Menu mode is suitable only for specially formatted
;; data.
(put 'bookmark-bmenu-mode 'mode-class 'special)
;; todo: need to display whether or not bookmark exists as a buffer in
2001-01-12 22:49:40 +00:00
;; flag column.
;; Format:
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;; FLAGS BOOKMARK [ LOCATION ]
(defun bookmark-bmenu-surreptitiously-rebuild-list ()
"Rebuild the Bookmark List if it exists.
Don't affect the buffer ring order."
(if (get-buffer bookmark-bmenu-buffer)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(save-excursion
2001-01-12 22:49:40 +00:00
(save-window-excursion
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(bookmark-bmenu-list)))))
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(defun bookmark-bmenu--revert ()
"Re-populate `tabulated-list-entries'."
(let (entries)
(dolist (full-record (bookmark-maybe-sort-alist))
(let* ((name (bookmark-name-from-full-record full-record))
(type (bookmark-type-from-full-record full-record))
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(annotation (bookmark-get-annotation full-record))
(location (bookmark-location full-record)))
(push (list
full-record
`[,(if (and annotation (not (string-equal annotation "")))
"*" "")
,(if (display-mouse-p)
(propertize name
'font-lock-face 'bookmark-menu-bookmark
'mouse-face 'highlight
'follow-link t
'help-echo "mouse-2: go to this bookmark in other window")
name)
,(or type "")
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
,@(if bookmark-bmenu-toggle-filenames
(list location))])
entries)))
;; The value of `bookmark-sort-flag' might have changed since the
;; last time the buffer contents were generated, so re-check it.
(cond ((eq bookmark-sort-flag t)
(setq tabulated-list-sort-key '("Bookmark Name" . nil)
tabulated-list-entries entries))
((or (null bookmark-sort-flag)
(eq bookmark-sort-flag 'last-modified))
(setq tabulated-list-sort-key nil)
;; And since we're not sorting by bookmark name, show bookmarks
;; according to order of creation, with the most recently
;; created bookmarks at the top and the least recently created
;; at the bottom.
;;
;; Note that clicking the column sort toggle for the bookmark
;; name column will invoke the `tabulated-list-mode' sort, which
;; uses `bookmark-bmenu--name-predicate' to sort lexically by
;; bookmark name instead of by (reverse) creation order.
;; Clicking the toggle again will reverse the lexical sort, but
;; the sort will still be lexical not creation-order. However,
;; if the user reverts the buffer, then the above check of
;; `bookmark-sort-flag' will happen again and the buffer will
;; go back to a creation-order sort. This is all expected
;; behavior, as documented in `bookmark-bmenu-mode'.
(setq tabulated-list-entries (reverse entries))))
;; Generate the header only after `tabulated-list-sort-key' is
;; settled, because if that's non-nil then the sort-direction
;; indicator will be shown in the named column, but if it's
;; nil then the indicator will not be shown.
(tabulated-list-init-header))
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(tabulated-list-print t))
;;;###autoload
(defun bookmark-bmenu-get-buffer ()
"Return the Bookmark List, building it if it doesn't exists.
Don't affect the buffer ring order."
(or (get-buffer bookmark-bmenu-buffer)
(save-excursion
(save-window-excursion
(bookmark-bmenu-list)
(get-buffer bookmark-bmenu-buffer)))))
(custom-add-choice 'tab-bar-new-tab-choice
'(const :tag "Bookmark List" bookmark-bmenu-get-buffer))
;;;###autoload
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-list ()
"Display a list of existing bookmarks.
The list is displayed in a buffer named `*Bookmark List*'.
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
The leftmost column displays a D if the bookmark is flagged for
deletion, or > if it is flagged for displaying."
(interactive)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(bookmark-maybe-load-default-file)
(let ((buf (get-buffer-create bookmark-bmenu-buffer)))
(if (called-interactively-p 'interactive)
Remove pop-to-buffer-same-window. * lisp/window.el (pop-to-buffer-1, pop-to-buffer-same-window): Deleted. (pop-to-buffer): Change interactive spec. Pass second argument directly to display-buffer. (display-buffer): Fix interactive spec. Use functionp to distinguish between a function and a list of functions. * lisp/abbrev.el (edit-abbrevs): * lisp/arc-mode.el (archive-extract): * lisp/autoinsert.el (auto-insert): * lisp/bookmark.el (bookmark-bmenu-list): * lisp/files.el (find-file): * lisp/view.el (view-buffer): * lisp/progmodes/compile.el (compilation-goto-locus): * lisp/textmodes/bibtex.el (bibtex-initialize): Use switch-to-buffer. * lisp/org/ob-ref.el (org-babel-ref-goto-headline-id): * lisp/org/org.el (org-get-location, org-tree-to-indirect-buffer) (org-mark-ring-goto, org-refile, org-add-log-note) (org-revert-all-org-buffers, org-switchb) (org-cycle-agenda-files, org-submit-bug-report) (org-goto-marker-or-bmk): * lisp/org/org-agenda.el (org-prepare-agenda, org-agenda-switch-to): * lisp/org/org-capture.el (org-capture-goto-target) (org-capture-fill-template): * lisp/org/org-clock.el (org-clock-goto): * lisp/org/org-ctags.el (org-ctags-visit-buffer-or-file): * lisp/org/org-exp.el (org-export-as-org): * lisp/org/org-feed.el (org-feed-show-raw-feed): * lisp/org/org-html.el (org-export-htmlize-generate-css): * lisp/org/org-id.el (org-id-goto): * lisp/org/org-irc.el (org-irc-visit-erc): * lisp/org/org-mobile.el (org-mobile-apply): * lisp/org/org-publish.el (org-publish-org-to, org-publish-find-date): * lisp/org/org-remember.el (org-go-to-remember-target): * lisp/org/org-src.el (org-src-switch-to-buffer) (org-edit-fixed-width-region): Use switch-to-buffer. * lisp/org/org-compat.el (org-pop-to-buffer-same-window): Deleted.
2011-09-02 16:38:40 +00:00
(switch-to-buffer buf)
(set-buffer buf)))
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(bookmark-bmenu-mode)
(bookmark-bmenu--revert))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;;###autoload
(defalias 'list-bookmarks 'bookmark-bmenu-list)
;;;###autoload
(defalias 'edit-bookmarks 'bookmark-bmenu-list)
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(define-obsolete-function-alias 'bookmark-bmenu-set-header
#'tabulated-list-init-header "28.1")
(define-derived-mode bookmark-bmenu-mode tabulated-list-mode "Bookmark Menu"
"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 names preceded by a \"*\" have annotations.
If `bookmark-sort-flag' is non-nil, then sort the list by
bookmark name (case-insensitively, in collation order); the
direction of that sort can be reversed by using the column sort
toggle for the bookmark name column.
If `bookmark-sort-flag' is nil, then sort the list by bookmark
creation order, with most recently created bookmarks on top.
However, the column sort toggle will still activate (and
thereafter toggle the direction of) lexical sorting by bookmark name.
At any time you may use \\[revert-buffer] to go back to sorting by creation order.
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
\\<bookmark-bmenu-mode-map>
\\[bookmark-bmenu-mark] -- mark bookmark to be displayed.
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
\\[bookmark-bmenu-mark-all] -- mark all listed bookmarks to be displayed.
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
\\[bookmark-bmenu-select] -- select bookmark of line point is on.
Also show bookmarks marked using m in other windows.
\\[bookmark-bmenu-toggle-filenames] -- toggle displaying of filenames (they may obscure long bookmark names).
\\[bookmark-bmenu-locate] -- display (in minibuffer) location of this bookmark.
\\[bookmark-bmenu-1-window] -- select this bookmark in full-frame window.
\\[bookmark-bmenu-2-window] -- select this bookmark in one window,
together with bookmark selected before this one in another window.
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
\\[bookmark-bmenu-this-window] -- select this bookmark in place of the bookmark menu buffer.
\\[bookmark-bmenu-other-window] -- select this bookmark in another window,
so the bookmark menu bookmark remains visible in its window.
\\[bookmark-bmenu-other-frame] -- select this bookmark in another frame.
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
\\[bookmark-bmenu-switch-other-window] -- switch the other window to this bookmark.
\\[bookmark-bmenu-rename] -- rename this bookmark (prompts for new name).
\\[bookmark-bmenu-relocate] -- relocate this bookmark's file (prompts for new file).
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
\\[bookmark-bmenu-delete] -- mark this bookmark to be deleted, and move down.
2001-01-12 22:49:40 +00:00
\\[bookmark-bmenu-delete-backwards] -- mark this bookmark to be deleted, and move up.
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
\\[bookmark-bmenu-delete-all] -- mark all listed bookmarks as to be deleted.
\\[bookmark-bmenu-execute-deletions] -- delete bookmarks marked with `\\[bookmark-bmenu-delete]' or `\\[bookmark-bmenu-delete-all]'.
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
\\[bookmark-bmenu-save] -- save the current bookmark list in the default file.
With a prefix arg, prompts for a file to save in.
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
\\[bookmark-bmenu-load] -- load in a file of bookmarks (prompts for file.)
\\[bookmark-bmenu-unmark] -- remove all kinds of marks from current line.
With prefix argument, also move up one line.
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
\\[bookmark-bmenu-backup-unmark] -- back up a line and remove marks.
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
\\[bookmark-bmenu-unmark-all] -- remove all kinds of marks from all listed bookmarks.
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
\\[bookmark-bmenu-show-annotation] -- show the annotation, if it exists, for the current bookmark
in another buffer.
\\[bookmark-bmenu-show-all-annotations] -- show the annotations of all bookmarks in another buffer.
\\[bookmark-bmenu-edit-annotation] -- edit the annotation for the current bookmark.
\\[bookmark-bmenu-search] -- incrementally search for bookmarks.
\\[revert-buffer] -- refresh the buffer, and thus refresh the sort order (useful
if `bookmark-sort-flag' is nil)."
(setq truncate-lines t)
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(setq buffer-read-only t)
;; FIXME: The header could also display the current default bookmark file
;; according to `bookmark-bookmarks-timestamp'.
(setq tabulated-list-format
`[("" 1) ;; Space to add "*" for bookmark with annotation
("Bookmark Name"
,bookmark-bmenu-file-column bookmark-bmenu--name-predicate)
("Type" 8 bookmark-bmenu--type-predicate)
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
,@(if bookmark-bmenu-toggle-filenames
'(("File" 0 bookmark-bmenu--file-predicate)))])
(setq tabulated-list-padding bookmark-bmenu-marks-width)
(when (and bookmark-sort-flag
(not (eq bookmark-sort-flag 'last-modified)))
(setq tabulated-list-sort-key '("Bookmark Name" . nil)))
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(add-hook 'tabulated-list-revert-hook #'bookmark-bmenu--revert nil t)'
(setq revert-buffer-function 'bookmark-bmenu--revert)
(tabulated-list-init-header))
(defun bookmark-bmenu--name-predicate (a b)
"Predicate to sort \"*Bookmark List*\" buffer by the name column.
This is used for `tabulated-list-format' in `bookmark-bmenu-mode'."
(string-collate-lessp (caar a) (caar b) nil t))
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(defun bookmark-bmenu--type-predicate (a b)
"Predicate to sort \"*Bookmark List*\" buffer by the type column.
This is used for `tabulated-list-format' in `bookmark-bmenu-mode'."
(string-collate-lessp (elt (cadr a) 2) (elt (cadr b) 2) nil t))
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(defun bookmark-bmenu--file-predicate (a b)
"Predicate to sort \"*Bookmark List*\" buffer by the file column.
This is used for `tabulated-list-format' in `bookmark-bmenu-mode'."
(string-collate-lessp (bookmark-location (car a))
(bookmark-location (car b))
nil t))
* lisp/simple.el (special-mode-map): Bind "h" to `describe-mode'; bind "z" to `kill-this-buffer'. (completion-list-mode-map): Bind "z" to `kill-this-buffer'. * lisp/apropos.el (apropos-mode-map): Inherit from `special-mode-map'. (apropos-mode): Inherit from `special-mode'. * lisp/arc-mode.el (archive-mode-map): Inherit from `special-mode-map'. * lisp/bookmark.el (bookmark-bmenu-mode): Define using `define-derived-mode' inheriting from `special-mode'. * lisp/dired.el (dired-mode-map): Inherit from `special-mode-map'. * lisp/image-mode.el (image-mode-map): Ditto. * lisp/replace.el (occur-mode): Define using `define-derived-mode' inheriting from `special-mode'. * lisp/tar-mode.el (tar-mode): Inherit from `special-mode'. * lisp/calendar/diary-lib.el (diary-fancy-display-mode): Inherit from `special-mode-map'. * lisp/emacs-lisp/ert.el (ert-simple-view-mode, ert-results-mode): Inherit from `special-mode'. * lisp/emacs-lisp/package.el (package-menu-mode-map): Copy from `special-mode-map'. (package-menu-mode): Define using `define-derived-mode' inheriting from `special-mode'. * erc/erc-list.el (erc-list-menu-mode): Inherit from `special-mode'. * lisp/net/xesam.el (xesam-mode): Inherit from `special-mode'. (xesam-mode-map): Define separately. * lisp/play/solitaire.el (solitaire-mode): Inherit from `special-mode'. * lisp/progmodes/compile.el (compilation-minor-mode-map) (compilation-mode-map): Inherit from `special-mode-map'. * lisp/vc/diff-mode.el (diff-mode-shared-map): Inherit from `special-mode-map'. * lisp/vc/log-view.el (log-view-mode-map): Add a comment.
2011-02-01 21:22:21 +00:00
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-toggle-filenames (&optional show)
"Toggle whether filenames are shown in the bookmark list.
Optional argument SHOW means show them unconditionally."
(interactive nil bookmark-bmenu-mode)
(cond
(show
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(setq bookmark-bmenu-toggle-filenames t))
(bookmark-bmenu-toggle-filenames
(setq bookmark-bmenu-toggle-filenames nil))
(t
(setq bookmark-bmenu-toggle-filenames t)))
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(bookmark-bmenu-surreptitiously-rebuild-list))
(defun bookmark-bmenu-show-filenames (&optional _)
"In an interactive bookmark list, show filenames along with bookmarks."
(setq bookmark-bmenu-toggle-filenames t)
(bookmark-bmenu-surreptitiously-rebuild-list))
(defun bookmark-bmenu-hide-filenames (&optional _)
"In an interactive bookmark list, hide the filenames of the bookmarks."
(setq bookmark-bmenu-toggle-filenames nil)
(bookmark-bmenu-surreptitiously-rebuild-list))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-ensure-position ()
"If point is not on a bookmark line, move it to one.
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
If after the last full line, move to the last full line. The
return value is undefined."
(cond ((and (bolp) (eobp))
(beginning-of-line 0))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-bookmark ()
* bookmark.el (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-set-name, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-location, bookmark-jump, bookmark-jump-other-window, bookmark-handle-bookmark, bookmark-relocate, bookmark-insert-location, bookmark-rename, bookmark-insert, bookmark-delete, bookmark-time-to-save-p, bookmark-edit-annotation-mode, bookmark-edit-annotation): Improve doc strings to say whether bookmark can be a string or a record or both, and make other consistency and clarity fixes. (bookmark-get-handler, bookmark--jump-via, bookmark-write-file, bookmark-default-annotation-text, bookmark-yank-word, bookmark-maybe-load-default-file, bookmark-maybe-sort-alist, bookmark-import-new-list, bookmark-maybe-rename, bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames, bookmark-bmenu-bookmark): Give these doc strings. (bookmark-bmenu-check-position): Give this a doc string, but also add a FIXME comment about how the function may be pointless. (bookmark-default-handler): Rework doc string and change a parameter name, to clarify that this takes a bookmark record not a bookmark name. (bookmark-set): Change a parameter name to indicate its meaning, and improve the doc string a bit. (Bug#4188)
2009-10-05 01:35:34 +00:00
"Return the bookmark for this line in an interactive bookmark list buffer."
(bookmark-bmenu-ensure-position)
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(let* ((id (tabulated-list-get-id))
(entry (and id (assoc id tabulated-list-entries))))
(if entry
(caar entry)
"")))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(defun bookmark-show-annotation (bookmark-name-or-record)
"Display the annotation for BOOKMARK-NAME-OR-RECORD in a buffer.
If the annotation does not exist, do nothing."
Adjust parameter names and doc strings to resolve confusion over whether "bookmark" meant a bookmark name or a bookmark record. Along the way, shorten one function's name for similar reasons. (Issue #7548) * lisp/bookmark.el (bookmark-name-from-record): New name for `bookmark-name-from-full-record'. All callers changed. (bookmark-get-bookmark, bookmark-get-bookmark-record, bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set, bookmark-get-annotation, bookmark-set-annotation, bookmark-get-filename, bookmark-set-filename, bookmark-get-position, bookmark-set-position, bookmark-get-front-context-string, bookmark-set-front-context-string, bookmark-get-rear-context-string, bookmark-set-rear-context-string, bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via, bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): Rename `bookmark' parameter to `bookmark-name-or-record', to clearly show its role, and shorten or adjust doc strings accordingly. (bookmark-set-name): Same, and pass the parameter directly to `bookmark-get-bookmark' instead of redundantly doing the callee's work. (bookmark-default-annotation-text, bookmark-send-edited-annotation, bookmark-relocate, bookmark-insert-location, bookmark-insert, bookmark-delete): Rename `bookmark' parameter to `bookmark-name', and in some cases shorten doc string accordingly. (bookmark-rename): Change `old' and `new' parameters to `old-name' and `new-name', and adjust an internal variable to avoid confusion. (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' parameter in doc string.
2010-12-08 08:09:27 +00:00
(let ((annotation (bookmark-get-annotation bookmark-name-or-record)))
(when (and annotation (not (string-equal annotation "")))
(save-excursion
(let ((old-buf (current-buffer)))
(pop-to-buffer (get-buffer-create "*Bookmark Annotation*") t)
(let (buffer-read-only)
(erase-buffer)
(insert annotation)
(goto-char (point-min))
(set-buffer-modified-p nil))
(setq buffer-read-only t)
(switch-to-buffer-other-window old-buf))))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-show-all-annotations ()
"Display the annotations for all bookmarks in a buffer."
(save-selected-window
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(pop-to-buffer (get-buffer-create "*Bookmark Annotation*") t)
(let (buffer-read-only)
(erase-buffer)
(dolist (full-record (bookmark-maybe-sort-alist))
(let* ((name (bookmark-name-from-full-record full-record))
(ann (bookmark-get-annotation full-record)))
(insert (concat name ":\n"))
(if (and ann (not (string-equal ann "")))
;; insert the annotation, indented by 4 spaces.
(progn
(save-excursion (insert ann) (unless (bolp)
(insert "\n")))
(while (< (point) (point-max))
(beginning-of-line) ; paranoia
(insert " ")
(forward-line)
(end-of-line))))))
(goto-char (point-min))
(set-buffer-modified-p nil))
(setq buffer-read-only t)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-mark ()
"Mark bookmark on this line to be displayed by \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-select]."
(interactive nil bookmark-bmenu-mode)
(bookmark-bmenu-ensure-position)
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(tabulated-list-put-tag ">" t))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
(defun bookmark-bmenu-mark-all ()
"Mark all listed bookmarks to be displayed by \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-select]."
(interactive nil bookmark-bmenu-mode)
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
(save-excursion
(goto-char (point-min))
(bookmark-bmenu-ensure-position)
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(while (not (eobp))
(tabulated-list-put-tag ">" t))))
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-select ()
"Select this line's bookmark; also display bookmarks marked with `>'.
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
You can mark bookmarks with the \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-mark] or \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-mark-all] commands."
(interactive nil bookmark-bmenu-mode)
(let ((bmrk (bookmark-bmenu-bookmark))
(menu (current-buffer))
(others ())
tem)
(goto-char (point-min))
(while (re-search-forward "^>" nil t)
(setq tem (bookmark-bmenu-bookmark))
(let ((inhibit-read-only t))
(delete-char -1)
(insert ?\s))
(or (string-equal tem bmrk)
(member 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 others
(while others
(split-window nil tem)
(other-window 1)
(bookmark-jump (car others))
(setq others (cdr others)))
(other-window 1))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-any-marks ()
"Return non-nil if any bookmarks are marked in the marks column."
(save-excursion
(goto-char (point-min))
(bookmark-bmenu-ensure-position)
(catch 'found-mark
(while (not (eobp))
(beginning-of-line)
(if (looking-at "^\\S-")
(throw 'found-mark t)
(forward-line 1)))
nil)))
(defun bookmark-bmenu-save ()
"Save the current list into a bookmark file.
With a prefix arg, prompt for a file to save them in.
See also the related behaviors of `bookmark-load' and
`bookmark-bmenu-load'."
(interactive nil bookmark-bmenu-mode)
(save-excursion
(save-window-excursion
(call-interactively 'bookmark-save)
(set-buffer-modified-p nil))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-load ()
"Load bookmarks from a file and rebuild the bookmark menu-buffer.
Prompt for a file, with the default choice being the value of
`bookmark-default-file'.
With a prefix argument, replace the current ambient bookmarks
(i.e., the ones in `bookmark-alist') with the ones from the selected
file and make that file be the new value of `bookmark-default-file'.
In other words, a prefix argument means \"switch over to the bookmark
universe defined in the loaded file\". Without a prefix argument,
just add the loaded bookmarks into the current ambient set.
See the documentation for `bookmark-load' for more details; see also
the related behaviors of `bookmark-save' and `bookmark-bmenu-save'."
(interactive nil bookmark-bmenu-mode)
(bookmark-bmenu-ensure-position)
(save-excursion
(save-window-excursion
;; This will call `bookmark-bmenu-list'
(call-interactively 'bookmark-load))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-1-window ()
"Select this line's bookmark, alone, in full frame."
(interactive nil bookmark-bmenu-mode)
(bookmark-jump (bookmark-bmenu-bookmark))
(bury-buffer (other-buffer))
(delete-other-windows))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-2-window ()
"Select this line's bookmark, with previous buffer in second window."
(interactive nil bookmark-bmenu-mode)
(let ((bmrk (bookmark-bmenu-bookmark))
(menu (current-buffer))
(pop-up-windows t))
(delete-other-windows)
(switch-to-buffer (other-buffer) nil t)
(bookmark--jump-via bmrk 'pop-to-buffer)
(bury-buffer menu)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-this-window ()
"Select this line's bookmark in this window."
(interactive nil bookmark-bmenu-mode)
(bookmark-jump (bookmark-bmenu-bookmark)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-other-window ()
"Select this line's bookmark in other window, leaving bookmark menu visible."
(interactive nil bookmark-bmenu-mode)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(let ((bookmark (bookmark-bmenu-bookmark)))
(bookmark--jump-via bookmark 'switch-to-buffer-other-window)))
(defun bookmark-bmenu-other-frame ()
"Select this line's bookmark in other frame."
(interactive nil bookmark-bmenu-mode)
(let ((bookmark (bookmark-bmenu-bookmark))
(pop-up-frames t))
(bookmark-jump-other-window bookmark)))
(defun bookmark-bmenu-switch-other-window ()
"Make the other window select this line's bookmark.
The current window remains selected."
(interactive nil bookmark-bmenu-mode)
(let ((bookmark (bookmark-bmenu-bookmark))
(fun (lambda (b) (display-buffer b t))))
(bookmark--jump-via bookmark fun)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-other-window-with-mouse (event)
"Jump to bookmark at mouse EVENT position in other window.
Move point in menu buffer to the position of EVENT and leave
bookmark menu visible."
(interactive "e" bookmark-bmenu-mode)
(with-current-buffer (window-buffer (posn-window (event-end event)))
(save-excursion
(goto-char (posn-point (event-end event)))
(bookmark-bmenu-other-window))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-show-annotation ()
"Show the annotation for the current bookmark in another window."
(interactive nil bookmark-bmenu-mode)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(let ((bookmark (bookmark-bmenu-bookmark)))
(bookmark-show-annotation bookmark)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-show-all-annotations ()
"Show the annotation for all bookmarks in another window."
(interactive nil bookmark-bmenu-mode)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(bookmark-show-all-annotations))
(defun bookmark-bmenu-edit-annotation ()
"Edit the annotation for the current bookmark in another window."
(interactive nil bookmark-bmenu-mode)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(let ((bookmark (bookmark-bmenu-bookmark)))
(bookmark-edit-annotation bookmark t)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-unmark (&optional backup)
"Cancel all requested operations on bookmark on this line and move down.
Optional BACKUP means move up."
(interactive "P" bookmark-bmenu-mode)
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
;; 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.
(bookmark-bmenu-ensure-position)
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(tabulated-list-put-tag " ")
(forward-line (if backup -1 1)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-backup-unmark ()
"Move up and cancel all requested operations on bookmark on line above."
(interactive nil bookmark-bmenu-mode)
(forward-line -1)
(bookmark-bmenu-ensure-position)
(bookmark-bmenu-unmark)
(forward-line -1)
(bookmark-bmenu-ensure-position))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
(defun bookmark-bmenu-unmark-all ()
"Cancel all requested operations on all listed bookmarks."
(interactive nil bookmark-bmenu-mode)
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
(save-excursion
(goto-char (point-min))
(bookmark-bmenu-ensure-position)
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(while (not (eobp))
(tabulated-list-put-tag " " t))))
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-delete ()
"Mark bookmark on this line to be deleted.
To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-execute-deletions]."
(interactive nil bookmark-bmenu-mode)
(bookmark-bmenu-ensure-position)
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(tabulated-list-put-tag "D" t))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-delete-backwards ()
"Mark bookmark on this line to be deleted, then move up one line.
To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-execute-deletions]."
(interactive nil bookmark-bmenu-mode)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(bookmark-bmenu-delete)
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(forward-line -2))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
(defun bookmark-bmenu-delete-all ()
"Mark all listed bookmarks as to be deleted.
To remove all deletion marks, use \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-unmark-all].
To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-execute-deletions]."
(interactive nil bookmark-bmenu-mode)
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
(save-excursion
(goto-char (point-min))
(bookmark-bmenu-ensure-position)
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293) Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode' allows us to greatly simplify the code in several cases. In addition, we get some features for free, such as sorting by column. The only functional step backwards is that we no longer support the optional "inline" header line, a bookmark.el-specific feature to have a header without using 'header-line-format'. This feature is believed to be not very useful or widely used. * lisp/bookmark.el (tabulated-list): Require. (bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of 'special-mode' and make the necessary changes to support that. (bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map' instead of 'special-mode-map'. Remove now duplicate key bindings. (bookmark-bmenu--revert): New function to show the bookmark list using 'tabulated-list-mode'. (bookmark-bmenu-list): Simplify by using above new function. (bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'. (bookmark-bmenu--name-predicate) (bookmark-bmenu--file-predicate): New functions used by 'tabulated-list-mode' to sort. (bookmark-bmenu-set-header): Redefine as obsolete function alias for 'tabulated-list-init-header'. (bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames) (bookmark-bmenu-hide-filenames, bookmark-bmenu-mark) (bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all) (bookmark-bmenu-delete-all, bookmark-bmenu-unmark) (bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now that we can depend on 'tabulated-list-mode' to do more work. (bookmark-bmenu-use-header-line) (bookmark-bmenu-inline-header-height): Declare variables relating to the now unsupported "inline" header obsolete. (bookmark-bmenu-ensure-position) (bookmark-bmenu-execute-deletions): Remove code to handle "inline" header. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-edit-annotation/show-annotation) (bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests for minor changes when using 'tabulated-list-mode'.
2020-10-17 15:56:44 +00:00
(while (not (eobp))
(tabulated-list-put-tag "D" t))))
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-execute-deletions ()
"Delete bookmarks flagged `D'.
If `bookmark-menu-confirm-deletion' is non-nil, prompt for
confirmation first."
(interactive nil bookmark-bmenu-mode)
(if (and bookmark-menu-confirm-deletion
(not (yes-or-no-p "Delete selected bookmarks? ")))
(message "Bookmarks not deleted.")
(let ((reporter (make-progress-reporter "Deleting bookmarks..."))
(o-point (point))
(o-str (save-excursion
(beginning-of-line)
(unless (= (following-char) ?D)
(buffer-substring
(point)
(progn (end-of-line) (point))))))
(o-col (current-column)))
(goto-char (point-min))
(while (re-search-forward "^D" (point-max) t)
(bookmark-delete (bookmark-bmenu-bookmark) t)) ; pass BATCH arg
(bookmark-bmenu-list)
(if o-str
(progn
(goto-char (point-min))
(search-forward o-str)
(beginning-of-line)
(forward-char o-col))
(goto-char o-point))
(beginning-of-line)
(progress-reporter-done reporter))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-rename ()
"Rename bookmark on current line. Prompts for a new name."
(interactive nil bookmark-bmenu-mode)
(let ((bmrk (bookmark-bmenu-bookmark))
(thispoint (point)))
(bookmark-rename bmrk)
(goto-char thispoint)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-locate ()
"Display the location of the bookmark for this line."
(interactive nil bookmark-bmenu-mode)
(let ((bmrk (bookmark-bmenu-bookmark)))
(message "%s" (bookmark-location bmrk))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-bmenu-relocate ()
"Change the absolute file name of the bookmark on the current line.
Prompt with completion for the new path."
(interactive nil bookmark-bmenu-mode)
(let ((bmrk (bookmark-bmenu-bookmark))
(thispoint (point)))
(bookmark-relocate bmrk)
(goto-char thispoint)))
;;; Bookmark-bmenu search
(defun bookmark-bmenu-filter-alist-by-regexp (regexp)
"Filter `bookmark-alist' with bookmarks matching REGEXP and rebuild list."
(let ((bookmark-alist
(cl-loop for i in bookmark-alist
when (string-match regexp (car i)) collect i into new
finally return new)))
(bookmark-bmenu-list)))
;;;###autoload
(defun bookmark-bmenu-search ()
"Incremental search of bookmarks, hiding the non-matches as we go."
(interactive nil bookmark-bmenu-mode)
(let ((bmk (bookmark-bmenu-bookmark))
(timer nil))
(unwind-protect
(minibuffer-with-setup-hook
(lambda ()
(setq timer (run-with-idle-timer
bookmark-search-delay 'repeat
Remove redundant #' before lambda * admin/unidata/unidata-gen.el (unidata-gen-table) (unidata-gen-table-symbol, unidata-gen-table-integer) (unidata-gen-table-numeric, unidata-gen-table-word-list) (unidata-describe-decomposition): * lisp/apropos.el (apropos-user-option): * lisp/bookmark.el (bookmark-bmenu-search): * lisp/composite.el (unicode-category-table): * lisp/elec-pair.el (electric-pair--balance-info): * lisp/electric.el (electric-quote-chars): * lisp/emulation/cua-base.el (cua-rectangle-mark-key): * lisp/epa-hook.el (epa-file-encrypt-to): * lisp/faces.el (face-font-selection-order) (face-font-family-alternatives, face-font-registry-alternatives) (face-valid-attribute-values, tty-run-terminal-initialization): * lisp/files.el (recover-file, file-expand-wildcards): * lisp/frame.el (frames-on-display-list): * lisp/help-at-pt.el (help-at-pt-display-when-idle): * lisp/help-fns.el (help-fns--face-attributes): * lisp/ido.el (ido-mode, ido-unc-hosts): * lisp/isearch.el (isearch-highlight-regexp) (isearch-highlight-lines-matching-regexp): * lisp/language/indian.el (script-regexp-alist): * lisp/language/lao.el: * lisp/leim/quail/ipa.el (ipa-x-sampa-prepend-to-keymap-entry): * lisp/mh-e/mh-folder.el (mh-process-commands): * lisp/mh-e/mh-mime.el (mh-display-with-external-viewer): * lisp/ps-mule.el (ps-mule-end-job): * lisp/ps-print.el (ps-color-scale, ps-background-pages) (ps-background-text, ps-background-image, ps-background) (ps-begin-job, ps-print-translation-table): * lisp/recentf.el (recentf-sort-ascending) (recentf-sort-descending, recentf-sort-basenames-ascending) (recentf-sort-basenames-descending) (recentf-sort-directories-ascending) (recentf-sort-directories-descending): * lisp/replace.el (occur-engine-add-prefix): * lisp/select.el (xselect--encode-string): * lisp/server.el (server-use-tcp): * lisp/ses.el (ses-sort-column): * lisp/sort.el (sort-columns): * lisp/term/ns-win.el (window-system-initialization): * lisp/tree-widget.el (tree-widget-image-formats): * lisp/whitespace.el (whitespace-report-region): Remove redundant #' before lambda.
2021-10-21 21:35:07 +00:00
(lambda (buf)
(with-current-buffer buf
(bookmark-bmenu-filter-alist-by-regexp
(minibuffer-contents))))
(current-buffer))))
(read-string "Pattern: ")
(when timer (cancel-timer timer) (setq timer nil)))
2016-12-22 18:13:46 +00:00
(when timer ;; Signaled an error or a `quit'.
(cancel-timer timer)
(bookmark-bmenu-list)
(bookmark-bmenu-goto-bookmark bmk)))))
(defun bookmark-bmenu-goto-bookmark (name)
"Move point to bookmark with name NAME."
(goto-char (point-min))
(while (not (or (equal name (bookmark-bmenu-bookmark))
(eobp)))
(forward-line 1))
(forward-line 0))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;; Menu bar stuff. Prefix is "bookmark-menu".
1993-08-13 00:59:51 +00:00
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defun bookmark-menu-popup-paned-menu (event name entries)
"Pop up multi-paned menu at EVENT, return string chosen from ENTRIES.
That is, ENTRIES is a list of strings which appear as the choices
in the menu.
The number of panes depends on the number of entries.
The visible entries are truncated to `bookmark-menu-length', but the
strings returned are not."
(let ((f-height (/ (frame-height) 2))
(pane-list nil)
(iter 0))
(while entries
(let (lst
(count 0))
(while (and (< count f-height) entries)
(let ((str (car entries)))
(push (cons
(if (> (length str) bookmark-menu-length)
(substring str 0 bookmark-menu-length)
str)
str)
lst)
(setq entries (cdr entries))
(setq count (1+ count))))
(setq iter (1+ iter))
(push (cons
(format "-*- %s (%d) -*-" name iter)
(nreverse lst))
pane-list)))
;; Popup the menu and return the string.
(x-popup-menu event (cons (concat "-*- " name " -*-")
(nreverse pane-list)))))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
1993-08-10 20:35:31 +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
;; We MUST autoload EACH form used to set up this variable's value, so
;; that the whole job is done in loaddefs.el.
1993-08-10 20:35:31 +00:00
;; Emacs menubar stuff.
;;;###autoload
(defvar menu-bar-bookmark-map
(let ((map (make-sparse-keymap "Bookmark functions")))
(bindings--define-key map [load]
'(menu-item "Load a Bookmark File..." bookmark-load
:help "Load bookmarks from a bookmark file)"))
(bindings--define-key map [write]
'(menu-item "Save Bookmarks As..." bookmark-write
:help "Write bookmarks to a file (reading the file name with the minibuffer)"))
(bindings--define-key map [save]
'(menu-item "Save Bookmarks" bookmark-save
:help "Save currently defined bookmarks"))
(bindings--define-key map [edit]
'(menu-item "Edit Bookmark List" bookmark-bmenu-list
:help "Display a list of existing bookmarks"))
(bindings--define-key map [delete]
'(menu-item "Delete Bookmark..." bookmark-delete
:help "Delete a bookmark from the bookmark list"))
Add ability to mark/unmark/delete all bookmarks Thanks to Karl Fogel for pre-commit review. * lisp/bookmark.el (bookmark-delete-all): New function to delete all bookmarks. (bookmark-bmenu-mark-all): New function to mark all bookmarks in the bookmark list buffer. (bookmark-bmenu-unmark-all): New function to unmark all bookmarks in the bookmark list buffer. (bookmark-bmenu-delete-all): New function to mark for deletion all bookmarks in the bookmark list buffer. (bookmark-map): Map "D" to `bookmark-delete-all'. (bookmark-bmenu-mode-map): New mappping for "M" to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode-map): New mappping for "U" to `bookmark-bmenu-unmark-all'. (bookmark-bmenu-mode-map): New mappping for "D" to `bookmark-bmenu-delete-all'. (bookmark-bmenu-mark-all): New bookmark menu to `bookmark-delete-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-mark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-unmark-all'. (easy-menu-define): New bookmark menu to `bookmark-bmenu-delete-all'. (bookmark-bmenu-select): Update docstring to include a reference to `bookmark-bmenu-mark-all'. (bookmark-bmenu-mode): Update docstring. Add/Update description: `bookmark-bmenu-mark-all', `bookmark-bmenu-delete-all', `bookmark-bmenu-execute-deletions', and `bookmark-bmenu-unmark-all'. * test/lisp/bookmark-resources/test-list.bmk: New bookmark file to test a list of bookmarks. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file-list): New reference to the bookmark file used for testing a list of bookmarks. (bookmark-tests-bookmark-list-0, bookmark-tests-bookmark-list-1, bookmark-tests-bookmark-list-2): New cached values for testing a list of bookmark. (bookmark-tests-cache-timestamp-list): New variable to set `bookmark-bookmarks-timestamp'. (with-bookmark-test-list): New macro environment to test a list of bookmarks. (with-bookmark-test-file-list): New macro environment to test a list of bookmarks with example.txt. (with-bookmark-bmenu-test-list): New macro environment to test functions about a list of bookmarks from `bookmark-bmenu-list'. (bookmark-tests-all-names-list, bookmark-tests-get-bookmark-list, bookmark-tests-get-bookmark-record-list): New functions to test the records of the list of bookmarks. (bookmark-tests-make-record-list): New function to test the creation of a record from example.txt with a list of bookmarks loaded. (bookmark-tests-delete-all): New function to test `bookmark-delete-all'. (bookmark-test-bmenu-any-marks-list): New function to test `bookmark-bmenu-any-marks' with a list of bookmarks. (bookmark-test-bmenu-mark-all): New function to test `bookmark-bmenu-mark-all'. (bookmark-test-bmenu-unmark-all): New function to test `bookmark-bmenu-unmark-all'. (bookmark-test-bmenu-delete-all): New function to test `bookmark-bmenu-delete-all'.
2020-07-23 21:14:32 +00:00
(bindings--define-key map [delete-all]
'(menu-item "Delete all Bookmarks..." bookmark-delete-all
:help "Delete all bookmarks from the bookmark list"))
(bindings--define-key map [rename]
'(menu-item "Rename Bookmark..." bookmark-rename
:help "Change the name of a bookmark"))
(bindings--define-key map [locate]
'(menu-item "Insert Location..." bookmark-locate
:help "Insert the name of the file associated with a bookmark"))
(bindings--define-key map [insert]
'(menu-item "Insert Contents..." bookmark-insert
:help "Insert the text of the file pointed to by a bookmark"))
(bindings--define-key map [set]
'(menu-item "Set Bookmark..." bookmark-set
:help "Set a bookmark named inside a file."))
(bindings--define-key map [jump]
'(menu-item "Jump to Bookmark..." bookmark-jump
:help "Jump to a bookmark (a point in some file)"))
map))
;;;###autoload
(defalias 'menu-bar-bookmark-map menu-bar-bookmark-map)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;; make bookmarks appear toward the right side of the menu.
(if (boundp 'menu-bar-final-items)
2001-01-12 22:49:40 +00:00
(if menu-bar-final-items
(push 'bookmark menu-bar-final-items))
(setq menu-bar-final-items '(bookmark)))
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;;;; end bookmark menu stuff ;;;;
;; Load Hook
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(defvar bookmark-load-hook nil
"Hook run at the end of loading library `bookmark.el'.")
(make-obsolete-variable 'bookmark-load-hook
"use `with-eval-after-load' instead." "28.1")
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
;; Exit Hook, called from kill-emacs-hook
(defvar bookmark-exit-hook nil
"Hook run when Emacs exits.")
(defun bookmark-exit-hook-internal ()
"Save bookmark state, if necessary, at Emacs exit time.
This also runs `bookmark-exit-hook'."
(run-hooks 'bookmark-exit-hook)
(and (bookmark-time-to-save-p t)
(bookmark-save)))
(unless noninteractive
(add-hook 'kill-emacs-hook 'bookmark-exit-hook-internal))
(defun bookmark-unload-function ()
"Unload the Bookmark library."
(when bookmark-save-flag (bookmark-save))
;; continue standard unloading
nil)
Insure that all entry points call `bookmark-maybe-load-default-file'. Changed format of bookmark-alist and therefore of bookmark files. Have version stamps in bookmark files. Automatically upgrade old bookmark files to new format. Changed name of default bookmark file to ".emacs.bmk". Replaced "Bookmark-menu" with "bookmark-bmenu". The capitalization signified nothing; "bmenu" means "buffer-menu" -- that is, bmenu code is for the dired-like of bookmarks that appears when `list-bookmarks' is run, and the "bookmark-menu" prefix is for the menu-bar. Internally, use an alist instead of hardcoded list-positions for storing bookmark information. Applied <johng@media.mit.edu>'s patches for annotation support: (bookmark-send-annotation, bookmark-read-annotation-mode) (bookmark-edit-annotation-mode, bookmark-default-annotation-text) (bookmark-read-annotation-text-func, bookmark-read-annotation) (bookmark-send-edited-annotation, bookmark-edit-annotation): New functions. (bookmark-get-bookmark, bookmark-get-bookmark-record) (bookmark-name-from-full-record, bookmark-set-name) (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-info-node, bookmark-set-info-node) (bookmark-get-filename, bookmark-set-filename) (bookmark-get-position, bookmark-set-position) (bookmark-get-front-context-string, bookmark-set-front-context-string) (bookmark-get-rear-context-string, bookmark-set-rear-context-string): New subroutines. (bookmark-file-format-version, bookmark-end-of-version-stamp-marker): New variables. (bookmark-grok-file-format-version, bookmark-maybe-upgrade-file-format) (bookmark-upgrade-version-0-alist, bookmark-upgrade-file-format-from-0) (bookmark-insert-file-format-version-stamp): New functions. (bookmark-maybe-load-default-file): Renamed from bookmark-try-default-file'. (bookmark-old-default-file): New variable. (bookmark-default-file): Renamed from `bookmark-file'. New initial value, ".emacs.bmk". (bookmark-make-cell): Use backquote. Produce with the new format (Format Version 1). Use `format' to strip text-properties. (bookmark-write-file): Use `pp' instead of `princ'. Call `bookmark-insert-file-format-version-stamp'. (bookmark-all-names, bookmark-menu-popup-paned-bookmark-menu) (bookmark-menu-build-paned-menu, bookmark-menu-popup-paned-menu) (bookmark-insert-location): New functions. (bookmark-completing-read): New function. Everyone who called `completing-read' in the interactive spec now calls this. (bookmark-load-hook): New hook. (bookmark-make-menu-alist): Function deleted. (bookmark-popup-menu-and-apply-function): replaces `bookmark-make-menu-with-function'. (bookmark-load): Use `bookmark-alist-from-buffer'. Call `bookmark-maybe-upgrade-file-format'. (bookmark-set): If Info mode, record Info-current-node. Use `bookmark-bmenu-surreptitiously-rebuild-list'. (bookmark-buffer-file-name): Handle Info files. (bookmark-buffer-name): If Info mode, return Info-current-node. (bookmark-jump-noselect): For info node, use Info-goto-node. Use the helper functions, don't mess with the raw alist (except in completion, which we'll take care of later). Don't count on `bookmark-search-size' being correct; use the length of `forward-str' and `behind-str' instead. (bookmark-relocate): Use the helper functions; don't mess with the raw alist except in completion. (bookmark-rename): C-o in minibuffer now inserts old name. (bookmark-delete): New arg BATCH. (bookmark-bmenu-execute-deletions): Was `bookmark-bmenu-execute'. Just call bookmark-delete with the BATCH arg. Set the modification count and maybe save when done. Save point intuitively. (bookmark-insert-current-file-name): Just use `file-name-nondirectory'. (bookmark-location): Made non-interactive. (bookmark-bmenu-list): Replaces `list-bookmarks'. Delete arg ANNOTATION. Use mapcar to simplify. If not interactive-p, then use `set-buffer' instead of `switch-to-buffer'. (bookmark-kill-line): New function, used instead of kill-line. (bookmark-search-size): Init to 16 instead of 500.
1995-03-11 02:05:20 +00:00
(run-hooks 'bookmark-load-hook)
1993-08-10 20:35:31 +00:00
;;; Obsolete:
(define-obsolete-function-alias 'bookmark-send-edited-annotation
#'bookmark-edit-annotation-confirm "29.1")
1993-08-10 20:35:31 +00:00
(provide 'bookmark)
2001-01-12 22:49:40 +00:00
1993-08-13 00:59:51 +00:00
;;; bookmark.el ends here