diff options
Diffstat (limited to 'lisp/textmodes')
| -rw-r--r-- | lisp/textmodes/artist.el | 2 | ||||
| -rw-r--r-- | lisp/textmodes/bibtex.el | 51 | ||||
| -rw-r--r-- | lisp/textmodes/flyspell.el | 25 | ||||
| -rw-r--r-- | lisp/textmodes/ispell.el | 16 | ||||
| -rw-r--r-- | lisp/textmodes/refill.el | 10 | ||||
| -rw-r--r-- | lisp/textmodes/reftex-cite.el | 6 | ||||
| -rw-r--r-- | lisp/textmodes/reftex-parse.el | 19 | ||||
| -rw-r--r-- | lisp/textmodes/reftex-vars.el | 50 | ||||
| -rw-r--r-- | lisp/textmodes/reftex.el | 10 | ||||
| -rw-r--r-- | lisp/textmodes/remember.el | 29 | ||||
| -rw-r--r-- | lisp/textmodes/rst.el | 2 |
11 files changed, 155 insertions, 65 deletions
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el index 2bd7283676e..0d9c8eb7c64 100644 --- a/lisp/textmodes/artist.el +++ b/lisp/textmodes/artist.el @@ -1449,6 +1449,8 @@ Keymap summary (message ""))) (artist-mode-line-show-curr-operation artist-key-is-drawing)) +(declare-function picture-mode-exit "picture" (&optional nostrip)) + (defun artist-mode-exit () "Exit Artist mode. This will call the hook `artist-mode-hook'." (if (and artist-picture-compatibility (eq major-mode 'picture-mode)) diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index aa20b739946..01a126eb381 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -3020,11 +3020,14 @@ Parsing initializes `bibtex-reference-keys' and `bibtex-strings'." Visit the BibTeX files defined by `bibtex-files' and return a list of corresponding buffers. Initialize in these buffers `bibtex-reference-keys' if not yet set. -List of BibTeX buffers includes current buffer if CURRENT is non-nil. +List of BibTeX buffers includes current buffer if CURRENT is non-nil +and the current buffer visits a file using `bibtex-mode'. If FORCE is non-nil, (re)initialize `bibtex-reference-keys' even if already set. If SELECT is non-nil interactively select a BibTeX buffer. -When called interactively, FORCE is t, CURRENT is t if current buffer uses -`bibtex-mode', and SELECT is t if current buffer does not use `bibtex-mode'," + +When called interactively, FORCE is t, CURRENT is t if current buffer +visits a file using `bibtex-mode', and SELECT is t if current buffer +does not use `bibtex-mode'," (interactive (list (eq major-mode 'bibtex-mode) t (not (eq major-mode 'bibtex-mode)))) (let ((file-path (split-string (or bibtex-file-path default-directory) ":+")) @@ -3062,10 +3065,12 @@ When called interactively, FORCE is t, CURRENT is t if current buffer uses (if (file-readable-p file) (push (find-file-noselect file) buffer-list))) ;; Include current buffer iff we want it. - ;; Exclude current buffer if it doesn't use `bibtex-mode'. - ;; Thus calling `bibtex-initialize' gives meaningful results for - ;; any current buffer. - (unless (and current (eq major-mode 'bibtex-mode)) (setq current nil)) + ;; Exclude current buffer if it does not visit a file using `bibtex-mode'. + ;; This way we exclude BibTeX buffers such as `bibtex-search-buffer' + ;; that are not visiting a BibTeX file. Also, calling `bibtex-initialize' + ;; gives meaningful results for any current buffer. + (unless (and current (eq major-mode 'bibtex-mode) buffer-file-name) + (setq current nil)) (cond ((and current (not (memq (current-buffer) buffer-list))) (push (current-buffer) buffer-list)) ((and (not current) (memq (current-buffer) buffer-list)) @@ -5163,6 +5168,9 @@ Return the URL or nil if none can be generated." (if (stringp (car scheme)) (setq fmt (pop scheme))) (dolist (step scheme) + ;; In the first STEP, if the field contains multiple + ;; matches, we want the match the closest to point. + ;; (if (eq step (car scheme)) (setq text (cdr (assoc-string (car step) fields-alist t))) (if (string-match (nth 1 step) text) (push (cond ((functionp (nth 2 step)) @@ -5233,19 +5241,22 @@ where FILE is the BibTeX file of ENTRY." (if (string= "" field) ;; Unrestricted search. (while (re-search-forward regexp nil t) - (let ((beg (bibtex-beginning-of-entry)) - (end (bibtex-end-of-entry)) - key) - (if (and (<= beg (match-beginning 0)) - (<= (match-end 0) end) - (save-excursion - (goto-char beg) - (and (looking-at bibtex-entry-head) - (setq key (bibtex-key-in-head)))) - (not (assoc key entries))) - (push (list key file - (buffer-substring-no-properties beg end)) - entries)))) + (save-excursion + (let ((mbeg (match-beginning 0)) + (mend (match-end 0)) + (beg (bibtex-beginning-of-entry)) + (end (bibtex-end-of-entry)) + key) + (if (and (<= beg mbeg) + (<= mend end) + (progn + (goto-char beg) + (looking-at bibtex-entry-head)) + (setq key (bibtex-key-in-head)) + (not (assoc key entries))) + (push (list key file + (buffer-substring-no-properties beg end)) + entries))))) ;; The following is slow. But it works reliably even in more ;; complicated cases with BibTeX string constants and crossrefed ;; entries. If you prefer speed over reliability, perform an diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 6ab3e3d3f16..81f17c897eb 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -738,7 +738,7 @@ before the current command." (let ((ispell-otherchars (ispell-get-otherchars))) (cond ((not (and (numberp flyspell-pre-point) - (buffer-live-p flyspell-pre-buffer))) + (eq flyspell-pre-buffer (current-buffer)))) nil) ((and (eq flyspell-pre-pre-point flyspell-pre-point) (eq flyspell-pre-pre-buffer flyspell-pre-buffer)) @@ -956,11 +956,10 @@ Mostly we check word delimiters." ;; Prevent anything we do from affecting the mark. deactivate-mark) (if (flyspell-check-pre-word-p) - (with-current-buffer flyspell-pre-buffer + (save-excursion '(flyspell-debug-signal-pre-word-checked) - (save-excursion - (goto-char flyspell-pre-point) - (flyspell-word)))) + (goto-char flyspell-pre-point) + (flyspell-word))) (if (flyspell-check-word-p) (progn '(flyspell-debug-signal-word-checked) @@ -974,16 +973,14 @@ Mostly we check word delimiters." ;; FLYSPELL-CHECK-PRE-WORD-P (setq flyspell-pre-pre-buffer (current-buffer)) (setq flyspell-pre-pre-point (point))) - (progn - (setq flyspell-pre-pre-buffer nil) - (setq flyspell-pre-pre-point nil) - ;; when a word is not checked because of a delayed command - ;; we do not disable the ispell cache. - (if (and (symbolp this-command) + (setq flyspell-pre-pre-buffer nil) + (setq flyspell-pre-pre-point nil) + ;; when a word is not checked because of a delayed command + ;; we do not disable the ispell cache. + (when (and (symbolp this-command) (get this-command 'flyspell-delayed)) - (progn - (setq flyspell-word-cache-end -1) - (setq flyspell-word-cache-result '_))))) + (setq flyspell-word-cache-end -1) + (setq flyspell-word-cache-result '_))) (while (and (not (input-pending-p)) (consp flyspell-changes)) (let ((start (car (car flyspell-changes))) (stop (cdr (car flyspell-changes)))) diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 467ac004420..94b184d09a1 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -1383,7 +1383,8 @@ aspell is used along with Emacs).") ;; Unless default dict, re-add "-d" option with the mapped value (if dict-name (if dict-equiv - (nconc ispell-args (list "-d" dict-equiv)) + (setq ispell-args + (nconc ispell-args (list "-d" dict-equiv))) (message "ispell-set-spellchecker-params: Missing hunspell equiv for \"%s\". Skipping." dict-name) @@ -2328,10 +2329,14 @@ Global `ispell-quit' set to start location to continue spell session." ((= char ?i) ; accept and insert word into pers dict (ispell-send-string (concat "*" word "\n")) (setq ispell-pdict-modified-p '(t)) ; dictionary modified! + (and (fboundp 'flyspell-unhighlight-at) + (flyspell-unhighlight-at start)) nil) ((or (= char ?a) (= char ?A)) ; accept word without insert (ispell-send-string (concat "@" word "\n")) (add-to-list 'ispell-buffer-session-localwords word) + (and (fboundp 'flyspell-unhighlight-at) + (flyspell-unhighlight-at start)) (or ispell-buffer-local-name ; session localwords might conflict (setq ispell-buffer-local-name (buffer-name))) (if (null ispell-pdict-modified-p) @@ -4331,8 +4336,13 @@ Both should not be used to define a buffer-local dictionary." (if (fboundp 'comment-padright) ;; Try and use the proper comment marker, ;; e.g. ";;" rather than ";". - (comment-padright comment-start - (comment-add nil)) + (progn + ;; XEmacs: comment-normalize-vars + ;; (newcomment.el) only in >= 21.5 + (and (fboundp 'comment-normalize-vars) + (comment-normalize-vars)) + (comment-padright comment-start + (comment-add nil))) comment-start) " ") "") diff --git a/lisp/textmodes/refill.el b/lisp/textmodes/refill.el index f6a2c7eca05..ebbc6ee0afb 100644 --- a/lisp/textmodes/refill.el +++ b/lisp/textmodes/refill.el @@ -83,9 +83,10 @@ ;;; Code: -(defgroup refill nil - "Refilling paragraphs on changes." - :group 'fill) +;; Unused. +;;; (defgroup refill nil +;;; "Refilling paragraphs on changes." +;;; :group 'fill) (defvar refill-ignorable-overlay nil "Portion of the most recently filled paragraph not needing filling. @@ -222,7 +223,8 @@ characters only cause refilling if they would cause auto-filling. For true \"word wrap\" behavior, use `visual-line-mode' instead." - :group 'refill + ;; Not global, so no effect. +;;; :group 'refill :lighter " Refill" :keymap '(("\177" . backward-delete-char-untabify)) ;; Remove old state if necessary diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el index 079101b56ee..ca29709de2e 100644 --- a/lisp/textmodes/reftex-cite.el +++ b/lisp/textmodes/reftex-cite.el @@ -514,12 +514,6 @@ ;; remove extra whitespace (while (string-match "[\n\t\r]\\|[ \t][ \t]+" field) (setq field (replace-match " " nil t field))) - ;; remove leading garbage - (if (string-match (if raw "^[ \t]+" "^[ \t{]+") field) - (setq field (replace-match "" nil t field))) - ;; remove trailing garbage - (if (string-match (if raw "[ \t]+$" "[ \t}]+$") field) - (setq field (replace-match "" nil t field))) (push (cons key field) alist)))) alist)) diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el index a86b10e21cc..3a64aad6a06 100644 --- a/lisp/textmodes/reftex-parse.el +++ b/lisp/textmodes/reftex-parse.el @@ -234,8 +234,19 @@ of master file." ((match-end 1) ;; It is a label - (push (reftex-label-info (reftex-match-string 1) file bound) - docstruct)) + (when (or (null reftex-label-ignored-macros-and-environments) + ;; \label{} defs should always be honored, + ;; just no keyval style [label=foo] defs. + (string-equal "\label{" (substring (reftex-match-string 0) 0 7)) + (if (and (fboundp 'TeX-current-macro) + (fboundp 'LaTeX-current-environment)) + (not (or (member (save-match-data (TeX-current-macro)) + reftex-label-ignored-macros-and-environments) + (member (save-match-data (LaTeX-current-environment)) + reftex-label-ignored-macros-and-environments))) + t)) + (push (reftex-label-info (reftex-match-string 1) file bound) + docstruct))) ((match-end 3) ;; It is a section @@ -349,9 +360,9 @@ of master file." ; "\\(\\`\\|[\n\r]\\)[^%]*\\\\\\(" "\\(^\\)[^%\n\r]*\\\\\\(" (mapconcat 'identity reftex-bibliography-commands "\\|") - "\\){[ \t]*\\([^}]+\\)") nil t) + "\\)\\(\\[.+?\\]\\)?{[ \t]*\\([^}]+\\)") nil t) (setq files - (split-string (reftex-match-string 3) + (split-string (reftex-match-string 4) "[ \t\n\r]*,[ \t\n\r]*"))))) (when files (setq files diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el index 2a5c9c55866..ce23a48dec6 100644 --- a/lisp/textmodes/reftex-vars.el +++ b/lisp/textmodes/reftex-vars.el @@ -863,6 +863,48 @@ DOWNCASE t: Downcase words before using them." (string :tag "")) (option (boolean :tag "Downcase words ")))) +(defcustom reftex-label-regexps + '(;; Normal \\label{foo} labels + "\\\\label{\\(?1:[^}]*\\)}" + ;; keyvals [..., label = {foo}, ...] forms used by ctable, + ;; listings, minted, ... + "\\[[^]]*\\<label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?") + "List of regexps matching \\label definitions. +The default value matches usual \\label{...} definitions and +keyval style [..., label = {...}, ...] label definitions. It is +assumed that the regexp group 1 matches the label text, so you +have to define it using \\(?1:...\\) when adding new regexps. + +When changed from Lisp, make sure to call +`reftex-compile-variables' afterwards to make the change +effective." + :set (lambda (symbol value) + (set symbol value) + (when (fboundp 'reftex-compile-variables) + (reftex-compile-variables))) + :group 'reftex-defining-label-environments + :type '(repeat (regexp :tag "Regular Expression"))) + +(defcustom reftex-label-ignored-macros-and-environments nil + "List of macros and environments to be ignored when searching for labels. +The purpose is to ignore environments and macros that use keyval +style label=foo arguments, but the label has a different meaning +than a \\label{foo}. Standard \\label{...} definitions are never +ignored. + +E.g., TikZ defines several macros/environments where [label=foo] +defines the label to be printed at some node or edge, but it's +not a label used for referencing. + +Note that this feature is only supported if you are using AUCTeX +and the functions `TeX-current-macro' and +`LaTeX-current-environment' are bound. Also note that this +feature might slow down the reftex parsing process for large TeX +files." + :version "24.4" + :group 'reftex-defining-label-environments + :type '(repeat string)) + (defcustom reftex-label-illegal-re "[^-a-zA-Z0-9_+=:;,.]" "Regexp matching characters not valid in labels." :group 'reftex-making-and-inserting-labels @@ -890,7 +932,7 @@ The function will be called with two arguments, the LABEL and the DEFAULT FORMAT, which usually is `\\label{%s}'. The function should return the string to insert into the buffer." :group 'reftex-making-and-inserting-labels - :type 'function) + :type '(choice (const nil) function)) ;; Label referencing @@ -958,7 +1000,9 @@ This is used to string together whole reference sets, like ("Fancyref" "fancyref" (("\\fref" ?f) ("\\Fref" ?F))) ("Hyperref" "hyperref" - (("\\autoref" ?a) ("\\autopageref" ?u)))) + (("\\autoref" ?a) ("\\autopageref" ?u))) + ("Cleveref" "cleveref" + (("\\cref" ?c) ("\\Cref" ?C) ("\\cpageref" ?d) ("\\Cpageref" ?D)))) "Alist of reference styles. Each element is a list of the style name, the name of the LaTeX package associated with the style or t for any package, and an @@ -1070,7 +1114,7 @@ buffer." :group 'reftex) (defcustom reftex-bibliography-commands - '("bibliography" "nobibliography" "setupbibtex\\[.*?database=") + '("bibliography" "nobibliography" "setupbibtex\\[.*?database=" "addbibresource") "LaTeX commands which specify the BibTeX databases to use with the document." :group 'reftex-citation-support :type '(repeat string)) diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index d5bb0170cd9..7fed4d0d021 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -547,7 +547,7 @@ will deactivate it." (when (member style list) (setq reftex-tables-dirty t changed t) - (delete style list))) + (setq list (delete style list)))) (t (if (member style list) (delete style list) @@ -1081,13 +1081,7 @@ This enforces rescanning the buffer on next use." (wbol "\\(^\\)[ \t]*") ; Need to keep the empty group because ; match numbers are hard coded (label-re (concat "\\(?:" - ;; Normal \label{...} - "\\\\label{\\([^}]*\\)}" - "\\|" - ;; keyvals [..., label = {foo}, ...] - ;; forms used by ctable, listings, - ;; minted, ... - "\\[[^]]*label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?" + (mapconcat 'identity reftex-label-regexps "\\|") "\\)")) (include-re (concat wbol "\\\\\\(" diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el index 16b99627400..5782f25e48d 100644 --- a/lisp/textmodes/remember.el +++ b/lisp/textmodes/remember.el @@ -216,10 +216,11 @@ All functions are run in the remember buffer." Each function is called with the current buffer narrowed to what the user wants remembered. If any function returns non-nil, the data is assumed to have been -recorded somewhere by that function. " +recorded somewhere by that function." :type 'hook :options '(remember-store-in-mailbox remember-append-to-file + remember-store-in-files remember-diary-extract-entries org-remember-handler) :group 'remember) @@ -429,6 +430,30 @@ If you want to remember a region, supply a universal prefix to (run-hook-with-args-until-success 'remember-handler-functions)) (remember-destroy)))) +(defcustom remember-data-directory "~/remember" + "The directory in which to store remember data as files." + :type 'directory + :version "24.4" + :group 'remember) + +(defcustom remember-directory-file-name-format "%Y-%m-%d_%T-%z" + "Format string for the file name in which to store unprocessed data." + :type 'string + :version "24.4" + :group 'remember) + +(defun remember-store-in-files () + "Store remember data in a file in `remember-data-directory'. +The file is named after `remember-directory-file-name-format' fed through +`format-time-string'." + (let ((name (format-time-string + remember-directory-file-name-format (current-time))) + (text (buffer-string))) + (with-temp-buffer + (insert text) + (write-file (convert-standard-filename + (format "%s/%s" remember-data-directory name)))))) + ;;;###autoload (defun remember-clipboard () "Remember the contents of the current clipboard. @@ -456,7 +481,7 @@ Most useful for remembering things from other applications." (defcustom remember-diary-file nil "File for extracted diary entries. If this is nil, then `diary-file' will be used instead." - :type 'file + :type '(choice (const :tag "diary-file" nil) file) :group 'remember) (defun remember-diary-convert-entry (entry) diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el index b3503c6c982..01981175e1d 100644 --- a/lisp/textmodes/rst.el +++ b/lisp/textmodes/rst.el @@ -3932,7 +3932,7 @@ string)) to be used for converting the document." (choice :tag "Command options" (const :tag "No options" nil) (string :tag "Options")))) - :group 'rst + :group 'rst-compile :package-version "1.2.0") (rst-testcover-defcustom) |
