diff options
Diffstat (limited to 'lisp/textmodes')
-rw-r--r-- | lisp/textmodes/conf-mode.el | 98 | ||||
-rw-r--r-- | lisp/textmodes/fill.el | 7 | ||||
-rw-r--r-- | lisp/textmodes/flyspell.el | 40 | ||||
-rw-r--r-- | lisp/textmodes/ispell.el | 5 | ||||
-rw-r--r-- | lisp/textmodes/org.el | 33 | ||||
-rw-r--r-- | lisp/textmodes/reftex-global.el | 3 | ||||
-rw-r--r-- | lisp/textmodes/reftex-vars.el | 2 | ||||
-rw-r--r-- | lisp/textmodes/two-column.el | 6 |
8 files changed, 133 insertions, 61 deletions
diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el index e762f87f328..f7a725242ed 100644 --- a/lisp/textmodes/conf-mode.el +++ b/lisp/textmodes/conf-mode.el @@ -75,8 +75,8 @@ not align (only setting space according to `conf-assignment-space')." (define-key map "\C-c\C-u" 'conf-unix-mode) (define-key map "\C-c\C-w" 'conf-windows-mode) (define-key map "\C-c\C-j" 'conf-javaprop-mode) - (define-key map "\C-c\C-s" 'conf-space-mode) - (define-key map "\C-c " 'conf-space-mode) + (define-key map "\C-c\C-s" 'conf-space-keywords) + (define-key map "\C-c " 'conf-space-keywords) (define-key map "\C-c\C-c" 'conf-colon-mode) (define-key map "\C-c:" 'conf-colon-mode) (define-key map "\C-c\C-x" 'conf-xdefaults-mode) @@ -168,7 +168,7 @@ not align (only setting space according to `conf-assignment-space')." ("/resmgr\\.conf" . "class\\|add\\|allow\\|deny") ("/dictionary\\.lst\\'" . "DICT\\|HYPH\\|THES") ("/tuxracer/options" . "set")) - "File name based settings for `conf-space-keywords'.") + "File-name-based settings for the variable `conf-space-keywords'.") (defvar conf-space-keywords nil "Regexps for functions that may come before a space assignment. @@ -188,7 +188,7 @@ This variable is best set in the file local variables, or through '(1 'font-lock-keyword-face) '(2 'font-lock-variable-name-face)) '("^[ \t]*\\([^\000- ]+\\)" 1 'font-lock-variable-name-face))) - "Keywords to hilight in Conf Space mode.") + "Keywords to highlight in Conf Space mode.") (defvar conf-colon-font-lock-keywords `(;; [section] (do this first because it may look like a parameter) @@ -446,10 +446,11 @@ x.2.y.1.z.2.zz =" (define-derived-mode conf-space-mode conf-unix-mode "Conf[Space]" "Conf Mode starter for space separated conf files. \"Assignments\" are with ` '. Keywords before the parameters are -recognized according to `conf-space-keywords'. Interactively -with a prefix ARG of `0' no keywords will be recognized. With -any other prefix arg you will be prompted for a regexp to match -the keywords. +recognized according to the variable `conf-space-keywords-alist'. +Alternatively, you can specify a value for the file local variable +`conf-space-keywords'. +Use the function `conf-space-keywords' if you want to specify keywords +in an interactive fashion instead. For details see `conf-mode'. Example: @@ -465,34 +466,61 @@ class desktop add /dev/audio desktop add /dev/mixer desktop" (conf-mode-initialize "#" 'conf-space-font-lock-keywords) - (set (make-local-variable 'conf-assignment-sign) - nil) - ;; This doesn't seem right, but the next two depend on conf-space-keywords - ;; being set, while after-change-major-mode-hook might set up imenu, needing - ;; the following result: - (hack-local-variables-prop-line) - (hack-local-variables) - (cond (current-prefix-arg - (set (make-local-variable 'conf-space-keywords) - (if (> (prefix-numeric-value current-prefix-arg) 0) - (read-string "Regexp to match keywords: ")))) - (conf-space-keywords) - (buffer-file-name - (set (make-local-variable 'conf-space-keywords) - (assoc-default buffer-file-name conf-space-keywords-alist - 'string-match)))) - (set (make-local-variable 'conf-assignment-regexp) - (if conf-space-keywords - (concat "\\(?:" conf-space-keywords "\\)[ \t]+.+?\\([ \t]+\\|$\\)") - ".+?\\([ \t]+\\|$\\)")) + (make-local-variable 'conf-assignment-sign) + (setq conf-assignment-sign nil) + (make-local-variable 'conf-space-keywords) + (cond (buffer-file-name + ;; We set conf-space-keywords directly, but a value which is + ;; in the local variables list or interactively specified + ;; (see the function conf-space-keywords) takes precedence. + (setq conf-space-keywords + (assoc-default buffer-file-name conf-space-keywords-alist + 'string-match)))) + (conf-space-mode-internal) + ;; In case the local variables list specifies conf-space-keywords, + ;; recompute other things from that afterward. + (add-hook 'hack-local-variables-hook 'conf-space-mode-internal nil t)) + +;;;###autoload +(defun conf-space-keywords (keywords) + "Enter Conf Space mode using regexp KEYWORDS to match the keywords. +See `conf-space-mode'." + (interactive "sConf Space keyword regexp: ") + (delay-mode-hooks + (conf-space-mode)) + (if (string-equal keywords "") + (setq keywords nil)) + (setq conf-space-keywords keywords) + (conf-space-mode-internal) + (run-mode-hooks)) + +(defun conf-space-mode-internal () + (make-local-variable 'conf-assignment-regexp) + (setq conf-assignment-regexp + (if conf-space-keywords + (concat "\\(?:" conf-space-keywords "\\)[ \t]+.+?\\([ \t]+\\|$\\)") + ".+?\\([ \t]+\\|$\\)")) + ;; If Font Lock is already enabled, reenable it with new + ;; conf-assignment-regexp. + (when (and font-lock-mode + (boundp 'font-lock-keywords)) ;see `normal-mode' + (font-lock-add-keywords nil nil) + (font-lock-mode 1)) + ;; Copy so that we don't destroy shared structure. + (setq imenu-generic-expression (copy-sequence imenu-generic-expression)) + ;; Get rid of any existing Parameters element. + (setq imenu-generic-expression + (delq (assoc "Parameters" imenu-generic-expression) + imenu-generic-expression)) + ;; Add a new one based on conf-space-keywords. (setq imenu-generic-expression - `(,@(cdr imenu-generic-expression) - ("Parameters" - ,(if conf-space-keywords - (concat "^[ \t]*\\(?:" conf-space-keywords - "\\)[ \t]+\\([^ \t\n]+\\)\\(?:[ \t]\\|$\\)") - "^[ \t]*\\([^ \t\n[]+\\)\\(?:[ \t]\\|$\\)") - 1)))) + (cons `("Parameters" + ,(if conf-space-keywords + (concat "^[ \t]*\\(?:" conf-space-keywords + "\\)[ \t]+\\([^ \t\n]+\\)\\(?:[ \t]\\|$\\)") + "^[ \t]*\\([^ \t\n[]+\\)\\(?:[ \t]\\|$\\)") + 1) + imenu-generic-expression))) ;;;###autoload (define-derived-mode conf-colon-mode conf-unix-mode "Conf[Colon]" diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index 95f73b56952..514350119fe 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -89,7 +89,8 @@ reinserts the fill prefix in each resulting line." (defcustom adaptive-fill-regexp ;; Added `!' for doxygen comments starting with `//!' or `/*!'. ;; Added `%' for TeX comments. - (purecopy "[ \t]*\\([-!|#%;>*,A7$,1s"s#sC$,2"F(B]+[ \t]*\\|(?[0-9]+[.)][ \t]*\\)*") + ;; RMS: deleted the code to match `1.' and `(1)'. + "[ \t]*\\([-!|#%;>*,A7$,1s"s#sC$,2"F(B]+[ \t]*\\)*" "*Regexp to match text at start of line that constitutes indentation. If Adaptive Fill mode is enabled, a prefix matching this pattern on the first and second lines of a paragraph is used as the @@ -292,7 +293,9 @@ act as a paragraph-separator." (defun fill-single-word-nobreak-p () "Don't break a line after the first or before the last word of a sentence." - (or (looking-at (concat "[ \t]*\\sw+" "\\(?:" (sentence-end) "\\)")) + ;; Actually, allow breaking before the last word of a sentence, so long as + ;; it's not the last word of the paragraph. + (or (looking-at (concat "[ \t]*\\sw+" "\\(?:" (sentence-end) "\\)[ \t]*$")) (save-excursion (skip-chars-backward " \t") (and (/= (skip-syntax-backward "w") 0) diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 23f4756f4a7..ebee4691e8c 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -992,7 +992,7 @@ Mostly we check word delimiters." (flyspell-accept-buffer-local-defs) (let* ((cursor-location (point)) (flyspell-word (flyspell-get-word following)) - start end poss word) + start end poss word ispell-filter) (if (or (eq flyspell-word nil) (and (fboundp flyspell-generic-check-word-predicate) (not (funcall flyspell-generic-check-word-predicate)))) @@ -1050,7 +1050,12 @@ Mostly we check word delimiters." (not (string= "" (car ispell-filter)))))) ;; (ispell-send-string "!\n") ;; back to terse mode. + ;; Remove leading empty element (setq ispell-filter (cdr ispell-filter)) + ;; ispell process should return something after word is sent. + ;; Tag word as valid (i.e., skip) otherwise + (or ispell-filter + (setq ispell-filter '(*))) (if (consp ispell-filter) (setq poss (ispell-parse-output (car ispell-filter)))) (let ((res (cond ((eq poss t) @@ -1455,6 +1460,22 @@ The buffer to mark them in is `flyspell-large-region-buffer'." (while (re-search-forward regexp nil t) (delete-region (match-beginning 0) (match-end 0))))))))) +;;* --------------------------------------------------------------- +;;* flyspell-check-region-doublons +;;* --------------------------------------------------------------- +(defun flyspell-check-region-doublons (beg end) + "Check for adjacent duplicated words (doublons) in the given region." + (save-excursion + (goto-char beg) + (flyspell-word) ; Make sure current word is checked + (backward-word 1) + (while (and (< (point) end) + (re-search-forward "\\b\\([^ \n\t]+\\)[ \n\t]+\\1\\b" + end 'move)) + (flyspell-word) + (backward-word 1)) + (flyspell-word))) + ;;*---------------------------------------------------------------------*/ ;;* flyspell-large-region ... */ ;;*---------------------------------------------------------------------*/ @@ -1499,7 +1520,8 @@ The buffer to mark them in is `flyspell-large-region-buffer'." (progn (flyspell-process-localwords buffer) (with-current-buffer curbuf - (flyspell-delete-region-overlays beg end)) + (flyspell-delete-region-overlays beg end) + (flyspell-check-region-doublons beg end)) (flyspell-external-point-words)) (error "Can't check region..."))))) @@ -1830,7 +1852,7 @@ This command proposes various successive corrections for the current word." (let ((start (car (cdr word))) (end (car (cdr (cdr word)))) (word (car word)) - poss) + poss ispell-filter) (setq flyspell-auto-correct-word word) ;; now check spelling of word. (ispell-send-string "%\n") ;put in verbose mode @@ -1839,7 +1861,12 @@ This command proposes various successive corrections for the current word." (while (progn (accept-process-output ispell-process) (not (string= "" (car ispell-filter))))) + ;; Remove leading empty element (setq ispell-filter (cdr ispell-filter)) + ;; ispell process should return something after word is sent. + ;; Tag word as valid (i.e., skip) otherwise + (or ispell-filter + (setq ispell-filter '(*))) (if (consp ispell-filter) (setq poss (ispell-parse-output (car ispell-filter)))) (cond @@ -1980,7 +2007,7 @@ The word checked is the word at the mouse position." (let ((start (car (cdr word))) (end (car (cdr (cdr word)))) (word (car word)) - poss) + poss ispell-filter) ;; now check spelling of word. (ispell-send-string "%\n") ;put in verbose mode (ispell-send-string (concat "^" word "\n")) @@ -1988,7 +2015,12 @@ The word checked is the word at the mouse position." (while (progn (accept-process-output ispell-process) (not (string= "" (car ispell-filter))))) + ;; Remove leading empty element (setq ispell-filter (cdr ispell-filter)) + ;; ispell process should return something after word is sent. + ;; Tag word as valid (i.e., skip) otherwise + (or ispell-filter + (setq ispell-filter '(*))) (if (consp ispell-filter) (setq poss (ispell-parse-output (car ispell-filter)))) (cond diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index a0eb147d9c8..2a42a91f7e7 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -2613,8 +2613,9 @@ By just answering RET you can find out what the current dictionary is." (cond ((equal dict "") (ispell-internal-change-dictionary) (message "Using %s dictionary" - (or ispell-local-dictionary ispell-dictionary "default"))) - ((equal dict (or ispell-local-dictionary + (or (and (not arg) ispell-local-dictionary) + ispell-dictionary "default"))) + ((equal dict (or (and (not arg) ispell-local-dictionary) ispell-dictionary "default")) ;; Specified dictionary is the default already. Could reload ;; the dictionaries if needed. diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el index ecbcd86d043..caca6a6ae7d 100644 --- a/lisp/textmodes/org.el +++ b/lisp/textmodes/org.el @@ -2690,7 +2690,7 @@ Also put tags into group 4 if tags are present.") (make-variable-buffer-local 'org-keyword-time-regexp) (defconst org-rm-props '(invisible t face t keymap t intangible t mouse-face t - mouse-map t) + rear-nonsticky t mouse-map t) "Properties to remove when a string without properties is wanted.") (defsubst org-match-string-no-properties (num &optional string) @@ -3140,6 +3140,7 @@ that will be added to PLIST. Returns the string that was modified." (progn (add-text-properties (match-beginning 0) (match-end 0) (list 'mouse-face 'highlight + 'rear-nonsticky t 'keymap org-mouse-map )) t))) @@ -3150,6 +3151,7 @@ that will be added to PLIST. Returns the string that was modified." (progn (add-text-properties (match-beginning 0) (match-end 0) (list 'mouse-face 'highlight + 'rear-nonsticky t 'keymap org-mouse-map )) t))) @@ -3188,6 +3190,7 @@ that will be added to PLIST. Returns the string that was modified." (progn (add-text-properties (match-beginning 0) (match-end 0) (list 'mouse-face 'highlight + 'rear-nonsticky t 'keymap org-mouse-map)) t))) @@ -3206,6 +3209,7 @@ that will be added to PLIST. Returns the string that was modified." (progn (add-text-properties (match-beginning 0) (match-end 0) (list 'mouse-face 'highlight + 'rear-nonsticky t 'keymap org-mouse-map 'help-echo "Radio target link" 'org-linked-text t)) @@ -3271,6 +3275,7 @@ between words." (progn (add-text-properties (match-beginning 0) (match-end 0) (list 'mouse-face 'highlight + 'rear-nonsticky t 'keymap org-mouse-map)) t))) @@ -3279,6 +3284,7 @@ between words." (progn (add-text-properties (match-beginning 1) (match-end 1) (list 'mouse-face 'highlight + 'rear-nonsticky t 'keymap org-mouse-map)) t))) @@ -3380,6 +3386,7 @@ between words." deactivate-mark buffer-file-name buffer-file-truename) (remove-text-properties beg end '(mouse-face nil keymap nil org-linked-text nil + rear-nonsticky nil invisible nil intangible nil)))) ;;; Visibility cycling @@ -4569,7 +4576,7 @@ this heading. " ;; Make the subtree visible (show-subtree) (org-end-of-subtree t) - (skip-chars-backward " \t\r\n]") + (skip-chars-backward " \t\r\n") (and (looking-at "[ \t\r\n]*") (replace-match "\n\n"))) ;; No specific heading, just go to end of file. @@ -6204,15 +6211,15 @@ the returned times will be formatted strings." (while (setq p (next-single-property-change (point) :org-clock-minutes)) (goto-char p) (when (setq time (get-text-property p :org-clock-minutes)) - (beginning-of-line 1) - (when (and (looking-at "\\(\\*+\\)[ \t]+\\(.*?\\)\\([ \t]+:[0-9a-zA-Z_@:]+:\\)?[ \t]*$") - (setq level (- (match-end 1) (match-beginning 1))) - (<= level maxlevel)) - (setq hlc (if emph (or (cdr (assoc level hlchars)) "") "") - hdl (match-string 2) - h (/ time 60) - m (- time (* 60 h))) - (save-excursion + (save-excursion + (beginning-of-line 1) + (when (and (looking-at "\\(\\*+\\)[ \t]+\\(.*?\\)\\([ \t]+:[0-9a-zA-Z_@:]+:\\)?[ \t]*$") + (setq level (- (match-end 1) (match-beginning 1))) + (<= level maxlevel)) + (setq hlc (if emph (or (cdr (assoc level hlchars)) "") "") + hdl (match-string 2) + h (/ time 60) + m (- time (* 60 h))) (goto-char ins) (if (= level 1) (insert-before-markers "|-\n")) (insert-before-markers @@ -8660,7 +8667,7 @@ are included in the output." (push txt rtn)) ;; if we are to skip sublevels, jump to end of subtree (point) - (or org-tags-match-list-sublevels (org-end-of-subtree)))))) + (or org-tags-match-list-sublevels (org-end-of-subtree t)))))) (when (and (eq action 'sparse-tree) (not org-sparse-tree-open-archived-trees)) (org-hide-archived-subtrees (point-min) (point-max))) @@ -9816,7 +9823,7 @@ on the system \"/user@host:\"." ((fboundp 'tramp-handle-file-remote-p) (tramp-handle-file-remote-p file)) ((and (boundp 'ange-ftp-name-format) - (string-match ange-ftp-name-format file)) + (string-match (car ange-ftp-name-format) file)) t) (t nil))) diff --git a/lisp/textmodes/reftex-global.el b/lisp/textmodes/reftex-global.el index e1ae98a59df..b878c288735 100644 --- a/lisp/textmodes/reftex-global.el +++ b/lisp/textmodes/reftex-global.el @@ -38,7 +38,8 @@ The TAGS file is also immediately visited with `visit-tags-table'." (reftex-access-scan-info current-prefix-arg) (let* ((master (reftex-TeX-master-file)) (files (reftex-all-document-files)) - (cmd (format "etags %s" (mapconcat 'identity files " ")))) + (cmd (format "etags %s" (mapconcat 'shell-quote-argument + files " ")))) (save-excursion (set-buffer (reftex-get-file-buffer-force master)) (message "Running etags to create TAGS file...") diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el index f4334fbbd70..0f8a948e363 100644 --- a/lisp/textmodes/reftex-vars.el +++ b/lisp/textmodes/reftex-vars.el @@ -232,7 +232,7 @@ distribution. Mixed-case symbols are convenience aliases.") "LaTeX label and citation support." :tag "RefTeX" :link '(url-link :tag "Home Page" - "http://zon.astro.uva.nl/~dominik/Tools/") + "http://staff.science.uva.nl/~dominik/Tools/reftex/") :link '(emacs-commentary-link :tag "Commentary in reftex.el" "reftex.el") :link '(custom-manual "(reftex)Top") :prefix "reftex-" diff --git a/lisp/textmodes/two-column.el b/lisp/textmodes/two-column.el index b8ab100c19d..958ef179b26 100644 --- a/lisp/textmodes/two-column.el +++ b/lisp/textmodes/two-column.el @@ -340,9 +340,9 @@ The appearance of the screen can be customized by the variables ;;;###autoload (defun 2C-two-columns (&optional buffer) "Split current window vertically for two-column editing. -When called the first time, associates a buffer with the current -buffer in two-column minor mode (see \\[describe-mode] ). -Runs `2C-other-buffer-hook' in the new buffer. +\\<global-map>When called the first time, associates a buffer with the current +buffer in two-column minor mode (use \\[describe-mode] once in the mode, +for details.). It runs `2C-other-buffer-hook' in the new buffer. When called again, restores the screen layout with the current buffer first and the associated buffer to its right." (interactive "P") |