Mercurial > emacs
view lisp/emacs-lisp/lselect.el @ 10219:d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
(sort-subr): Don't call autload for this--that's done in loaddefs.el.
(bibtex-mode): Add autoload cookie.
Changed keybinding for bibtex-print-help-message
(from \C-ch to \C-c?). Therefore, describe-mode is not longer on
\C-c?. Also, changed prefix \C-cn for bibtex-narrow functions to
\C-c\C-r.
(bibtex-string-files): Changed documentation.
(bibtex-mode-map): Inscriptions of menu bar changed from "Entry
Types" to "Entry-Types" and "Bibtex Edit" to "BibTeX-Edit".
(bibtex-string-files): Changed documentation.
(bibtex-mode): If environment variable BIBINPUTS isn't defined,
string files are searched in the current directory.
(bibtex-completion-candidates): Now buffer-local to allow
evaluation of different bibtex-string-files in different buffers.
(bibtex-autokey-edit-before-use, bibtex-clean-entry): New variable
that determines, if the user is allowed to edit auto-generated
reference keys before they are used.
(bibtex-generate-autokey, bibtex-clean-entry): New function to
generate an autokey if necessary.
(bibtex-autokey-names, bibtex-autokey-name-change-strings,
bibtex-autokey-name-length, bibtex-autokey-name-separator,
bibtex-autokey-year-length, bibtex-autokey-titlewords,
bibtex-autokey-title-terminators,
bibtex-autokey-titlewords-stretch,
bibtex-autokey-titleword-first-ignore,
bibtex-autokey-titleword-abbrevs,
bibtex-autokey-titleword-change-strings,
bibtex-autokey-titleword-length,
bibtex-autokey-titleword-separator,
bibtex-autokey-name-year-separator,
bibtex-autokey-year-title-separator): New variables related to
bibtex-generate-autokey.
(bibtex-find-entry-location): Optional second parameter maybedup
to tell it that entering a duplicate entry isn't to report by an
error but by the return value of the function (necessary for
bibtex-clean-entry to find the correct position of an entry with
an autogenerated key without disturbing the user with unwanted
messages).
(bibtex-help-message): New variable to avoid printing of help
messages in the echo area.
(assoc-of-regexp): New function to match an alist of regexps.
(bibtex-string-files, bibtex-completion-candidates, bibtex-mode):
New variables to allow bibtex-complete-string to work on strings
initialized from a variable and from @String definitions in a list
of files, too.
(bibtex-predefined-strings, bibtex-entry-field-alist): Changed to
user options.
(bibtex-mode): Changed doc string.
(many functions and variables): Changed documentation strings of
variables and functions to hold a complete sentence in the first
line.
(bibtex-print-help-message): Now line dependent and reports if it
is called outside a BibTeX field.
(validate-bibtex-buffer): Completely rewritten to validate, if
buffer is syntactically correct.
(find-bibtex-duplicates): Moved into validate-bibtex-buffer.
(ispell-abstract, bibtex-ispell-abstract, ispell-bibtex-entry,
bibtex-ispell-entry, beginning-of-bibtex-entry,
bibtex-beginning-of-entry, end-of-bibtex-entry,
bibtex-end-of-entry, hide-bibtex-entry-bodies,
bibtex-hide-entry-bodies, narrow-to-bibtex-entry,
bibtex-narrow-to-entry, sort-bibtex-entries, bibtex-sort-entries,
validate-bibtex-buffer, bibtex-validate-buffer,
find-bibtex-entry-location, bibtex-find-entry-location): All
interactive functions are renamed, so that any interface function
begins with "bibtex-". Mapping:
ispell-abstract --> bibtex-ispell-abstract
ispell-bibtex-entry --> bibtex-ispell-entry
beginning-of-bibtex-entry --> bibtex-beginning-of-entry
end-of-bibtex-entry --> bibtex-end-of-entry
hide-bibtex-entry-bodies --> bibtex-hide-entry-bodies
narrow-to-bibtex-entry --> bibtex-narrow-to-entry
sort-bibtex-entries --> bibtex-sort-entries
validate-bibtex-buffer --> bibtex-validate-buffer
find-bibtex-entry-location --> bibtex-find-entry-location
(bibtex-maintain-sorted-entries,
bibtex-sort-ignore-string-entries): Default is now t.
(bibtex-complete-string): String list is built from additional
string list bibtex-predefined-string and current strings in file.
(string-equalp): Deleted and substituted by string-equal.
(assoc-string-equalp): Renamed to assoc-ignore-case.
(bibtex-entry): Reference key can be entered with completion. All
reference keys that are defined in buffer and all labels that
appear in crossreference entries are object to completion.
(Entry types): Changed order of entries in menu "entry types".
(bibtex-entry-field-alist): Changed order of entries slightly to
be more conform with standard BibTeX style layouts.
(bibtex-mode-map): Uniform keybindings for \C-c\C-e prefix (often
used types on control keys, sometimes used types on normal keys,
rarely used types on shift keys, almost never used types on meta
keys).
(bibtex-mode-map): Function narrow-to-bibtex-entry and counterpart
widen and function hide-bibtex-entry-bodies and counterpart
show-all bounded to appropriate local keys.
(bibtex-abbrev-table): Deleted
(bibtex-current-entry-label, put-string-on-kill-ring): Deleted
(AUCTeX provides all the functionality needed for citation
completion).
(bibtex-enclosing-reference, bibtex-pop-previous, bibtex-pop-next,
bibtex-clean-entry): Hacked for speed (bibtex-pop-previous and
bibtex-pop-next were to slow for larger BibTeX files).
(bibtex-pop-previous, bibtex-pop-next): Delimiters from previous
or next entry are changed to actual delimters if necessary.
(bibtex-entry): Fixed bug (False entry wasn't reported in error
message if bibtex-entry was called with undefined reference name).
(bibtex-entry-field-alist, bibtex-entry, bibtex-make-field,
bibtex-next-field, bibtex-clean-entry): Every reference entry now
contains a comment in addition to the name of the reference. This
comment appears in the echo area if you start editing that field
(after calling bibtex-next-field).
(bibtex-include-OPTcrossref, bibtex-entry): Changed
bibtex-include-OPTcrossref from single boolean variable to hold a
list of reference names which should have a crossref field.
(bibtex-complete-word): New function, which completes word
fragment before point to the longest prefix of predefined strings
in the buffer in the same way that ispell-complete-word operates
for words found in the dictionary.
(bibtex-reference-head): Start of bibtex-reference-head changed
from "^[ \t]*\\(" to "^\\( \\|\t\\)*\\(" (bibtex-pop-previous and
bibtex-pop-next didn't work, probably due to a bug in
re-search-forward).
(several functions): Added support for {} as field delimiters
(better than '"' for accented characters.
(bibtex-clean-entry): If optional field crossref is empty or
missing, former optional fields (if bibtex-include-OPTcrossref was
t) are necessary again. bibtex-clean-entry complains if they are
empty but not if they are missing, so you can intenionally omit
them, e. g. for a pseudo @Journal entry (needed for
crossreferences) made out of an @article with missing non-optional
fields.
Menu bar entries aren't centered anymore.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 23 Dec 1994 04:18:29 +0000 (1994-12-23) |
parents | b65cf676a09b |
children | 83f275dcd93a |
line wrap: on
line source
;;; lselect.el --- Lucid interface to X Selections ;; Keywords: emulations ;; This won't completely work until we support or emulate Lucid-style extents. ;; Copyright (C) 1990, 1993 Free Software Foundation, Inc. ;; Based on Lucid's selection code. ;; This file is part of GNU Emacs. ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. ;;; Code: ;;; The selection code requires us to use certain symbols whose names are ;;; all upper-case; this may seem tasteless, but it makes there be a 1:1 ;;; correspondence between these symbols and X Atoms (which are upcased.) (defalias 'x-get-cutbuffer 'x-get-cut-buffer) (defalias 'x-store-cutbuffer 'x-set-cut-buffer) (or (find-face 'primary-selection) (make-face 'primary-selection)) (or (find-face 'secondary-selection) (make-face 'secondary-selection)) (defun x-get-secondary-selection () "Return text selected from some X window." (x-get-selection-internal 'SECONDARY 'STRING)) (defvar primary-selection-extent nil "The extent of the primary selection; don't use this.") (defvar secondary-selection-extent nil "The extent of the secondary selection; don't use this.") (defun x-select-make-extent-for-selection (selection previous-extent face) ;; Given a selection, this makes an extent in the buffer which holds that ;; selection, for highlighting purposes. If the selection isn't associated ;; with a buffer, this does nothing. (let ((buffer nil) (valid (and (extentp previous-extent) (extent-buffer previous-extent) (buffer-name (extent-buffer previous-extent)))) start end) (cond ((stringp selection) ;; if we're selecting a string, lose the previous extent used ;; to highlight the selection. (setq valid nil)) ((consp selection) (setq start (min (car selection) (cdr selection)) end (max (car selection) (cdr selection)) valid (and valid (eq (marker-buffer (car selection)) (extent-buffer previous-extent))) buffer (marker-buffer (car selection)))) ((extentp selection) (setq start (extent-start-position selection) end (extent-end-position selection) valid (and valid (eq (extent-buffer selection) (extent-buffer previous-extent))) buffer (extent-buffer selection))) ) (if (and (not valid) (extentp previous-extent) (extent-buffer previous-extent) (buffer-name (extent-buffer previous-extent))) (delete-extent previous-extent)) (if (not buffer) ;; string case nil ;; normal case (if valid (set-extent-endpoints previous-extent start end) (setq previous-extent (make-extent start end buffer)) ;; use same priority as mouse-highlighting so that conflicts between ;; the selection extent and a mouse-highlighted extent are resolved ;; by the usual size-and-endpoint-comparison method. (set-extent-priority previous-extent mouse-highlight-priority) (set-extent-face previous-extent face))))) (defun x-own-selection (selection &optional type) "Make a primary X Selection of the given argument. The argument may be a string, a cons of two markers, or an extent. In the latter cases the selection is considered to be the text between the markers, or the between extents endpoints." (interactive (if (not current-prefix-arg) (list (read-string "Store text for pasting: ")) (list (cons ;; these need not be ordered. (copy-marker (point-marker)) (copy-marker (mark-marker)))))) (or type (setq type 'PRIMARY)) (x-set-selection selection type) (cond ((eq type 'PRIMARY) (setq primary-selection-extent (x-select-make-extent-for-selection selection primary-selection-extent 'primary-selection))) ((eq type 'SECONDARY) (setq secondary-selection-extent (x-select-make-extent-for-selection selection secondary-selection-extent 'secondary-selection)))) selection) (defun x-own-secondary-selection (selection &optional type) "Make a secondary X Selection of the given argument. The argument may be a string or a cons of two markers (in which case the selection is considered to be the text between those markers.)" (interactive (if (not current-prefix-arg) (list (read-string "Store text for pasting: ")) (list (cons ;; these need not be ordered. (copy-marker (point-marker)) (copy-marker (mark-marker)))))) (x-own-selection selection 'SECONDARY)) (defun x-own-clipboard (string) "Paste the given string to the X Clipboard." (x-own-selection string 'CLIPBOARD)) (defun x-disown-selection (&optional secondary-p) "Assuming we own the selection, disown it. With an argument, discard the secondary selection instead of the primary selection." (x-disown-selection-internal (if secondary-p 'SECONDARY 'PRIMARY))) (defun x-dehilight-selection (selection) "for use as a value of x-lost-selection-hooks." (cond ((eq selection 'PRIMARY) (if primary-selection-extent (let ((inhibit-quit t)) (delete-extent primary-selection-extent) (setq primary-selection-extent nil))) (if zmacs-regions (zmacs-deactivate-region))) ((eq selection 'SECONDARY) (if secondary-selection-extent (let ((inhibit-quit t)) (delete-extent secondary-selection-extent) (setq secondary-selection-extent nil))))) nil) (setq x-lost-selection-hooks 'x-dehilight-selection) (defun x-notice-selection-requests (selection type successful) "for possible use as the value of x-sent-selection-hooks." (if (not successful) (message "Selection request failed to convert %s to %s" selection type) (message "Sent selection %s as %s" selection type))) (defun x-notice-selection-failures (selection type successful) "for possible use as the value of x-sent-selection-hooks." (or successful (message "Selection request failed to convert %s to %s" selection type))) ;(setq x-sent-selection-hooks 'x-notice-selection-requests) ;(setq x-sent-selection-hooks 'x-notice-selection-failures) ;;; Random utility functions (defun x-kill-primary-selection () "If there is a selection, delete the text it covers, and copy it to both the kill ring and the Clipboard." (interactive) (or (x-selection-owner-p) (error "emacs does not own the primary selection")) (setq last-command nil) (or primary-selection-extent (error "the primary selection is not an extent?")) (save-excursion (set-buffer (extent-buffer primary-selection-extent)) (kill-region (extent-start-position primary-selection-extent) (extent-end-position primary-selection-extent))) (x-disown-selection nil)) (defun x-delete-primary-selection () "If there is a selection, delete the text it covers *without* copying it to the kill ring or the Clipboard." (interactive) (or (x-selection-owner-p) (error "emacs does not own the primary selection")) (setq last-command nil) (or primary-selection-extent (error "the primary selection is not an extent?")) (save-excursion (set-buffer (extent-buffer primary-selection-extent)) (delete-region (extent-start-position primary-selection-extent) (extent-end-position primary-selection-extent))) (x-disown-selection nil)) (defun x-copy-primary-selection () "If there is a selection, copy it to both the kill ring and the Clipboard." (interactive) (setq last-command nil) (or (x-selection-owner-p) (error "emacs does not own the primary selection")) (or primary-selection-extent (error "the primary selection is not an extent?")) (save-excursion (set-buffer (extent-buffer primary-selection-extent)) (copy-region-as-kill (extent-start-position primary-selection-extent) (extent-end-position primary-selection-extent)))) (defun x-yank-clipboard-selection () "If someone owns a Clipboard selection, insert it at point." (interactive) (setq last-command nil) (let ((clip (x-get-clipboard))) (or clip (error "there is no clipboard selection")) (push-mark) (insert clip))) ;;; lselect.el ends here.