[elpa] externals/compat 05654c33ac: compat-29: Add tests for keymap-lookup functions
branch: externals/compat commit 05654c33acb16dcfdf1da0d2fd5d5763907bc2a1 Author: Daniel Mendler Commit: Daniel Mendler compat-29: Add tests for keymap-lookup functions --- compat-29.el| 6 +++--- compat-tests.el | 45 +++-- 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/compat-29.el b/compat-29.el index 819988b3a9..d44a5ec674 100644 --- a/compat-29.el +++ b/compat-29.el @@ -726,7 +726,7 @@ a menu, so this function is not useful for non-menu keymaps." (define-key-after keymap (key-parse key) definition (and after (key-parse after -(compat-defun keymap-lookup ;; +(compat-defun keymap-lookup ;; (keymap key &optional accept-default no-remap position) "Return the binding for command KEY. KEY is a string that satisfies `key-valid-p'. @@ -770,7 +770,7 @@ specified buffer position instead of point are used." value)) (key-binding (kbd key) accept-default no-remap position))) -(compat-defun keymap-local-lookup (keys &optional accept-default) ;; +(compat-defun keymap-local-lookup (keys &optional accept-default) ;; "Return the binding for command KEYS in current local keymap only. KEY is a string that satisfies `key-valid-p'. @@ -782,7 +782,7 @@ about this." (when-let ((map (current-local-map))) (keymap-lookup map keys accept-default))) -(compat-defun keymap-global-lookup (keys &optional accept-default _message) ;; +(compat-defun keymap-global-lookup (keys &optional accept-default _message) ;; "Return the binding for command KEYS in current global keymap only. KEY is a string that satisfies `key-valid-p'. diff --git a/compat-tests.el b/compat-tests.el index 854903cd72..3773e1da50 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -270,27 +270,39 @@ (let ((map (make-sparse-keymap))) (define-key map (kbd "C-x C-f") #'find-file) (define-key map (kbd "SPC") #'minibuffer-complete-word) +(define-key map (kbd "RET") #'exit-minibuffer) +(define-key map [remap exit-minibuffer] #'minibuffer-force-complete-and-exit) (define-key map (kbd "C-c") mode-specific-map) (define-key map (kbd "s-c") [?\C-c ?\C-c]) +(define-key map [t] 'compat-default-command) map)) (defvar compat-tests--map-2 (let ((map (make-sparse-keymap))) (keymap-set map "C-x C-f" #'find-file) (keymap-set map "SPC" #'minibuffer-complete-word) +(keymap-set map "RET" #'exit-minibuffer) +(keymap-set map " " #'minibuffer-force-complete-and-exit) (keymap-set map "C-c" mode-specific-map) (keymap-set map "s-c" "C-c C-c") +(keymap-set map "" 'compat-default-command) map)) (defvar-keymap compat-tests--map-3 "C-x C-f" #'find-file "SPC" #'minibuffer-complete-word + "RET" #'exit-minibuffer + " " #'minibuffer-force-complete-and-exit "C-c" mode-specific-map - "s-c" "C-c C-c") + "s-c" "C-c C-c" + "" 'compat-default-command) (defvar compat-tests--map-4 (define-keymap "C-x C-f" #'find-file "SPC" #'minibuffer-complete-word +"RET" #'exit-minibuffer +" " #'minibuffer-force-complete-and-exit "C-c" mode-specific-map -"s-c" "C-c C-c")) +"s-c" "C-c C-c" +"" 'compat-default-command)) (ert-deftest defvar-keymap () (should-equal compat-tests--map-1 compat-tests--map-2) (should-equal compat-tests--map-1 compat-tests--map-3) @@ -510,6 +522,35 @@ (should-not (key-valid-p "M-xx")) (should-not (key-valid-p "M-x"))) +(ert-deftest keymap-lookup () + (should-not (keymap-lookup compat-tests--map-1 "C-x b")) + (should-equal (keymap-lookup compat-tests--map-1 "C-x C-f") #'find-file) + (should-equal (keymap-lookup compat-tests--map-1 "RET") #'exit-minibuffer) + (should-equal (keymap-lookup compat-tests--map-1 "C-c") mode-specific-map) + (should-equal (keymap-lookup compat-tests--map-1 "s-c") [?\C-c ?\C-c]) + (should-not (keymap-lookup compat-tests--map-1 "x")) + (should-equal (keymap-lookup compat-tests--map-1 "x" t) 'compat-default-command)) + +(ert-deftest keymap-local-lookup () + (let ((orig (current-local-map))) +(unwind-protect +(progn + (use-local-map compat-tests--map-1) + (should-not (keymap-local-lookup "C-x b")) + (should-equal (keymap-local-lookup "C-x C-f") #'find-file) + (should-equal (keymap-lookup compat-tests--map-1 "RET" nil t) #'exit-minibuffer) + (should-equal (keymap-local-lookup "RET") #'minibuffer-force-complete-and-exit) + (should-equal (keymap-local-lookup "C-c") mode-specific-map) + (should-equal (keymap-local-lookup "s-c") [?\C-c ?\C-c]) + (should-not (keymap-local-lookup "x")) + (should-equal (keymap-local-lookup "x" t) 'compat-default-command)) + (use-local-map orig + +(ert-deftest keymap-global-lookup () + (should-equal (keymap-global-lookup "C-x b") #'switch-to-buffer) + (should-equal (keymap-global-lookup "C-x C-f") #'find-file) + (should-equal (keymap-global-lookup "C-c
[elpa] externals-release/org cd967ce006: org-odt-plain-text: Fix `fill-column' value
branch: externals-release/org commit cd967ce006726a56df49885c83b27e9bf4bd7c4c Author: Ihor Radchenko Commit: Ihor Radchenko org-odt-plain-text: Fix `fill-column' value * lisp/ox-odt.el (org-odt-plain-text): Use `most-positive-fixnum' to unfill plain text elements. `point-max' is not a safe large value because, for example, Han script symbols often occupy two columns. Reported-by: Cantoraz Chou Link: https://orgmode.org/list/CAJg5Zf00e+A_kuBmRh+h68u+3g_Cb_bLqRhR4rpFH=nenxv...@mail.gmail.com --- lisp/ox-odt.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index 1c233a266a..949c8f9b5b 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -2935,7 +2935,7 @@ contextual information." (trailing (and (string-match (rx (1+ blank) eos) output) (match-string 0 output ;; Unfill, retaining leading/trailing space. - (let ((fill-column (point-max))) + (let ((fill-column most-positive-fixnum)) (fill-region (point-min) (point-max))) (concat leading (buffer-string) trailing)) ;; Return value.
[elpa] externals/org dc29c7d81f: Merge branch 'bugfix'
branch: externals/org commit dc29c7d81f88ef62c93e7fd0678f4f9301f82508 Merge: ecb62e2e31 cd967ce006 Author: Ihor Radchenko Commit: Ihor Radchenko Merge branch 'bugfix' --- lisp/ox-odt.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index 1c233a266a..949c8f9b5b 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -2935,7 +2935,7 @@ contextual information." (trailing (and (string-match (rx (1+ blank) eos) output) (match-string 0 output ;; Unfill, retaining leading/trailing space. - (let ((fill-column (point-max))) + (let ((fill-column most-positive-fixnum)) (fill-region (point-min) (point-max))) (concat leading (buffer-string) trailing)) ;; Return value.
[elpa] externals/org updated (ecb62e2e31 -> dc29c7d81f)
elpasync pushed a change to branch externals/org. from ecb62e2e31 org-babel-shell-initialize: Refactor new cd967ce006 org-odt-plain-text: Fix `fill-column' value new dc29c7d81f Merge branch 'bugfix' Summary of changes: lisp/ox-odt.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[nongnu] elpa/evil-numbers 743e60549c 2/2: Cleanup: replace point-at-bol/eol with pos-bol/eol
branch: elpa/evil-numbers commit 743e60549c1efea562e3fc8d6cd713e2ce7653b3 Author: Campbell Barton Commit: Campbell Barton Cleanup: replace point-at-bol/eol with pos-bol/eol Quiet deprecation warning. --- evil-numbers.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/evil-numbers.el b/evil-numbers.el index 8e609197a6..2d1d396c0f 100644 --- a/evil-numbers.el +++ b/evil-numbers.el @@ -627,8 +627,8 @@ Return non-nil on success, leaving the point at the end of the number." ;; The caller may use a range that spans lines to ;; allow searching and finding items across ;; multiple lines (currently used for selection). - (max beg (point-at-bol)) - (min end (point-at-eol)) + (max beg (pos-bol)) + (min end (pos-eol)) padded range-check-fn (lambda (n) (+ n amount))) @@ -711,7 +711,7 @@ negative number to a positive will result in a number with a + sign." (let ((point-next (save-excursion (when (evil-numbers--inc-at-pt-impl-with-search -amount (point-at-bol) (point-at-eol) padded +amount (pos-bol) (pos-eol) padded ;; Optional range checking function, only needed when ;; `evil-numbers-use-cursor-at-end-of-number' is not nil. (cond
[nongnu] elpa/evil-numbers 9bebb3a2c8 1/2: Cleanup: remove redundant `format` and quoted lambda
branch: elpa/evil-numbers commit 9bebb3a2c8e1fed3dd597ffd4767c82ac427bcba Author: Campbell Barton Commit: Campbell Barton Cleanup: remove redundant `format` and quoted lambda Both give warnings with melpazoid. --- evil-numbers.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/evil-numbers.el b/evil-numbers.el index ee4aa86965..8e609197a6 100644 --- a/evil-numbers.el +++ b/evil-numbers.el @@ -372,7 +372,7 @@ Each item in MATCH-CHARS is a cons pair. ((eq ch-num '\?) (evil-numbers--skip-chars-impl ch-skip ch-sep-optional dir 1 limit)) (t - (error (format "Unknown type %S (internal error)" ch-skip + (error "Unknown type %S (internal error)" ch-skip))) ;; End of the match. (when do-match @@ -631,7 +631,7 @@ Return non-nil on success, leaving the point at the end of the number." (min end (point-at-eol)) padded range-check-fn - #'(lambda (n) (+ n amount))) + (lambda (n) (+ n amount))) (setq found t))) ;; Search failed, exit the loop.
[nongnu] elpa/evil-numbers updated (dbe39b0ac7 -> 743e60549c)
elpasync pushed a change to branch elpa/evil-numbers. from dbe39b0ac7 Cleanup: replace 'if' with 'cond' new 9bebb3a2c8 Cleanup: remove redundant `format` and quoted lambda new 743e60549c Cleanup: replace point-at-bol/eol with pos-bol/eol Summary of changes: evil-numbers.el | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-)
[nongnu] elpa/multiple-cursors 16223efc2d: Fix byte compiler warnings by moving variable declarations
branch: elpa/multiple-cursors commit 16223efc2d6dece2d43bbccc189d7a4bab6de571 Author: Leo Gaskin Commit: Magnar Sveen Fix byte compiler warnings by moving variable declarations --- multiple-cursors-core.el | 358 +++ 1 file changed, 179 insertions(+), 179 deletions(-) diff --git a/multiple-cursors-core.el b/multiple-cursors-core.el index b24ec7eec3..194ca0b45d 100644 --- a/multiple-cursors-core.el +++ b/multiple-cursors-core.el @@ -394,6 +394,185 @@ which action is being undone." :type '(boolean) :group 'multiple-cursors) +(defvar mc/cmds-to-run-once nil + "Commands to run only once in multiple-cursors-mode.") + +(defvar mc--default-cmds-to-run-once nil + "Default set of commands to run only once in multiple-cursors-mode.") + +(setq mc--default-cmds-to-run-once '(mc/edit-lines + mc/edit-ends-of-lines + mc/edit-beginnings-of-lines + mc/mark-next-like-this + mc/mark-next-like-this-word + mc/mark-next-like-this-symbol + mc/mark-next-word-like-this + mc/mark-next-symbol-like-this + mc/mark-previous-like-this + mc/mark-previous-like-this-word + mc/mark-previous-like-this-symbol + mc/mark-previous-word-like-this + mc/mark-previous-symbol-like-this + mc/mark-all-like-this + mc/mark-all-words-like-this + mc/mark-all-symbols-like-this + mc/mark-more-like-this-extended + mc/mark-all-like-this-in-defun + mc/mark-all-words-like-this-in-defun + mc/mark-all-symbols-like-this-in-defun + mc/mark-all-like-this-dwim + mc/mark-all-dwim + mc/mark-sgml-tag-pair + mc/insert-numbers + mc/insert-letters + mc/sort-regions + mc/reverse-regions + mc/cycle-forward + mc/cycle-backward + mc/add-cursor-on-click + mc/mark-pop + mc/add-cursors-to-all-matches + mc/mmlte--left + mc/mmlte--right + mc/mmlte--up + mc/mmlte--down + mc/unmark-next-like-this + mc/unmark-previous-like-this + mc/skip-to-next-like-this + mc/skip-to-previous-like-this + rrm/switch-to-multiple-cursors + mc-hide-unmatched-lines-mode + mc/repeat-command + hum/keyboard-quit + hum/unhide-invisible-overlays + save-buffer + ido-exit-minibuffer + ivy-done + exit-minibuffer + minibuffer-complete-and-exit + execute-extended-command + eval-expression + undo + redo + undo-tree-undo + undo-tree-redo + undo-fu-only-undo + undo-fu-only-redo + universal-argument + universal-argument-more + universal-argument-other-key + negative-argument + digit-argument + top-level + recenter-top-bottom + describe-mode + describe-key-1 + describe-function + describe-bindings + describe-prefix-bindings
[nongnu] elpa/spell-fu 8153d2af7d: Cleanup: use pos-bol/eol as respecting fields isn't needed
branch: elpa/spell-fu commit 8153d2af7d2e21e29d87e8709d728d6996bc9510 Author: Campbell Barton Commit: Campbell Barton Cleanup: use pos-bol/eol as respecting fields isn't needed --- spell-fu.el | 38 ++ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/spell-fu.el b/spell-fu.el index 3b1bcfa939..440bcaf564 100644 --- a/spell-fu.el +++ b/spell-fu.el @@ -386,9 +386,9 @@ Optional argument BODY runs with the depth override." `(save-excursion ;; Extend the ranges to line start/end. (goto-char ,pos-end) - (setq ,pos-end (line-end-position)) + (setq ,pos-end (pos-eol)) (goto-char ,pos-beg) - (setq ,pos-beg (line-beginning-position) + (setq ,pos-beg (pos-bol) (defun spell-fu--buffer-as-line-list (buffer lines) "Add lines from BUFFER to LINES, returning the updated LINES." @@ -396,7 +396,7 @@ Optional argument BODY runs with the depth override." (save-excursion (goto-char (point-min)) (while (not (eobp)) -(push (buffer-substring-no-properties (line-beginning-position) (line-end-position)) lines) +(push (buffer-substring-no-properties (pos-bol) (pos-eol)) lines) (forward-line 1 lines) @@ -472,7 +472,7 @@ save some time by not spending time reading it back." (insert-file-contents-literally words-file) (setq word-table (make-hash-table :test #'equal :size (count-lines (point-min) (point-max (while (not (eobp)) -(let ((l (buffer-substring-no-properties (line-beginning-position) (line-end-position +(let ((l (buffer-substring-no-properties (pos-bol) (pos-eol ;; Value of 't' is just for simplicity, it's no used except for check the item exists. (puthash (spell-fu--canonicalize-word l) t word-table) (forward-line 1 @@ -581,8 +581,8 @@ Argument POS-END the end position of WORD." (defun spell-fu--word-at-point () "Return the word at the current point or nil." (let ((point-init (point)) -(pos-beg (line-beginning-position)) -(pos-end (line-end-position))) +(pos-beg (pos-bol)) +(pos-end (pos-eol))) (save-excursion (goto-char pos-beg) (catch 'result @@ -978,8 +978,8 @@ Return t when found, otherwise nil." (point-found nil)) (save-excursion (while (and (null point-found) (not (equal (point) point-prev))) -(let ((pos-beg (line-beginning-position)) - (pos-end (line-end-position))) +(let ((pos-beg (pos-bol)) + (pos-end (pos-eol))) (jit-lock-fontify-now pos-beg pos-end) @@ -1333,7 +1333,7 @@ Return t if the file was updated." (insert-file-contents personal-words-file) (goto-char (point-min)) (when (looking-at "personal_ws-") -(delete-region (line-beginning-position) (1+ (line-end-position +(delete-region (pos-bol) (1+ (pos-eol (goto-char (point-max)) (unless (eq ?\n (char-after)) (insert "\n"))) @@ -1396,18 +1396,14 @@ Argument DICT-FILE is the absolute path to the dictionary." ;; also ensures we can step past the header which _could_ be a single line ;; without anything below it. (goto-char (point-max)) -(unless (string-blank-p - (buffer-substring-no-properties (line-beginning-position) (line-end-position))) +(unless (string-blank-p (buffer-substring-no-properties (pos-bol) (pos-eol))) (insert "\n")) ;; Delete extra blank lines. ;; So we can use line count as word count. (while (and (zerop (forward-line -1)) -(string-blank-p - (buffer-substring-no-properties - (line-beginning-position) - (line-end-position +(string-blank-p (buffer-substring-no-properties (pos-bol) (pos-eol (delete-region - (line-beginning-position) + (pos-bol) (progn (forward-line -1) (point @@ -1444,11 +1440,7 @@ Argument DICT-FILE is the absolute path to the dictionary." (let ((keep-searching t)) (while (and keep-searching - (string-lessp - (buffer-substring-no-properties -(line-beginning-position) -(line-end-position)) - word)) + (string-lessp (buffer-substring-no-properties (pos-bol) (pos-eol)) word)) (setq keep-searching (zerop (forward-line 1) (insert word "\n") @@ -1463,9 +1455,7 @@ Argument DICT-FILE is the absolute path to the dictionary." ;; Delete line. (goto-char word-point) -(delete-r
[elpa] externals-release/org 97a235cf1c: org-clock-timestamps-change: Preserve point position
branch: externals-release/org commit 97a235cf1cd029920b0a7dbcdc300abd7215499c Author: Ihor Radchenko Commit: Ihor Radchenko org-clock-timestamps-change: Preserve point position * lisp/org-clock.el (org-clock-timestamps-change): Try harder to preserve point position. `save-excursion' is not sufficient here, when the timestamp gets deleted in the process. Reported-by: Johannes Dahl Link: https://orgmode.org/list/CAHuokSbJxM4kqjdT94aHmjnKqzOvpJpq3tJqOEqdswaBC=j...@mail.gmail.com --- lisp/org-clock.el | 30 +++--- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 4e72141cdc..55372e5649 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1800,17 +1800,25 @@ Optional argument N tells to change by that many units." (time-subtract (org-time-string-to-time org-last-changed-timestamp) (org-time-string-to-time ts))) - (save-excursion - (goto-char begts) - (org-timestamp-change -(round (/ (float-time tdiff) - (pcase timestamp? -(`minute 60) -(`hour 3600) -(`day (* 24 3600)) -(`month (* 24 3600 31)) -(`year (* 24 3600 365.2) -timestamp? 'updown))) + ;; `save-excursion' won't work because + ;; `org-timestamp-change' deletes and re-inserts the + ;; timestamp. + (let ((origin (point))) +(save-excursion + (goto-char begts) + (org-timestamp-change + (round (/ (float-time tdiff) +(pcase timestamp? + (`minute 60) + (`hour 3600) + (`day (* 24 3600)) + (`month (* 24 3600 31)) + (`year (* 24 3600 365.2) + timestamp? 'updown)) +;; Move back to initial position, but never beyond updated +;; clock. +(unless (< (point) origin) + (goto-char origin ;;;###autoload (defun org-clock-cancel ()
[elpa] externals/org 76f9a3c2cb 1/2: org-timestamp-change: Add FIXME
branch: externals/org commit 76f9a3c2cb76bcd1e550d68a749de9ef2772644d Author: Ihor Radchenko Commit: Ihor Radchenko org-timestamp-change: Add FIXME * lisp/org.el (org-timestamp-change): Add FIXME comment to re-implement the logic in future to avoid `save-excursion' markers being moved to the end of timestamp. --- lisp/org.el | 6 ++ 1 file changed, 6 insertions(+) diff --git a/lisp/org.el b/lisp/org.el index a35f3260c2..59fe3d2d34 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -14845,6 +14845,12 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays like (setq timestamp? (or what timestamp?) inactive (= (char-after (match-beginning 0)) ?\[) ts (match-string 0)) + ;; FIXME: Instead of deleting everything and then inserting + ;; later, we should make use of `replace-match', which preserves + ;; markers. The current implementation suffers from + ;; `save-excursion' not preserving point inside the timestamp + ;; once we delete the timestamp here. The point moves to the + ;; updated timestamp end. (replace-match "") (when (string-match "\\(\\(-[012][0-9]:[0-5][0-9]\\)?\\( +[.+]?-?[-+][0-9]+[hdwmy]\\(/[0-9]+[hdwmy]\\)?\\)*\\)[]>]"
[elpa] externals/org updated (dc29c7d81f -> d71bb04f78)
elpasync pushed a change to branch externals/org. from dc29c7d81f Merge branch 'bugfix' new 76f9a3c2cb org-timestamp-change: Add FIXME new 97a235cf1c org-clock-timestamps-change: Preserve point position new d71bb04f78 Merge branch 'bugfix' Summary of changes: lisp/org-clock.el | 30 +++--- lisp/org.el | 6 ++ 2 files changed, 25 insertions(+), 11 deletions(-)
[elpa] externals/org d71bb04f78 2/2: Merge branch 'bugfix'
branch: externals/org commit d71bb04f780c28cfbe2d6bf93f6559856e6b99a2 Merge: 76f9a3c2cb 97a235cf1c Author: Ihor Radchenko Commit: Ihor Radchenko Merge branch 'bugfix' --- lisp/org-clock.el | 30 +++--- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 414b667895..0cd473209e 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1801,17 +1801,25 @@ Optional argument N tells to change by that many units." (time-subtract (org-time-string-to-time org-last-changed-timestamp) (org-time-string-to-time ts))) - (save-excursion - (goto-char begts) - (org-timestamp-change -(round (/ (float-time tdiff) - (pcase timestamp? -(`minute 60) -(`hour 3600) -(`day (* 24 3600)) -(`month (* 24 3600 31)) -(`year (* 24 3600 365.2) -timestamp? 'updown))) + ;; `save-excursion' won't work because + ;; `org-timestamp-change' deletes and re-inserts the + ;; timestamp. + (let ((origin (point))) +(save-excursion + (goto-char begts) + (org-timestamp-change + (round (/ (float-time tdiff) +(pcase timestamp? + (`minute 60) + (`hour 3600) + (`day (* 24 3600)) + (`month (* 24 3600 31)) + (`year (* 24 3600 365.2) + timestamp? 'updown)) +;; Move back to initial position, but never beyond updated +;; clock. +(unless (< (point) origin) + (goto-char origin ;;;###autoload (defun org-clock-cancel ()
[nongnu] elpa/diff-ansi 7463fe2100: Cleanup: use pos-bol/eol as respecting fields isn't needed
branch: elpa/diff-ansi commit 7463fe2100e39ab88b1993b6b331983d80230dfa Author: Campbell Barton Commit: Campbell Barton Cleanup: use pos-bol/eol as respecting fields isn't needed --- diff-ansi.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diff-ansi.el b/diff-ansi.el index 29952628b6..6a69e9069b 100644 --- a/diff-ansi.el +++ b/diff-ansi.el @@ -644,10 +644,10 @@ Argument BEG is only used to calculate the progress percentage." (disp-beg (car range)) (disp-end (min - end ; Clamp twice because `line-end-position' could exceed the value. + end ; Clamp twice because `pos-eol' could exceed the value. (save-excursion (goto-char (min (+ disp-beg diff-ansi-chunks-size) end)) - (line-end-position) + (pos-eol) (save-excursion (cond ((eq disp-beg disp-end)
[nongnu] elpa/hl-block-mode aacaca774d: Cleanup: use pos-bol/eol as respecting fields isn't needed
branch: elpa/hl-block-mode commit aacaca774d5bcb277488a0164ff56f12df54c4d9 Author: Campbell Barton Commit: Campbell Barton Cleanup: use pos-bol/eol as respecting fields isn't needed --- hl-block-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hl-block-mode.el b/hl-block-mode.el index a9dc9a46af..42db0887e8 100644 --- a/hl-block-mode.el +++ b/hl-block-mode.el @@ -131,8 +131,8 @@ PT is typically the `(point)'." "Move point to the first multi-line block. The point will only ever be moved backward." - (let ((line-min (line-beginning-position)) -(line-max (line-end-position)) + (let ((line-min (pos-bol)) +(line-max (pos-eol)) (beg (point)) (end (point))) (while (and beg (>= beg line-min) end (<= end line-max))
[elpa] externals/corfu 6081a68db6: Require the compat library
branch: externals/corfu commit 6081a68db6f74a493431d647942fc294964910aa Author: Daniel Mendler Commit: Daniel Mendler Require the compat library --- corfu.el | 56 +-- extensions/corfu-indexed.el | 2 +- extensions/corfu-popupinfo.el | 20 +++- 3 files changed, 37 insertions(+), 41 deletions(-) diff --git a/corfu.el b/corfu.el index 4a3579ef7f..f4f8000353 100644 --- a/corfu.el +++ b/corfu.el @@ -6,7 +6,7 @@ ;; Maintainer: Daniel Mendler ;; Created: 2021 ;; Version: 0.34 -;; Package-Requires: ((emacs "27.1")) +;; Package-Requires: ((emacs "27.1") (compat "29.1.1.0")) ;; Homepage: https://github.com/minad/corfu ;; This file is part of GNU Emacs. @@ -33,6 +33,7 @@ ;;; Code: +(require 'compat) (require 'seq) (eval-when-compile (require 'cl-lib) @@ -213,31 +214,29 @@ The completion backend can override this with '((t :inherit shadow :strike-through t)) "Face used for deprecated candidates.") -(defvar corfu-map - (let ((map (make-sparse-keymap))) -(define-key map [remap beginning-of-buffer] #'corfu-first) -(define-key map [remap end-of-buffer] #'corfu-last) -(define-key map [remap scroll-down-command] #'corfu-scroll-down) -(define-key map [remap scroll-up-command] #'corfu-scroll-up) -(define-key map [remap next-line] #'corfu-next) -(define-key map [remap previous-line] #'corfu-previous) -(define-key map [remap completion-at-point] #'corfu-complete) -(define-key map [down] #'corfu-next) -(define-key map [up] #'corfu-previous) -(define-key map [remap keyboard-escape-quit] #'corfu-reset) -;; XXX [tab] is bound because of org-mode -;; The binding should be removed from org-mode-map. -(define-key map [tab] #'corfu-complete) -(define-key map "\M-n" #'corfu-next) -(define-key map "\M-p" #'corfu-previous) -(define-key map "\C-g" #'corfu-quit) -(define-key map "\r" #'corfu-insert) -(define-key map "\t" #'corfu-complete) -(define-key map "\M-g" 'corfu-info-location) -(define-key map "\M-h" 'corfu-info-documentation) -(define-key map "\M- " #'corfu-insert-separator) -map) - "Corfu keymap used when popup is shown.") +(defvar-keymap corfu-map + :doc "Corfu keymap used when popup is shown." + " " #'corfu-first + " " #'corfu-last + " " #'corfu-scroll-down + " " #'corfu-scroll-up + " " #'corfu-next + " " #'corfu-previous + " " #'corfu-complete + " " #'corfu-reset + "" #'corfu-next + "" #'corfu-previous + ;; XXX [tab] is bound because of org-mode + ;; The binding should be removed from org-mode-map. + "" #'corfu-complete + "M-n" #'corfu-next + "M-p" #'corfu-previous + "C-g" #'corfu-quit + "RET" #'corfu-insert + "TAB" #'corfu-complete + "M-g" 'corfu-info-location + "M-h" 'corfu-info-documentation + "M-SPC" #'corfu-insert-separator) (defvar corfu--auto-timer nil "Auto completion timer.") @@ -887,8 +886,7 @@ See `corfu-separator' for more details." (<= beg pt end) (save-excursion (goto-char beg) - (let ((inhibit-field-text-motion t)) - (<= (line-beginning-position) pt (line-end-position + (<= (pos-bol) pt (pos-eol))) (or ;; We keep Corfu alive if a `overriding-terminal-local-map' is ;; installed, e.g., the `universal-argument-map'. It would be good to @@ -1082,7 +1080,7 @@ Quit if no candidate is selected." (exit (plist-get completion-extra-properties :exit-function)) (threshold (completion--cycle-threshold metadata)) (completion-in-region-mode-predicate - (or completion-in-region-mode-predicate (lambda () t + (or completion-in-region-mode-predicate #'always))) (pcase (completion-try-completion str table pred pt metadata) ('nil (corfu--message "No match") nil) ('t (goto-char end) diff --git a/extensions/corfu-indexed.el b/extensions/corfu-indexed.el index 7de296b751..c090a9707a 100644 --- a/extensions/corfu-indexed.el +++ b/extensions/corfu-indexed.el @@ -60,7 +60,7 @@ "Advice for `corfu--affixate' which prefixes the CANDS with an index." (setq cands (cdr cands)) (let* ((space #(" " 0 1 (face (:height 0.5 :inherit corfu-indexed - (width (if (> (+ corfu-indexed-start (length cands)) 10) 2 1)) + (width (if (length> cands (- 10 corfu-indexed-start)) 2 1)) (fmt (concat space (propertize (format "%%%ds" width) 'face 'corfu-indexed) diff --git a/extensions/corfu-popupinfo.el b/extensions/corfu-popupinfo.el index 48e1294572..60cb0b5361 100644 --- a/extensions/corfu-popupinfo.el +++ b/extensions/corfu-popupinfo.el @@ -112,17 +112,15 @@ popup can be requested manually via `corfu-popupinfo-toggle', (const force-vertical))) :group 'corfu) -(defvar corfu-popupinfo-map - (let ((map (make-sparse-keymap))) -(define-key map "\M-d" #'corf
[elpa] externals/pyim 024e96706c: Add pyim-liberime-create-word-at-point
branch: externals/pyim commit 024e96706c262da941bf99128f9e62bcba1fa786 Author: Feng Shu Commit: Feng Shu Add pyim-liberime-create-word-at-point --- pyim-liberime.el | 28 1 file changed, 28 insertions(+) diff --git a/pyim-liberime.el b/pyim-liberime.el index 38113355fb..689c55746e 100644 --- a/pyim-liberime.el +++ b/pyim-liberime.el @@ -295,6 +295,34 @@ Please see: https://github.com/rime/librime/issues/349"; (setq words nil)) (t (liberime-process-key 65366)) +(defun pyim-liberime-create-word-at-point (&optional number silent) + "将光标前字符数为 NUMBER 的中文字符串添加到 RIME 数据库中。 +当 SILENT 设置为 t 是,不显示提醒信息。 + +这个命令对多音字处理比较弱,所以有可能在 RIME 数据库中添加一些不 +合理的词条,比如: + + yin-xing -> 银行 + +这个问题暂时还没有好的方法解决。" + (interactive) + (when-let* ((rime-quanpin-p + (equal (pyim-scheme-name (pyim-scheme-current)) + 'rime-quanpin)) + (string (pyim-cstring-at-point (or number 2))) + (chars (remove "" (split-string string ""))) + (codes-list + (mapcar (lambda (x) + (split-string x "-")) + (pyim-cstring-to-pinyin string nil "-" t nil t +(dolist (codes codes-list) + (pyim-liberime--create-word codes chars) + (unless silent +(message "将词条: %S -> %S 加入 rime 数据库。" + (string-join codes "-") string) + +(advice-add 'pyim-process-create-word-at-point :after #'pyim-liberime-create-word-at-point) + (cl-defmethod pyim-process-terminate-really ((_scheme pyim-scheme-rime)) (cl-call-next-method) (liberime-clear-commit)
[nongnu] elpa/diff-ansi 136b173e4a: Cleanup: goto pos-bol/eol instead of movement that respects fields
branch: elpa/diff-ansi commit 136b173e4afb6eec4243f1089056411538a6ffa3 Author: Campbell Barton Commit: Campbell Barton Cleanup: goto pos-bol/eol instead of movement that respects fields --- diff-ansi.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diff-ansi.el b/diff-ansi.el index 6a69e9069b..b6f76021a2 100644 --- a/diff-ansi.el +++ b/diff-ansi.el @@ -751,7 +751,7 @@ Store the result in TARGET-BUF when non-nil." (while (not (eobp)) (setq point-prev (point)) (goto-char (min (+ (point) diff-ansi-chunks-size) (point-max))) -(end-of-line) +(goto-char (pos-eol)) (let ((output (concat temp-dir (number-to-string i (write-region point-prev (point) output nil 0)
[nongnu] elpa/doc-show-inline fa04ee7cac: Cleanup: use pos-bol/eol as respecting fields isn't needed
branch: elpa/doc-show-inline commit fa04ee7cac8d43c587d15c500aae872612c0950d Author: Campbell Barton Commit: Campbell Barton Cleanup: use pos-bol/eol as respecting fields isn't needed --- doc-show-inline.el | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc-show-inline.el b/doc-show-inline.el index 78a7bd110e..da99a365cc 100644 --- a/doc-show-inline.el +++ b/doc-show-inline.el @@ -244,7 +244,7 @@ Where positive brighten and negative numbers darken." The point will be located over the symbol (typically at it's beginning), the point should not be moved by this function." - (let ((prefix (buffer-substring-no-properties (line-beginning-position) (point + (let ((prefix (buffer-substring-no-properties (pos-bol) (point (cond ;; Ignore defines, they never have external docs. ;; Removing will work, it just performs an unnecessary lookup. @@ -278,13 +278,13 @@ the point should not be moved by this function." ;; There may be blank lines between the comment beginning, ;; include these since it's useful to display the the space to know if the comment ;; was directly above the text or not. - (let ((pos-end (max (point-min) (1- (line-beginning-position) + (let ((pos-end (max (point-min) (1- (pos-bol) ;; Move one character into the comment. (goto-char pos-end) (cond ((forward-comment -1) (let ((pos-beg (point)) -(pos-beg-of-line (line-beginning-position))) +(pos-beg-of-line (pos-bol))) (cond ;; Ensure the comment is not a trailing comment of a previous line. @@ -464,7 +464,7 @@ the point should not be moved by this function." ;; position to this. (setq sym (car pair)) (unless (looking-at-p (regexp-quote sym)) -;; In most cases limiting by `line-end-position' is sufficient. +;; In most cases limiting by `pos-eol' is sufficient. (save-match-data (when (search-forward sym pos-end t) (setq pos (- (point) (length sym))) @@ -646,7 +646,7 @@ XREF-BACKEND is the back-end used to find this symbol." (length (or text "") (when text -(doc-show-inline--show-text (line-beginning-position) text)) +(doc-show-inline--show-text (pos-bol) text)) (defun doc-show-inline--idle-handle-pending-ranges () "Handle all queued ranges."
[nongnu] elpa/projectile e18ad4d611: Make the tests work reliably with native compilation enabled
branch: elpa/projectile commit e18ad4d6111eb9e975ccce028baf5e4bb786bfcf Author: Bozhidar Batsov Commit: Bozhidar Batsov Make the tests work reliably with native compilation enabled I am the maintainer of projectile for debian. (Aymeric Agon-Rambosson) As part of the building process of our packages, we run the tests provided by the upstream maintainers in a clean and empty environment (no writable $HOME, no internet access, etc...). For this reason, we sometimes uncover bugs that would remain masked on the machines of the upstream maintainers, and of the users. The test "projectile-parse-dirconfig-file" can break in a very specific setting : Since version 28.1, emacs has been shipped with native-compilation, that is the possibility to compile elisp to native instructions using libgccjit. Since elisp allows the advising of functions implemented in C ("primitives"), it is necessary to compile trampolines to replace those functions if we want to advise them, in order to allow an arbitrary user-defined function to be run instead. The test library you use, buttercup, and more specifically its function spy-on, advises functions routinely. In the test we're interested in, buttercup (spy-on) changes the definition of a few primitives in the offending test (projectile-parse-dirconfig-file), namely file-exists-p, file-truename and insert-file-contents. The first one is advised so as to always return t, regardless of whether the file is really present or not. The first two are advised without error. The last one, however, can fail because, being a primitive, a trampoline needs to be compiled. We have the following backtrace in our build environment : comp-subr-trampoline-install(insert-file-contents) comp-trampoline-search(insert-file-contents) native-elisp-load("/tmp/buttercupKuLmvD/28.2-4001e2a9/subr--trampoline-696... error: (native-lisp-load-failed "file does not exists" "/tmp/buttercupKuLmvD/28.2-4001e2a9/subr--trampoline-696e736572742d66696c652d636f6e74656e7473_insert_file_contents_0.eln") What happens here is the following : if we are in a situation where the trampoline corresponding to the function insert-file-contents is not already present in some eln-cache directory on the machine, then the function comp-trampoline-search should return nil, which would trigger the compilation of said trampoline. However, since comp-trampoline-search relies on file-exists-p, and this last one has been advised so as to always answer yes, comp-trampoline-search tries to load a file that does not exists, hence our error. You or your users probably never reach that state, probably because you can always count on the trampoline being present beforehand. But if it is not there, you should be able to reproduce. We always reach that state because we run the tests in a clean environment, where the trampoline is never present. This error can be expected whenever a primitive is advised (in our case insert-file-contents) while file-exists-p is already advised so as to always return t, and the trampoline corresponding to the primitive does not already exists on the file system. There are two possible solutions : the first one is to try and ensure the trampoline is present by the time of the advice, for instance by compiling it unconditionally before the test. This is not entirely reliable, as some environments could inhibit the saving of this trampoline to the file system (this is what we do, for instance). The second one is to exclude the function insert-file-contents (and indeed, any primitive you would want to advise while file-exists-p is advised as to always return t) from trampoline optimisation completely. The variable native-comp-never-optimize-functions can be used to do just that. This patch tweaks it accordingly. --- test/projectile-test.el | 5 + 1 file changed, 5 insertions(+) diff --git a/test/projectile-test.el b/test/projectile-test.el index a6e4e91a00..b5f128cd60 100644 --- a/test/projectile-test.el +++ b/test/projectile-test.el @@ -26,6 +26,11 @@ ;;; Code: +;; needed for the tests to work with native compilation +(with-eval-after-load 'comp + (push 'insert-file-contents +native-comp-never-optimize-functions)) + (require 'projectile) (require 'buttercup)
[nongnu] elpa/scroll-on-drag cf026998a8: Cleanup: use pos-bol/eol as respecting fields isn't needed
branch: elpa/scroll-on-drag commit cf026998a81097a372f1af3ca48eeb6e7d658951 Author: Campbell Barton Commit: Campbell Barton Cleanup: use pos-bol/eol as respecting fields isn't needed --- scroll-on-drag.el | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scroll-on-drag.el b/scroll-on-drag.el index c49ebfe926..c173d288af 100644 --- a/scroll-on-drag.el +++ b/scroll-on-drag.el @@ -212,10 +212,10 @@ Returns true when scrolling took place, otherwise nil." (scroll-on-drag-clamp (cond ((eq (window-end) (point-max)) - (line-beginning-position)) + (pos-bol)) (t (save-excursion -(goto-char (line-beginning-position)) +(goto-char (pos-bol)) (let ((lines (- (window-body-height) ;; When the point is at the window top, @@ -246,7 +246,7 @@ Returns true when scrolling took place, otherwise nil." (scroll-on-drag-smooth (save-excursion (goto-char (point-max)) - (line-beginning-position))) + (pos-bol))) (t 0))) @@ -334,7 +334,7 @@ Returns true when scrolling took place, otherwise nil." (let ((scroll-pt (cond ((eq restore-point (point)) - (line-beginning-position)) + (pos-bol)) (t (point) (cond @@ -376,7 +376,7 @@ Returns true when scrolling took place, otherwise nil." ;; when the cursor is partially outside the view. (scroll-consrtain-point-below-window-start-fn (lambda () -(let ((lines-from-top (count-lines (window-start) (line-beginning-position +(let ((lines-from-top (count-lines (window-start) (pos-bol (when (> scroll-margin lines-from-top) (forward-line (- scroll-margin lines-from-top)) (scroll-on-drag--force-redisplay-with-hooks))
[elpa] externals/corfu updated (6081a68db6 -> 7783419c28)
elpasync pushed a change to branch externals/corfu. from 6081a68db6 Require the compat library new 0057dbd90c Use string-search new 7783419c28 Commentary: Use keymap-set Summary of changes: README.org| 2 +- corfu.el | 2 +- extensions/corfu-quick.el | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
[elpa] externals/corfu 7783419c28 2/2: Commentary: Use keymap-set
branch: externals/corfu commit 7783419c289ccd1a84aedd928b1129cf59b775b6 Author: Daniel Mendler Commit: Daniel Mendler Commentary: Use keymap-set --- README.org| 2 +- extensions/corfu-quick.el | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.org b/README.org index 3970fb6e36..0b3faf2bba 100644 --- a/README.org +++ b/README.org @@ -421,7 +421,7 @@ The command ~corfu-move-to-minibuffer~ is defined here in terms of (let ((completion-extra-properties corfu--extra) completion-cycle-threshold completion-cycling) (apply #'consult-completion-in-region completion-in-region--data))) - (define-key corfu-map "\M-m" #'corfu-move-to-minibuffer) + (keymap-set corfu-map "M-m" #'corfu-move-to-minibuffer) #+end_src * Key bindings diff --git a/extensions/corfu-quick.el b/extensions/corfu-quick.el index 037fd0f616..9e937bce87 100644 --- a/extensions/corfu-quick.el +++ b/extensions/corfu-quick.el @@ -31,8 +31,8 @@ ;; candidate in front of them. This is designed to be a faster ;; alternative to selecting a candidate with `corfu-next' and ;; `corfu-previous'. -;; (define-key corfu-map "\M-q" #'corfu-quick-complete) -;; (define-key corfu-map "\C-q" #'corfu-quick-insert) +;; (keymap-set corfu-map "M-q" #'corfu-quick-complete) +;; (keymap-set corfu-map "C-q" #'corfu-quick-insert) ;;; Code:
[elpa] externals/corfu 0057dbd90c 1/2: Use string-search
branch: externals/corfu commit 0057dbd90c2022ae654437893d4bf262e458504d Author: Daniel Mendler Commit: Daniel Mendler Use string-search --- corfu.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/corfu.el b/corfu.el index f4f8000353..d5c1195660 100644 --- a/corfu.el +++ b/corfu.el @@ -374,7 +374,7 @@ The completion backend can override this with ;; * https://github.com/minad/corfu/issues/17 ;; * https://gitlab.gnome.org/GNOME/mutter/-/issues/840 ;; * https://lists.gnu.org/archive/html/emacs-devel/2020-02/msg1.html - (string-match-p "gtk3" system-configuration-features) + (string-search "gtk3" system-configuration-features) (string-match-p "gnome\\|cinnamon" (or (getenv "XDG_CURRENT_DESKTOP") (getenv "DESKTOP_SESSION") ""))
[elpa] externals/pyim updated (024e96706c -> d1a192bee9)
elpasync pushed a change to branch externals/pyim. from 024e96706c Add pyim-liberime-create-word-at-point new e065decb5d Depend emacs > 27.1 new d1a192bee9 Fix pyim-dcache-write-file test fail Summary of changes: .github/workflows/test.yml | 2 +- pyim-common.el | 12 ++ pyim-dcache.el | 18 +++ pyim-page.el | 6 + pyim-probe.el | 14 +--- pyim-process.el| 3 --- pyim.el| 6 + tests/pyim-tests.el| 55 +- 8 files changed, 44 insertions(+), 72 deletions(-)
[elpa] externals/pyim d1a192bee9 2/2: Fix pyim-dcache-write-file test fail
branch: externals/pyim commit d1a192bee946341c3e5727ef716fad03dbe31c5e Author: Feng Shu Commit: Feng Shu Fix pyim-dcache-write-file test fail --- pyim-dcache.el | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pyim-dcache.el b/pyim-dcache.el index d96a750866..459e36e86e 100644 --- a/pyim-dcache.el +++ b/pyim-dcache.el @@ -151,15 +151,15 @@ AUTO-BACKUP-THRESHOLD 倍, 那么原值将自动备份到 FILE 对应的备份 "A helper function to write dcache files." (let ((coding-system-for-write 'utf-8-unix) (create-lockfiles nil)) -(when (and confirm - (file-exists-p filename) - ;; NS does its own confirm dialog. - (not (and (eq (framep-on-display) 'ns) - (listp last-nonmenu-event) - use-dialog-box)) - (or (y-or-n-p (format-message - "File `%s' exists; overwrite? " filename)) - (user-error "Canceled" +(and confirm + (file-exists-p filename) + ;; NS does its own confirm dialog. + (not (and (eq (framep-on-display) 'ns) + (listp last-nonmenu-event) + use-dialog-box)) + (or (y-or-n-p (format-message +"File `%s' exists; overwrite? " filename)) + (user-error "Canceled"))) (write-region (point-min) (point-max) filename nil :silent) (message "Saving file %s..." filename)))
[elpa] externals/pyim e065decb5d 1/2: Depend emacs > 27.1
branch: externals/pyim commit e065decb5d47b07d54974a819cc4c9fd61e8fb24 Author: Feng Shu Commit: Feng Shu Depend emacs > 27.1 --- .github/workflows/test.yml | 2 +- pyim-common.el | 12 ++ pyim-page.el | 6 + pyim-probe.el | 14 +--- pyim-process.el| 3 --- pyim.el| 6 + tests/pyim-tests.el| 55 +- 7 files changed, 35 insertions(+), 63 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 689ea11ae2..3d43acb127 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: -emacs_version: [25.1, 26.1, 27.1, 28.1, snapshot] +emacs_version: [27.1, 28.1, snapshot] steps: - uses: purcell/setup-emacs@master with: diff --git a/pyim-common.el b/pyim-common.el index b84b2ebfc1..082450c6f2 100644 --- a/pyim-common.el +++ b/pyim-common.el @@ -195,18 +195,10 @@ When CARE-FIRST-ONE is no-nil, ((a b c) (d e)) => (a d)." (setq unread-command-events nil)) (setq unread-command-events (if (characterp key) -;; Emacs >= 27 support (no-record . EVENT), please read emacs -;; commit: f13d97b4de02586cce49909aa2f3f51fcb5daa5f (Fix defining -;; keyboard macros in CUA mode) -(cons (if (> emacs-major-version 26) - (cons 'no-record key) -key) - unread-command-events) +(cons (cons 'no-record key) unread-command-events) (append (cl-mapcan (lambda (e) - (list (if (> emacs-major-version 26) - (cons 'no-record e) - e))) + (list (cons 'no-record e))) (append key nil)) unread-command-events diff --git a/pyim-page.el b/pyim-page.el index e9ac5c73f1..e5d828a3de 100644 --- a/pyim-page.el +++ b/pyim-page.el @@ -28,11 +28,7 @@ ;;; Code: ;; * 代码 :code: (require 'cl-lib) -;; Emacs 26.1 之前的版本无法安装 posframe. -(require 'posframe nil t) -;; popup 不是 gnu elpa 包,所以不应该在这里加载它,加载它是由于向后兼容的原因, -;; 未来可能删除。 -(require 'popup nil t) +(require 'posframe) (require 'pyim-common) (require 'pyim-process) diff --git a/pyim-probe.el b/pyim-probe.el index 35335775df..f9ac589301 100644 --- a/pyim-probe.el +++ b/pyim-probe.el @@ -80,8 +80,7 @@ "激活这个 pyim 探针函数后,可以解决 org-speed-commands 与 pyim 冲突问题。 用于:`pyim-english-input-switch-functions' 。" - (and (> emacs-major-version 25) - (string= major-mode "org-mode") + (and (string= major-mode "org-mode") (bolp) (looking-at org-heading-regexp) org-use-speed-commands)) @@ -185,13 +184,10 @@ (member (char-to-string char) puncts (defun pyim-probe-org-latex-mode () - "org-mode 中的 latex fragment 和 latex 宏指令中自动切换到英文输入. - -FIXME: 这个 probe 在 Emacs 25 上运行可能存在问题。" - (when (and (> emacs-major-version 25) - (eq major-mode 'org-mode)) -(or (org-inside-LaTeX-fragment-p) -(org-inside-latex-macro-p + "org-mode 中的 latex fragment 和 latex 宏指令中自动切换到英文输入." + (and (eq major-mode 'org-mode) + (or (org-inside-LaTeX-fragment-p) + (org-inside-latex-macro-p (defun pyim-probe-exwm-xim-environment () "测试当前是否是 exwm-xim 输入法环境。 diff --git a/pyim-process.el b/pyim-process.el index 746f9a833e..9bbd1d83fe 100644 --- a/pyim-process.el +++ b/pyim-process.el @@ -81,9 +81,6 @@ entered (nihaom) 的第一个候选词。 :type '(choice (const nil) (repeat function))) -(define-obsolete-variable-alias - 'pyim-process-async-delay 'pyim-process--run-delay "5.0") - (defcustom pyim-process-run-delay 0.5 "延迟多少秒开始延迟获取词条。" :type 'integer) diff --git a/pyim.el b/pyim.el index fdff16cb1e..64ee881a0e 100644 --- a/pyim.el +++ b/pyim.el @@ -9,7 +9,7 @@ ;; URL: https://github.com/tumashu/pyim ;; Version: 5.2.9 ;; Keywords: convenience, Chinese, pinyin, input-method -;; Package-Requires: ((emacs "25.1") (async "1.6") (xr "1.13")) +;; Package-Requires: ((emacs "27.1") (async "1.6") (xr "1.13")) ;; This file is part of GNU Emacs. @@ -38,10 +38,6 @@ (require 'pyim-common) (require 'pyim-cstring) (require 'pyim-dhashcache) -;; NOTE: pyim 默认使用 dhashcache, 按理说不需要加载 dregcache, 但以前 pyim 支持 -;; 动态加载后端,由于简化代码的原因,这个功能取消了,require dregcache 是为了向 -;; 后兼容,未来也许会取消加载。 -(require 'pyim-dregcache) (require 'pyim-indicator) (require 'pyim-page) (require 'pyim-preview) diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el index b0e0083123..502b7f26d1 100644 --- a/tests/pyim-tests.el +++ b/tests/pyim-tests.el @@ -1600,17 +1600,16 @@ Transfer-Encoding: chunked (should (pyim-probe-isearch-mode (ert-deftest pyim-tests-pyim-probe-org-speed-commands () - (when (> emacs-major-version 25) -
[elpa] externals/vertico updated (d72cb897ed -> b96e779c06)
elpasync pushed a change to branch externals/vertico. from d72cb897ed Update README new 407b9c11ff Require the compat library new e35567b9f4 vertico-mouse: Use define-keymap new b96e779c06 README/Commentary: Use keymap-set Summary of changes: README.org| 16 +++--- extensions/vertico-directory.el | 6 +++--- extensions/vertico-flat.el| 14 ++--- extensions/vertico-grid.el| 18 +++- extensions/vertico-mouse.el | 23 ++-- extensions/vertico-multiform.el | 10 - extensions/vertico-quick.el | 6 +++--- extensions/vertico-reverse.el | 30 +- extensions/vertico-unobtrusive.el | 2 +- vertico.el| 44 +++ 10 files changed, 81 insertions(+), 88 deletions(-)
[elpa] externals/vertico b96e779c06 3/3: README/Commentary: Use keymap-set
branch: externals/vertico commit b96e779c06914814478aacebe89c7f94ffd0c148 Author: Daniel Mendler Commit: Daniel Mendler README/Commentary: Use keymap-set --- README.org| 16 extensions/vertico-directory.el | 6 +++--- extensions/vertico-flat.el| 2 +- extensions/vertico-grid.el| 2 +- extensions/vertico-multiform.el | 10 +- extensions/vertico-quick.el | 4 ++-- extensions/vertico-reverse.el | 2 +- extensions/vertico-unobtrusive.el | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/README.org b/README.org index 00f61c1e31..7fe240eb45 100644 --- a/README.org +++ b/README.org @@ -158,9 +158,9 @@ completion commands behave as usual. For example you can use =M-TAB= to cycle between candidates if you have set ~completion-cycle-threshold~. #+begin_src emacs-lisp - (define-key vertico-map "?" #'minibuffer-completion-help) - (define-key vertico-map (kbd "M-RET") #'minibuffer-force-complete-and-exit) - (define-key vertico-map (kbd "M-TAB") #'minibuffer-complete) + (keymap-set vertico-map "?" #'minibuffer-completion-help) + (keymap-set vertico-map "M-RET" #'minibuffer-force-complete-and-exit) + (keymap-set vertico-map "M-TAB" #'minibuffer-complete) #+end_src The ~orderless~ completion style does not support completion of a common prefix @@ -304,11 +304,11 @@ Temporary toggling between the different display modes is possible. Bind the following commands: #+begin_src emacs-lisp - (define-key vertico-map "\M-V" #'vertico-multiform-vertical) - (define-key vertico-map "\M-G" #'vertico-multiform-grid) - (define-key vertico-map "\M-F" #'vertico-multiform-flat) - (define-key vertico-map "\M-R" #'vertico-multiform-reverse) - (define-key vertico-map "\M-U" #'vertico-multiform-unobtrusive) + (keymap-set vertico-map "M-V" #'vertico-multiform-vertical) + (keymap-set vertico-map "M-G" #'vertico-multiform-grid) + (keymap-set vertico-map "M-F" #'vertico-multiform-flat) + (keymap-set vertico-map "M-R" #'vertico-multiform-reverse) + (keymap-set vertico-map "M-U" #'vertico-multiform-unobtrusive) #+end_src You can use your own functions or even lambdas to configure the completion diff --git a/extensions/vertico-directory.el b/extensions/vertico-directory.el index 44478d77fc..7396f53ca9 100644 --- a/extensions/vertico-directory.el +++ b/extensions/vertico-directory.el @@ -31,9 +31,9 @@ ;; `vertico-map'. Furthermore a cleanup function for shadowed file paths ;; is provided. ;; -;; (define-key vertico-map "\r" #'vertico-directory-enter) -;; (define-key vertico-map "\d" #'vertico-directory-delete-char) -;; (define-key vertico-map "\M-\d" #'vertico-directory-delete-word) +;; (keymap-set vertico-map "RET" #'vertico-directory-enter) +;; (keymap-set vertico-map "DEL" #'vertico-directory-delete-char) +;; (keymap-set vertico-map "M-DEL" #'vertico-directory-delete-word) ;; (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy) ;;; Code: diff --git a/extensions/vertico-flat.el b/extensions/vertico-flat.el index fa483a60d1..14ed966a51 100644 --- a/extensions/vertico-flat.el +++ b/extensions/vertico-flat.el @@ -32,7 +32,7 @@ ;; command or completion category. Alternatively the flat display can be ;; toggled temporarily if `vertico-multiform-mode' is enabled: ;; -;; (define-key vertico-map "\M-F" #'vertico-multiform-flat) +;; (keymap-set vertico-map "M-F" #'vertico-multiform-flat) ;; ;; The flat display can be made to look like `ido-mode' by setting ;; `vertico-cycle' to t. See also the `vertico-flat-format' diff --git a/extensions/vertico-grid.el b/extensions/vertico-grid.el index 6497410036..a5d4edd522 100644 --- a/extensions/vertico-grid.el +++ b/extensions/vertico-grid.el @@ -32,7 +32,7 @@ ;; command or completion category. Alternatively the grid display can be ;; toggled temporarily if `vertico-multiform-mode' is enabled: ;; -;; (define-key vertico-map "\M-G" #'vertico-multiform-grid) +;; (keymap-set vertico-map "M-G" #'vertico-multiform-grid) ;;; Code: diff --git a/extensions/vertico-multiform.el b/extensions/vertico-multiform.el index 48e9d3d4f0..2306ebc125 100644 --- a/extensions/vertico-multiform.el +++ b/extensions/vertico-multiform.el @@ -49,11 +49,11 @@ ;; Temporary toggling between the different display modes is ;; possible. Bind the following commands: ;; -;; (define-key vertico-map "\M-V" #'vertico-multiform-vertical) -;; (define-key vertico-map "\M-G" #'vertico-multiform-grid) -;; (define-key vertico-map "\M-F" #'vertico-multiform-flat) -;; (define-key vertico-map "\M-R" #'vertico-multiform-reverse) -;; (define-key vertico-map "\M-U" #'vertico-multiform-unobtrusive) +;; (keymap-set vertico-map "M-V" #'vertico-multiform-vertical) +;; (keymap-set vertico-map "M-G" #'vertico-multiform-grid) +;; (keymap-set vertico-map "M-F" #'vertico-multiform-flat) +;; (keymap-set vertico-map "M-R" #'vertico-multiform-reverse) +;; (keymap-set vertico-map "M-U" #'vertic
[elpa] externals/vertico 407b9c11ff 1/3: Require the compat library
branch: externals/vertico commit 407b9c11ffc697aab985865d411b1d345ea7950e Author: Daniel Mendler Commit: Daniel Mendler Require the compat library --- extensions/vertico-flat.el| 12 +--- extensions/vertico-grid.el| 16 +++- extensions/vertico-quick.el | 2 +- extensions/vertico-reverse.el | 28 +-- vertico.el| 44 +-- 5 files changed, 48 insertions(+), 54 deletions(-) diff --git a/extensions/vertico-flat.el b/extensions/vertico-flat.el index 86303032cb..fa483a60d1 100644 --- a/extensions/vertico-flat.el +++ b/extensions/vertico-flat.el @@ -61,12 +61,10 @@ :type 'plist :group 'vertico) -(defvar vertico-flat-map - (let ((map (make-sparse-keymap))) -(define-key map [remap left-char] #'vertico-previous) -(define-key map [remap right-char] #'vertico-next) -map) - "Additional keymap activated in flat mode.") +(defvar-keymap vertico-flat-map + :doc "Additional keymap activated in flat mode." + " " #'vertico-previous + " " #'vertico-next) (defun vertico-flat--display-candidates (candidates) "Display CANDIDATES horizontally." @@ -99,7 +97,7 @@ (> width 0) (> count 0)) (let ((cand (car candidates))) (setq cand (car (funcall vertico--highlight (list cand -(when (string-match-p "\n" cand) +(when (string-search "\n" cand) (setq cand (vertico--truncate-multiline cand width))) (setq cand (string-trim (replace-regexp-in-string diff --git a/extensions/vertico-grid.el b/extensions/vertico-grid.el index 1e79e0cf02..6497410036 100644 --- a/extensions/vertico-grid.el +++ b/extensions/vertico-grid.el @@ -66,14 +66,12 @@ When scrolling beyond this limit, candidates may be truncated." :type 'integer :group 'vertico) -(defvar vertico-grid-map - (let ((map (make-sparse-keymap))) -(define-key map [remap left-char] #'vertico-grid-left) -(define-key map [remap right-char] #'vertico-grid-right) -(define-key map [remap scroll-down-command] #'vertico-grid-scroll-down) -(define-key map [remap scroll-up-command] #'vertico-grid-scroll-up) -map) - "Additional keymap activated in grid mode.") +(defvar-keymap vertico-grid-map + :doc "Additional keymap activated in grid mode." + " " #'vertico-grid-left + " " #'vertico-grid-right + " " #'vertico-grid-scroll-down + " " #'vertico-grid-scroll-up) (defvar-local vertico-grid--columns vertico-grid-min-columns "Current number of grid columns.") @@ -96,7 +94,7 @@ When scrolling beyond this limit, candidates may be truncated." (cands (seq-map-indexed (lambda (cand index) (cl-incf index start) - (when (string-match-p "\n" cand) + (when (string-search "\n" cand) (setq cand (vertico--truncate-multiline cand width))) (truncate-string-to-width (string-trim diff --git a/extensions/vertico-quick.el b/extensions/vertico-quick.el index 6a0f95723f..173eec842b 100644 --- a/extensions/vertico-quick.el +++ b/extensions/vertico-quick.el @@ -109,7 +109,7 @@ TWO is non-nil if two keys should be displayed." (pcase-let ((`(,keys . ,events) (vertico-quick--keys first index start))) (setq list (nconc events list)) (if (bound-and-true-p vertico-flat-mode) - (setq keys (replace-regexp-in-string " " "" keys) + (setq keys (string-replace " " "" keys) cand (string-trim cand) cand (substring cand (min (length cand) (length keys (setq keys (concat keys (make-string (max 1 (- (length prefix) 2)) ?\s diff --git a/extensions/vertico-reverse.el b/extensions/vertico-reverse.el index 51cd73959b..d9ccca594b 100644 --- a/extensions/vertico-reverse.el +++ b/extensions/vertico-reverse.el @@ -38,21 +38,19 @@ (require 'vertico) -(defvar vertico-reverse-map - (let ((map (make-sparse-keymap))) -(define-key map [remap beginning-of-buffer] #'vertico-last) -(define-key map [remap minibuffer-beginning-of-buffer] #'vertico-last) -(define-key map [remap end-of-buffer] #'vertico-first) -(define-key map [remap scroll-down-command] #'vertico-scroll-up) -(define-key map [remap scroll-up-command] #'vertico-scroll-down) -(define-key map [remap next-line] #'vertico-previous) -(define-key map [remap previous-line] #'vertico-next) -(define-key map [remap next-line-or-history-element] #'vertico-previous) -(define-key map [remap previous-line-or-history-element] #'vertico-next) -(define-key map [remap backward-paragraph] #'vertico-next-group) -(define-key map [remap forward-paragraph] #'vertico-previous-group) -map) - "Additional keymap ac
[elpa] externals/vertico e35567b9f4 2/3: vertico-mouse: Use define-keymap
branch: externals/vertico commit e35567b9f4f7414571ebd58f1ba7664845e1a140 Author: Daniel Mendler Commit: Daniel Mendler vertico-mouse: Use define-keymap --- extensions/vertico-mouse.el | 23 +++ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/extensions/vertico-mouse.el b/extensions/vertico-mouse.el index db309c8a4e..ffcc9bc73c 100644 --- a/extensions/vertico-mouse.el +++ b/extensions/vertico-mouse.el @@ -39,18 +39,17 @@ (defun vertico-mouse--candidate-map (index) "Return keymap for candidate with INDEX." - (let ((map (make-sparse-keymap))) -(define-key map [mouse-1] (lambda () -(interactive) -(with-selected-window (active-minibuffer-window) - (let ((vertico--index index)) -(vertico-exit) -(define-key map [mouse-3] (lambda () -(interactive) -(with-selected-window (active-minibuffer-window) - (let ((vertico--index index)) -(vertico-insert) -map)) + (define-keymap +"" (lambda () + (interactive) + (with-selected-window (active-minibuffer-window) +(let ((vertico--index index)) + (vertico-exit +"" (lambda () + (interactive) + (with-selected-window (active-minibuffer-window) +(let ((vertico--index index)) + (vertico-insert)) (defun vertico-mouse--format-candidate (orig cand prefix suffix index start) "Format candidate, see `vertico--format-candidate' for arguments."
[nongnu] elpa/doc-show-inline 2b36a6be1f: Cleanup: goto pos-bol/eol instead of movement that respects fields
branch: elpa/doc-show-inline commit 2b36a6be1f2c0d25935d1a8c5c684e9e7f8e08d2 Author: Campbell Barton Commit: Campbell Barton Cleanup: goto pos-bol/eol instead of movement that respects fields --- doc-show-inline.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc-show-inline.el b/doc-show-inline.el index da99a365cc..f7c8dc01a4 100644 --- a/doc-show-inline.el +++ b/doc-show-inline.el @@ -311,7 +311,7 @@ the point should not be moved by this function." (goto-char pos-end) ;; It's important the point is at the beginning of the line ;; so `looking-at-p' works as expected. - (beginning-of-line) + (goto-char (pos-bol)) (while (and (looking-at-p "[[:blank:]]*$") (< (setq blank-lines (1+ blank-lines)) doc-show-inline-exclude-blank-lines)
[elpa] externals/compat e3926cfeae: compat-29: Add test for keymap-local-set
branch: externals/compat commit e3926cfeaedc21fd5651c111e3fe49abab894901 Author: Daniel Mendler Commit: Daniel Mendler compat-29: Add test for keymap-local-set --- compat-29.el| 2 +- compat-tests.el | 15 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/compat-29.el b/compat-29.el index d44a5ec674..54ada6d5e5 100644 --- a/compat-29.el +++ b/compat-29.el @@ -638,7 +638,7 @@ that you make with this function. NOTE: The compatibility version is not a command." (keymap-set (current-global-map) key command)) -(compat-defun keymap-local-set (key command) ;; +(compat-defun keymap-local-set (key command) ;; "Give KEY a local binding as COMMAND. COMMAND is the command definition to use; usually it is a symbol naming an interactively-callable function. diff --git a/compat-tests.el b/compat-tests.el index 3773e1da50..0a316500c3 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -546,6 +546,21 @@ (should-equal (keymap-local-lookup "x" t) 'compat-default-command)) (use-local-map orig +(ert-deftest keymap-local-set () + (let ((orig (current-local-map))) +(unwind-protect +(progn + (use-local-map (make-sparse-keymap)) + (should-not (keymap-local-lookup "s-c")) + (should-not (keymap-local-lookup "x")) + (keymap-local-set "s-c" 'test) + (keymap-local-set "" 'default) + (should-equal (keymap-local-lookup "s-c") 'test) + (should-equal (keymap-local-lookup "x" t) 'default) + (should-not (keymap-local-lookup "x"))) + (use-local-map orig)) +(should-not (keymap-local-lookup "s-c" + (ert-deftest keymap-global-lookup () (should-equal (keymap-global-lookup "C-x b") #'switch-to-buffer) (should-equal (keymap-global-lookup "C-x C-f") #'find-file)
[elpa] externals/corfu bb5c2561a0: Revert "Use string-search"
branch: externals/corfu commit bb5c2561a025d03d5976bf0c64655606ee04f208 Author: Daniel Mendler Commit: Daniel Mendler Revert "Use string-search" This reverts commit 0057dbd90c2022ae654437893d4bf262e458504d. --- corfu.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/corfu.el b/corfu.el index d5c1195660..f4f8000353 100644 --- a/corfu.el +++ b/corfu.el @@ -374,7 +374,7 @@ The completion backend can override this with ;; * https://github.com/minad/corfu/issues/17 ;; * https://gitlab.gnome.org/GNOME/mutter/-/issues/840 ;; * https://lists.gnu.org/archive/html/emacs-devel/2020-02/msg1.html - (string-search "gtk3" system-configuration-features) + (string-match-p "gtk3" system-configuration-features) (string-match-p "gnome\\|cinnamon" (or (getenv "XDG_CURRENT_DESKTOP") (getenv "DESKTOP_SESSION") ""))
[nongnu] elpa/diff-ansi f10837099d: Fix compatibility for pos-bol/eol for emacs <29.1
branch: elpa/diff-ansi commit f10837099d48454c470aa04a3803a8903d421d23 Author: Campbell Barton Commit: Campbell Barton Fix compatibility for pos-bol/eol for emacs <29.1 --- diff-ansi.el | 13 + 1 file changed, 13 insertions(+) diff --git a/diff-ansi.el b/diff-ansi.el index b6f76021a2..18d6efede4 100644 --- a/diff-ansi.el +++ b/diff-ansi.el @@ -21,6 +21,19 @@ ;;; Code: (require 'ansi-color) + +;; --- +;; Compatibility + +(when (version< emacs-version "29.1") + (defsubst pos-bol (&optional n) +"Return the position at the line beginning." +(line-beginning-position n)) + (defsubst pos-eol (&optional n) +"Return the position at the line end." +(line-end-position n))) + + ;; --- ;; Custom Variables
[nongnu] elpa/doc-show-inline 9c7f489a41: Fix compatibility for pos-bol/eol for emacs <29.1
branch: elpa/doc-show-inline commit 9c7f489a41ab89400c888b1e9038fafe2944e95b Author: Campbell Barton Commit: Campbell Barton Fix compatibility for pos-bol/eol for emacs <29.1 --- doc-show-inline.el | 12 1 file changed, 12 insertions(+) diff --git a/doc-show-inline.el b/doc-show-inline.el index f7c8dc01a4..f2ebc7cbf8 100644 --- a/doc-show-inline.el +++ b/doc-show-inline.el @@ -42,6 +42,18 @@ (require 'imenu) +;; --- +;; Compatibility + +(when (version< emacs-version "29.1") + (defsubst pos-bol (&optional n) +"Return the position at the line beginning." +(line-beginning-position n)) + (defsubst pos-eol (&optional n) +"Return the position at the line end." +(line-end-position n))) + + ;; --- ;; Custom Variables
[nongnu] elpa/hl-block-mode 08e4b2b21e: Fix compatibility for pos-bol/eol for emacs <29.1
branch: elpa/hl-block-mode commit 08e4b2b21e012eea7d48c52921556d28ccbf7039 Author: Campbell Barton Commit: Campbell Barton Fix compatibility for pos-bol/eol for emacs <29.1 --- hl-block-mode.el | 12 1 file changed, 12 insertions(+) diff --git a/hl-block-mode.el b/hl-block-mode.el index 42db0887e8..1aa5c0fa2c 100644 --- a/hl-block-mode.el +++ b/hl-block-mode.el @@ -25,6 +25,18 @@ (require 'pcase)) +;; --- +;; Compatibility + +(when (version< emacs-version "29.1") + (defsubst pos-bol (&optional n) +"Return the position at the line beginning." +(line-beginning-position n)) + (defsubst pos-eol (&optional n) +"Return the position at the line end." +(line-end-position n))) + + ;; --- ;; Custom Variables
[nongnu] elpa/scroll-on-drag ee4e0b0a42: Fix compatibility for pos-bol/eol for emacs <29.1
branch: elpa/scroll-on-drag commit ee4e0b0a4221ea42ca4a12838d3b401c4bfc828a Author: Campbell Barton Commit: Campbell Barton Fix compatibility for pos-bol/eol for emacs <29.1 --- scroll-on-drag.el | 13 + 1 file changed, 13 insertions(+) diff --git a/scroll-on-drag.el b/scroll-on-drag.el index c173d288af..fdde96ddf9 100644 --- a/scroll-on-drag.el +++ b/scroll-on-drag.el @@ -20,6 +20,19 @@ ;;; Code: + +;; --- +;; Compatibility + +(when (version< emacs-version "29.1") + (defsubst pos-bol (&optional n) +"Return the position at the line beginning." +(line-beginning-position n)) + (defsubst pos-eol (&optional n) +"Return the position at the line end." +(line-end-position n))) + + ;; --- ;; Custom Variables
[nongnu] elpa/spell-fu bd39312462: Fix compatibility for pos-bol/eol for emacs <29.1
branch: elpa/spell-fu commit bd39312462b057dd4876b12211fe9d0b86d2e34c Author: Campbell Barton Commit: Campbell Barton Fix compatibility for pos-bol/eol for emacs <29.1 --- spell-fu.el | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/spell-fu.el b/spell-fu.el index 440bcaf564..6949ba5017 100644 --- a/spell-fu.el +++ b/spell-fu.el @@ -40,7 +40,6 @@ ;;; Code: - ;; --- ;; Require Dependencies @@ -51,6 +50,19 @@ ;; For `string-blank-p'. (require 'subr-x) + +;; --- +;; Compatibility + +(when (version< emacs-version "29.1") + (defsubst pos-bol (&optional n) +"Return the position at the line beginning." +(line-beginning-position n)) + (defsubst pos-eol (&optional n) +"Return the position at the line end." +(line-end-position n))) + + ;; --- ;; Custom Variables
[elpa] externals/consult 5b2b7d3953: consult-flymake: Filter diagnostics pointing to non-existing buffer (Fix #716)
branch: externals/consult commit 5b2b7d39534314c53e95958c3d9daeee40329c28 Author: Daniel Mendler Commit: Daniel Mendler consult-flymake: Filter diagnostics pointing to non-existing buffer (Fix #716) --- consult-flymake.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/consult-flymake.el b/consult-flymake.el index 86724fc194..26274adecd 100644 --- a/consult-flymake.el +++ b/consult-flymake.el @@ -56,7 +56,9 @@ DIAGS should be a list of diagnostics as returned from `flymake-diagnostics'." ('flymake-error ?e) ('flymake-warning ?w) (_ ?n - diags)) + (seq-filter (lambda (diag) + (buffer-live-p (flymake-diagnostic-buffer diag))) + diags))) (buffer-width (apply #'max (mapcar (lambda (x) (length (nth 0 x))) diags))) (line-width (apply #'max (mapcar (lambda (x) (length (number-to-string (nth 1 x diags))) (fmt (format "%%-%ds %%-%dd %%-7s %%s" buffer-width line-width)))
[nongnu] elpa/evil-numbers 5ddc167f28: Fix compatibility for pos-bol/eol for emacs <29.1
branch: elpa/evil-numbers commit 5ddc167f28f75fa59e65f3167d12228c4d2c8a05 Author: Campbell Barton Commit: Campbell Barton Fix compatibility for pos-bol/eol for emacs <29.1 --- evil-numbers.el | 13 + 1 file changed, 13 insertions(+) diff --git a/evil-numbers.el b/evil-numbers.el index 2d1d396c0f..609462aa9f 100644 --- a/evil-numbers.el +++ b/evil-numbers.el @@ -72,6 +72,19 @@ ;; For `pcase-dolist'. (require 'pcase)) + +;; --- +;; ;; Compatibility + +(when (version< emacs-version "29.1") + (defsubst pos-bol (&optional n) +"Return the position at the line beginning." +(line-beginning-position n)) + (defsubst pos-eol (&optional n) +"Return the position at the line end." +(line-end-position n))) + + ;; --- ;; Custom Variables
[elpa] main 40ee3cc58d: * elpa-packages (xeft): New package
branch: main commit 40ee3cc58d67f8de6843ddaf49a2d5c702923285 Author: Stefan Monnier Commit: Stefan Monnier * elpa-packages (xeft): New package --- elpa-packages | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/elpa-packages b/elpa-packages index 62e3a14eb9..8898ab6fb6 100644 --- a/elpa-packages +++ b/elpa-packages @@ -1,6 +1,6 @@ ;; -*- lisp-data -*- -;; Copyright (C) 2020-2022 Free Software Foundation, Inc. +;; Copyright (C) 2020-2023 Free Software Foundation, Inc. ;; List of packages that are maintained externally. ;; The list is made of elements of the form (NAME KIND URL OPTS...). @@ -844,6 +844,8 @@ ;;(wrap-search:url "https://dataswamp.org/~incal/wrap-search.git"; ;; :auto-sync t) (xclip:url nil) + (xeft :url "https://git.sr.ht/~casouri/xeft"; + :ignored-files ("*.gif")) (xelb :url "https://github.com/ch11ng/xelb.git";) (xpm :url nil) (xr :url "https://github.com/mattiase/xr";
[elpa] externals/compat fa70e72f92: compat-29: Add test for keymap-global-set
branch: externals/compat commit fa70e72f92985aeb99473d03770bd0404afcae5f Author: Daniel Mendler Commit: Daniel Mendler compat-29: Add test for keymap-global-set --- compat-29.el| 2 +- compat-tests.el | 15 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/compat-29.el b/compat-29.el index 54ada6d5e5..9d18f3aa81 100644 --- a/compat-29.el +++ b/compat-29.el @@ -624,7 +624,7 @@ parent keymap to be used." (keymap--check key) (compat--define-key keymap (key-parse key) nil remove)) -(compat-defun keymap-global-set (key command) ;; +(compat-defun keymap-global-set (key command) ;; "Give KEY a global binding as COMMAND. COMMAND is the command definition to use; usually it is a symbol naming an interactively-callable function. diff --git a/compat-tests.el b/compat-tests.el index 0a316500c3..e6f1aa8b94 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -561,6 +561,21 @@ (use-local-map orig)) (should-not (keymap-local-lookup "s-c" +(ert-deftest keymap-global-set () + (let ((orig (current-global-map))) +(unwind-protect +(progn + (use-global-map (make-sparse-keymap)) + (should-not (keymap-global-lookup "s-c")) + (should-not (keymap-global-lookup "x")) + (keymap-global-set "s-c" 'test) + (keymap-global-set "" 'default) + (should-equal (keymap-global-lookup "s-c") 'test) + (should-equal (keymap-global-lookup "x" t) 'default) + (should-not (keymap-global-lookup "x"))) + (use-global-map orig)) +(should-not (keymap-global-lookup "s-c" + (ert-deftest keymap-global-lookup () (should-equal (keymap-global-lookup "C-x b") #'switch-to-buffer) (should-equal (keymap-global-lookup "C-x C-f") #'find-file)
[elpa] externals/cape bbc399e472: Require the compat library
branch: externals/cape commit bbc399e4724c86d80ee04c5d3af1567683c2b87c Author: Daniel Mendler Commit: Daniel Mendler Require the compat library --- cape-char.el | 2 +- cape.el | 13 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cape-char.el b/cape-char.el index 5f49a54098..873a004394 100644 --- a/cape-char.el +++ b/cape-char.el @@ -56,7 +56,7 @@ REGEXP is the regular expression matching the names." (when (and (get-text-property beg 'face line) (< ename len) (<= echar len)) (let ((name (string-trim (substring-no-properties line beg ename))) (char (string-trim (substring-no-properties line ename echar - (when (and (string-match-p regexp name) (= (length char) 1)) + (when (and (string-match-p regexp name) (length= char 1)) (puthash name (aref char 0) hash (setq beg echar) (kill-buffer) diff --git a/cape.el b/cape.el index 0389c88fb2..10cf1b5a34 100644 --- a/cape.el +++ b/cape.el @@ -6,7 +6,7 @@ ;; Maintainer: Daniel Mendler ;; Created: 2021 ;; Version: 0.12 -;; Package-Requires: ((emacs "27.1")) +;; Package-Requires: ((emacs "27.1") (compat "29.1.1.0")) ;; Homepage: https://github.com/minad/cape ;; This file is part of GNU Emacs. @@ -44,6 +44,7 @@ ;;; Code: +(require 'compat) (eval-when-compile (require 'cl-lib) (require 'subr-x)) @@ -187,7 +188,7 @@ The CMP argument determines how the new input is compared to the old input. ('never nil) ((or 'prefix 'nil) (string-prefix-p old-input new-input)) ('equal (equal old-input new-input)) -('substring (string-match-p (regexp-quote old-input) new-input) +('substring (string-search old-input new-input) (defun cape--cached-table (beg end fun valid) "Create caching completion table. @@ -285,7 +286,7 @@ If INTERACTIVE is nil the function acts like a Capf." (when org (setcar bounds (+ 5 (car bounds (when (or org (not cape-file-directory-must-exist) -(and (string-match-p "/" file) +(and (string-search "/" file) (file-exists-p (file-name-directory file `(,(car bounds) ,(cdr bounds) ,(cape--nonessential-table #'read-file-name-internal) @@ -536,7 +537,7 @@ If INTERACTIVE is nil the function acts like a Capf." (curr-buf (current-buffer)) (buffers (funcall cape-line-buffer-function)) lines) -(dolist (buf (if (listp buffers) buffers (list buffers))) +(dolist (buf (ensure-list buffers)) (with-current-buffer buf (let ((beg (point-min)) (max (point-max)) @@ -545,7 +546,7 @@ If INTERACTIVE is nil the function acts like a Capf." (save-excursion (while (< beg max) (goto-char beg) - (setq end (line-end-position)) + (setq end (pos-eol)) (unless (<= beg pt end) (let ((line (buffer-substring-no-properties beg end))) (unless (or (string-blank-p line) (gethash line ht)) @@ -562,7 +563,7 @@ If INTERACTIVE is nil the function acts like a Capf." (interactive (list t)) (if interactive (cape--interactive #'cape-line) -`(,(line-beginning-position) ,(point) +`(,(pos-bol) ,(point) ,(cape--table-with-properties (cape--line-list) :sort nil) ,@cape--line-properties)))
[elpa] externals/engrave-faces updated (5089660a60 -> 51a2f8d18e)
elpasync pushed a change to branch externals/engrave-faces. from 5089660a60 Normalise single-plist text property form new e541cf4366 Better resolve non-hex fg/bg colours new 51a2f8d18e Style, checkdoc, and byte-compile improvements Summary of changes: engrave-faces-ansi.el | 67 - engrave-faces-html.el | 12 +--- engrave-faces-latex.el | 16 +++--- engrave-faces.el | 82 +- 4 files changed, 113 insertions(+), 64 deletions(-)
[elpa] externals/engrave-faces 51a2f8d18e 2/2: Style, checkdoc, and byte-compile improvements
branch: externals/engrave-faces commit 51a2f8d18ec5e3ce58499aaa27c6dbacf4265935 Author: TEC Commit: TEC Style, checkdoc, and byte-compile improvements --- engrave-faces-ansi.el | 67 ++ engrave-faces-html.el | 12 ++--- engrave-faces-latex.el | 16 engrave-faces.el | 40 +++--- 4 files changed, 84 insertions(+), 51 deletions(-) diff --git a/engrave-faces-ansi.el b/engrave-faces-ansi.el index b19ca1ee21..5aaba1707b 100644 --- a/engrave-faces-ansi.el +++ b/engrave-faces-ansi.el @@ -29,8 +29,9 @@ Possible values are: :group 'engrave-faces) (defcustom engrave-faces-ansi-use-face-colours t - "Whether to apply face colours" - :group 'engrave-faces) + "Whether to apply face colours." + :group 'engrave-faces + :type 'boolean) (defvar engrave-faces-ansi-face-nesting nil) @@ -52,6 +53,8 @@ Possible values are: ; Color conversion (defun engrave-faces-ansi--color-to-ansi (color &optional background) + "Convert the color COLOR to an ANSI code. +When BACKGROUND is non-nil, the provided ANSI code sets the background color." (if (eq color 'unspecified) nil (apply (pcase engrave-faces-ansi-color-mode ((or '3-bit '8-color) #'engrave-faces-ansi-color-3bit-code) @@ -61,7 +64,8 @@ Possible values are: (append (mapcar (lambda (c) (/ c 257)) (color-values color)) (list background) (defun engrave-faces-ansi--color-dist-squared (reference rgb) - "Squared l2 distance between a REFERENCE and RBG values, each a list of 3 values (r g b)." + "Squared l2 distance between a REFERENCE and particular RGB value. +REFERENCE and RGB should each be a list of three values (r g b)." (+ (* (nth 0 reference) (nth 0 rgb)) (* (nth 1 reference) @@ -73,24 +77,26 @@ Possible values are: (defvar engrave-faces-ansi--256-to-16-map '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -0 4 4 4 12 12 2 6 4 4 12 12 2 2 6 4 -12 12 2 2 2 6 12 12 10 10 10 10 14 12 10 10 -10 10 10 14 1 5 4 4 12 12 3 8 4 4 12 12 -2 2 6 4 12 12 2 2 2 6 12 12 10 10 10 10 -14 12 10 10 10 10 10 14 1 1 5 4 12 12 1 1 -5 4 12 12 3 3 8 4 12 12 2 2 2 6 12 12 -10 10 10 10 14 12 10 10 10 10 10 14 1 1 1 5 -12 12 1 1 1 5 12 12 1 1 1 5 12 12 3 3 -3 7 12 12 10 10 10 10 14 12 10 10 10 10 10 14 -9 9 9 9 13 12 9 9 9 9 13 12 9 9 9 9 -13 12 9 9 9 9 13 12 11 11 11 11 7 12 10 10 -10 10 10 14 9 9 9 9 9 13 9 9 9 9 9 13 -9 9 9 9 9 13 9 9 9 9 9 13 9 9 9 9 -9 13 11 11 11 11 11 15 0 0 0 0 0 0 8 8 -8 8 8 8 7 7 7 7 7 7 15 15 15 15 15 15)) +0 4 4 4 12 12 2 6 4 4 12 12 2 2 6 4 +12 12 2 2 2 6 12 12 10 10 10 10 14 12 10 10 +10 10 10 14 1 5 4 4 12 12 3 8 4 4 12 12 +2 2 6 4 12 12 2 2 2 6 12 12 10 10 10 10 +14 12 10 10 10 10 10 14 1 1 5 4 12 12 1 1 +5 4 12 12 3 3 8 4 12 12 2 2 2 6 12 12 +10 10 10 10 14 12 10 10 10 10 10 14 1 1 1 5 +12 12 1 1 1 5 12 12 1 1 1 5 12 12 3 3 +3 7 12 12 10 10 10 10 14 12 10 10 10 10 10 14 +9 9 9 9 13 12 9 9 9 9 13 12 9 9 9 9 +13 12 9 9 9 9 13 12 11 11 11 11 7 12 10 10 +10 10 10 14 9 9 9 9 9 13 9 9 9 9 9 13 +9 9 9 9 9 13 9 9 9 9 9 13 9 9 9 9 +9 13 11 11 11 11 11 15 0 0 0 0 0 0 8 8 +8 8 8 8 7 7 7 7 7 7 15 15 15 15 15 15) + "A mapping from 256-color ANSI indicies to the closest 16-color number.") (defun engrave-faces-ansi-color-4bit-code (r g b &optional background) - "Convert the (R G B) colour code to a correspanding 4bit ansi escape sequence." + "Convert the (R G B) colour code to a correspanding 4bit ansi escape sequence. +When BACKGROUND is non-nil, the provided ANSI code sets the background color." (format "\uE000[%sm" (pcase (nth (engrave-faces-ansi-color-rbg-to-256 r g b) engrave-faces-ansi--256-to-16-map) @@ -102,7 +108,8 @@ Possible values are: (defun engrave-faces-ansi-color-3bit-code (r g b &optional background) "Convert the (R G B) colour code to a correspanding 3bit ansi escape sequence. -Brighter colours are induced via the addition of a bold code." +Brighter colours are induced via the addition of a bold code. +When BACKGROUND is non-nil, the provided ANSI code sets the background color." (format "\uE000[%sm" (pcase (nth (engrave-faces-ansi-color-rbg-to-256 r g b) engrave-faces-ansi--256-to-16-map) @@ -121,7 +128,8 @@ Brighter colours are induced via the addition of a bold code." (_ (/ (- value 35) 40 (defun engrave-faces-ansi--color-8bit-code (r g b &optional background) - "Convert the (R G B) colour code to a correspanding 8bit ansi escape sequence." + "Conver
[elpa] externals/engrave-faces e541cf4366 1/2: Better resolve non-hex fg/bg colours
branch: externals/engrave-faces commit e541cf43665965e13b0629b609a14058de6153ad Author: TEC Commit: TEC Better resolve non-hex fg/bg colours --- engrave-faces.el | 42 +- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/engrave-faces.el b/engrave-faces.el index bced9a2b68..89231f24e7 100644 --- a/engrave-faces.el +++ b/engrave-faces.el @@ -335,18 +335,32 @@ I.e. ([facea :inherit faceb] facec) results in (facea faceb facec)" (defun engrave-faces-attribute-values (faces attribute) "Fetch all specified instances of ATTRIBUTE for FACES, ignoring inheritence. To consider inheritence, use `engrave-faces-explicit-inheritance' first." - (delq nil (delq 'unspecified - (mapcar - (lambda (face) - (if-let ((style (cdr (assoc face engrave-faces-current-preset-style - (plist-get style attribute) - (cond -((symbolp face) - (when engrave-faces-log-preset-missed-faces - (push face engrave-faces-preset-missed-faces)) - (face-attribute face attribute nil nil)) -((listp face) (plist-get face attribute) - (delq 'default (if (listp faces) faces (list faces))) + (let ((face-list (delq 'default (if (listp faces) faces (list faces +values) +(dolist (face face-list) + (let* ((style (cdr (assoc face engrave-faces-current-preset-style))) + (raw-value + (if style (plist-get style attribute) +(cond + ((symbolp face) + (when engrave-faces-log-preset-missed-faces +(push face engrave-faces-preset-missed-faces)) + (face-attribute face attribute nil nil)) + ((listp face) (plist-get face attribute) + (value + (cond + (style raw-value) + ((and (memq attribute '(:foreground :background)) + (stringp raw-value) + (not (string-empty-p raw-value)) + (= ?# (aref raw-value 0))) +(apply 'format "#%02x%02x%02x" + (mapcar (lambda (c) (ash c -8)) + (color-values raw-value + (t raw-value +(unless (memq value '(nil unspecified)) + (push value values +(nreverse values))) (defun engrave-faces--next-face-change (pos &optional limit) "Find the next face change from POS up to LIMIT. @@ -408,7 +422,9 @@ Unconditionally returns nil when FACES is default." (not (memq attr '(:height :strike-through) (list attr (if (and (memq attr '(:foreground :background)) -(not (string-prefix-p "#" attr-val))) +(stringp attr-val) +(not (string-empty-p attr-val)) +(= ?# (aref attr-val 0))) (apply 'format "#%02x%02x%02x" (mapcar (lambda (c) (ash c -8)) (color-values attr-val)))
[nongnu] elpa/xah-fly-keys ac6d0c397f: • xah-save-close-current-buffer, now generated file name random part is 5 char hexadecimal instead of 1 to 100. • qwerty space u (dvorak space g) now call x
branch: elpa/xah-fly-keys commit ac6d0c397fa036868275aff1d5056d2a86a24caa Author: Xah Lee Commit: Xah Lee • xah-save-close-current-buffer, now generated file name random part is 5 char hexadecimal instead of 1 to 100. • qwerty space u (dvorak space g) now call xah-save-close-current-buffer instead xah-close-current-buffer --- xah-fly-keys.el | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xah-fly-keys.el b/xah-fly-keys.el index 109480d58f..fdd568809a 100644 --- a/xah-fly-keys.el +++ b/xah-fly-keys.el @@ -4,7 +4,7 @@ ;; Author: Xah Lee ( http://xahlee.info/ ) ;; Maintainer: Xah Lee -;; Version: 22.5.20230101184908 +;; Version: 22.5.20230113094711 ;; Created: 10 Sep 2013 ;; Package-Requires: ((emacs "24.1")) ;; Keywords: convenience, emulations, vim, ergoemacs @@ -2243,7 +2243,7 @@ Version: 2017-11-01 2022-04-05" "Save and close current buffer. If the buffer is not a file, save it to `user-emacs-directory' and named untitled_‹datetime›_‹randomhex›.txt -Version 2022-12-29" +Version 2022-12-29 2023-01-09" (interactive) (if (buffer-file-name) (when (buffer-modified-p) (save-buffer)) @@ -2255,7 +2255,7 @@ Version 2022-12-29" (format "%suntitled_%s_%x.txt" user-emacs-directory (format-time-string "%Y%m%d_%H%M%S") - (random 100))) + (random (1- (expt 16 5) (xah-close-current-buffer)) (defun xah-close-current-buffer () @@ -3183,7 +3183,7 @@ Version 2022-10-31" ("e y" . xah-insert-double-angle-quote) ("f" . xah-search-current-word) - ("g" . xah-close-current-buffer) + ("g" . xah-save-close-current-buffer) ("h a" . apropos-command) ("h b" . describe-bindings)
[elpa] externals/auctex a3887ad184 02/76: Ignore errors from dbus-ping (fixes bug#59380).
branch: externals/auctex commit a3887ad184319f8427e8f0aec5ad45bb0112644c Author: Tassilo Horn Commit: Tassilo Horn Ignore errors from dbus-ping (fixes bug#59380). We just want to test if a viewer's DBUS interface works. If there are errors, the answer is surely no/nil. * tex.el (TeX-evince-dbus-p): Ignore errors from dbus-ping. --- tex.el | 32 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/tex.el b/tex.el index d74d10d0df..7cfcd14a93 100644 --- a/tex.el +++ b/tex.el @@ -1106,24 +1106,32 @@ DE is the name of the desktop environment, APP is the name of viewer." (and (featurep 'dbusbind) (require 'dbus nil :no-error) (dbus-ignore-errors (dbus-get-unique-name :session)) - (dbus-ping :session (format "org.%s.%s.Daemon" de app)) + ;; Apparently, `dbus-ping' can signal errors in certain + ;; situations. If so, fail gracefully (bug#59380). + (ignore-errors + (dbus-ping :session (format "org.%s.%s.Daemon" de app) + ;; Don't block for up to 25 secs if something + ;; is wonky. + 2000)) (or (not (memq :forward options)) (let ((spec (dbus-introspect-get-method :session (format "org.%s.%s.Daemon" de app) (format "/org/%s/%s/Daemon" de app) (format "org.%s.%s.Daemon" de app) "FindDocument"))) - ;; FindDocument must exist, and its signature must be (String, - ;; Boolean, String). Evince versions between 2.30 and 2.91.x - ;; didn't have the Boolean spawn argument we need to start evince - ;; initially. - (and spec -(equal '("s" "b" "s") - (delq nil (mapcar (lambda (elem) - (when (and (listp elem) - (eq (car elem) 'arg)) - (cdr (caar (cdr elem) - spec) + ;; FindDocument must exist, and its signature must be + ;; (String, Boolean, String). Evince versions between + ;; 2.30 and 2.91.x didn't have the Boolean spawn + ;; argument we need to start evince initially. + (and +spec +(equal '("s" "b" "s") + (delq nil (mapcar + (lambda (elem) +(when (and (listp elem) + (eq (car elem) 'arg)) + (cdr (caar (cdr elem) + spec) (defun TeX-pdf-tools-sync-view () "Focus the focused page/paragraph in `pdf-view-mode'.
[elpa] externals/auctex 94c28a3214 10/76: Enhance scope environmnent support
branch: externals/auctex commit 94c28a32147b3c2de02dc2702ae38ac232b40d70 Author: Ikumi Keita Commit: Ikumi Keita Enhance scope environmnent support * context.el (ConTeXt-after-insert-env-hook): New hook. (ConTeXt-insert-environment): Follow the change in `LaTeX-insert-environment' to support the form (ConTeXt-add-environments '("scope" FUNCTION-NAME ARGS)) as well as to run the above new hook. (ConTeXt-env-args,ConTeXt--env-parse-args): New function and its helper function. Adapted copies of `LaTeX-env-args' and `LaTeX--env-parse-args'. * style/tikz.el (TeX-TikZ-env-scope): New function. ("tikz"): Use the above new function to support scope env. in LaTeX and ConTeXt. (TeX-TikZ-get-opt-arg-string): Fix spacing in the doc string. (declare-function): Silence compiler. --- context.el| 167 -- style/tikz.el | 20 +-- 2 files changed, 155 insertions(+), 32 deletions(-) diff --git a/context.el b/context.el index 40eacda811..c278e460ea 100644 --- a/context.el +++ b/context.el @@ -759,40 +759,151 @@ With optional ARG, modify current environment." (end-of-line) (newline)) +(defvar ConTeXt-after-insert-env-hook nil + "List of functions to be run at the end of `ConTeXt-insert-environment'. +Each function is called with three arguments: the name of the +environment just inserted, the buffer position just before +\\start... and the position just before \\stop") + +;;; Copy and adaptation of `LaTeX-insert-environment'. (2022-08-13) (defun ConTeXt-insert-environment (environment &optional extra) - "Insert ENVIRONMENT, with optional argument EXTRA." - (if (and (TeX-active-mark) - (not (eq (mark) (point + "Insert ConTeXt ENVIRONMENT with optional argument EXTRA." + (let ((active-mark (and (TeX-active-mark) (not (eq (mark) (point) +content-start env-start env-end additional-indent) +(when (and active-mark (< (mark) (point))) (exchange-point-and-mark)) +;; What to do with the line containing point. +;; - Open a new empty line for later insertion of "\startfoo" and +;; put the point there. +;; - If there were at first any non-whitespace texts between the +;; point and EOL, send them into their new own line. +(cond (;; When the entire line consists of whitespaces... + (save-excursion (beginning-of-line) + (looking-at "[ \t]*$")) + ;; ...make the line empty and put the point there. + (delete-region (match-beginning 0) (match-end 0))) + (;; When there are only whitespaces between the point and + ;; BOL (including the case the point is at BOL)... + (TeX-looking-at-backward "^[ \t]*" +(line-beginning-position)) + ;; ...in this case, we have non-whitespace texts between + ;; the point and EOL, so send the entire line into a new + ;; next line and put the point on the empty line just + ;; created. + (beginning-of-line) + (newline) + (beginning-of-line 0) + ;; Take note that there are texts to be indented later + ;; unless the region is activated. + (unless active-mark + (setq additional-indent t))) + (;; In all other cases... + t + ;; ...insert a new empty line after deleting all + ;; whitespaces around the point, put the point there... + (delete-horizontal-space) + (if (eolp) + (newline) + ;; ...and if there were at first any non-whitespace texts + ;; between (the original position of) the point and EOL, + ;; send them into a new next line. + (newline 2) + (beginning-of-line 0) + ;; Take note that there are texts to be indented later + ;; unless the region is activated. + (unless active-mark + (setq additional-indent t) +;; What to do with the line containing mark. +;; If there is active region... +(when active-mark + ;; - Open a new empty line for later insertion of "\stopfoo" + ;; and put the mark there. + ;; - If there were at first any non-whitespace texts between the + ;; mark and EOL, pass them over the empty line and put them on + ;; their own line. (save-excursion -(if (< (mark) (point)) -(exchange-point-and-mark)) -(insert TeX-esc (ConTeXt-environment-start-name) environment) -(newline) -(forward-line -1) -(indent-according-to-mode) -(if extra (insert extra)) (goto-char (mark)) -(or (TeX-looking-at-backward "^[ \t]*") -(newline)) -(insert TeX-esc (ConTeXt-environment-stop-name) environment) -(newline) -(forward-line -1) -(indent-acc
[elpa] externals/auctex 65652e8c2d 13/76: Simplify implementation of style/breqn.el
branch: externals/auctex commit 65652e8c2d7480fae7d25099630489f5c4728911 Author: Arash Esbati Commit: Arash Esbati Simplify implementation of style/breqn.el * style/breqn.el (LaTeX-breqn-key-val-options): New function. (LaTeX-breqn-env): Delete function. ("breqn"): Replace functionality of deleted function with standard ones. Don't use `LaTeX-env-label-as-keyval' for starred environments. --- style/breqn.el | 65 -- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/style/breqn.el b/style/breqn.el index 035205565c..bdca52839f 100644 --- a/style/breqn.el +++ b/style/breqn.el @@ -1,6 +1,6 @@ ;;; breqn.el --- AUCTeX style for `breqn.sty' (v0.98j) -*- lexical-binding: t; -*- -;; Copyright (C) 2017--2020 Free Software Foundation, Inc. +;; Copyright (C) 2017--2022 Free Software Foundation, Inc. ;; Author: Arash Esbati ;; Maintainer: auctex-de...@gnu.org @@ -64,6 +64,17 @@ "Key=value options for breqn environments. The keys \"label\" and \"labelprefix\" are omitted.") +(defun LaTeX-breqn-key-val-options () + "Return updated key=val's based on the current \"breqn\" environment." + (let ((currenv (LaTeX-current-environment))) +(cond ((string-match-p "\\`dgroup" currenv) + (append '(("noalign") ("brace")) + LaTeX-breqn-key-val-options)) + ((string-match-p "\\`darray" currenv) + (append '(("noalign") ("brace") ("cols" ("{}"))) + LaTeX-breqn-key-val-options)) + (t LaTeX-breqn-key-val-options + (defvar LaTeX-breqn-key-val-label-regexp `(,(concat "begin{" @@ -73,26 +84,6 @@ The keys \"label\" and \"labelprefix\" are omitted.") 1 LaTeX-auto-label) "Matches the label inside an optional argument after \\begin{}.") -(defun LaTeX-breqn-env (env) - "Insert ENV from breqn package incl. optional key=val argument. -Keys offered for key=val query depend on ENV. \"label\" and -\"labelprefix\" are omitted." - (let ((keyvals - (TeX-read-key-val t - (cond ((or (string= env "dgroup") - (string= env "dgroup*")) - (append '(("noalign") ("brace")) - LaTeX-breqn-key-val-options)) - ((or (string= env "darray") - (string= env "darray*")) - (append '(("noalign") ("brace") ("cols" ("{}"))) - LaTeX-breqn-key-val-options)) - (t LaTeX-breqn-key-val-options) -(LaTeX-insert-environment env (when (and keyvals - (not (string= keyvals ""))) -(concat LaTeX-optop keyvals LaTeX-optcl))) -(LaTeX-env-label-as-keyval nil nil keyvals env))) - (add-hook 'TeX-update-style-hook #'TeX-auto-parse t) (TeX-add-style-hook @@ -119,14 +110,30 @@ Keys offered for key=val query depend on ENV. \"label\" and (reftex-add-label-environments '(("darray" ?e nil nil eqnarray-like (LaTeX-add-environments -'("dmath" LaTeX-breqn-env) -'("dmath*" LaTeX-breqn-env) -'("dseries" LaTeX-breqn-env) -'("dseries*" LaTeX-breqn-env) -'("dgroup" LaTeX-breqn-env) -'("dgroup*" LaTeX-breqn-env) -'("darray" LaTeX-breqn-env) -'("darray*" LaTeX-breqn-env) +'("dmath" LaTeX-env-args + [TeX-arg-key-val (LaTeX-breqn-key-val-options)] + LaTeX-env-label-as-keyval) +'("dmath*" LaTeX-env-args + [TeX-arg-key-val (LaTeX-breqn-key-val-options)]) + +'("dseries" LaTeX-env-args + [TeX-arg-key-val (LaTeX-breqn-key-val-options)] + LaTeX-env-label-as-keyval) +'("dseries*" LaTeX-env-args + [TeX-arg-key-val (LaTeX-breqn-key-val-options)]) + +'("dgroup" LaTeX-env-args + [TeX-arg-key-val (LaTeX-breqn-key-val-options)] + LaTeX-env-label-as-keyval) +'("dgroup*" LaTeX-env-args + [TeX-arg-key-val (LaTeX-breqn-key-val-options)]) + +'("darray" LaTeX-env-args + [TeX-arg-key-val (LaTeX-breqn-key-val-options)] + LaTeX-env-label-as-keyval) +'("darray*" LaTeX-env-args + [TeX-arg-key-val (LaTeX-breqn-key-val-options)]) + '("dsuspend")) (TeX-add-symbols
[elpa] externals/auctex 1c7a1b582e 23/76: Simplify implementation of style/csquotes.el
branch: externals/auctex commit 1c7a1b582e41f4dfd171ccdd20ce711fad6509ff Author: Arash Esbati Commit: Arash Esbati Simplify implementation of style/csquotes.el * style/csquotes.el (LaTeX-csquotes-read-language) (LaTeX-arg-csquotes-language): Delete functions. (LaTeX-csquotes-language-list): New function. ("csquotes"): Adjust the hook acc. to the changes above. --- style/csquotes.el | 126 +- 1 file changed, 68 insertions(+), 58 deletions(-) diff --git a/style/csquotes.el b/style/csquotes.el index d6d06816ea..9caf2a3bf1 100644 --- a/style/csquotes.el +++ b/style/csquotes.el @@ -39,35 +39,16 @@ "font-latex" (keywords class)) -(defun LaTeX-csquotes-read-language (optional &optional prompt) - "Read and return a language for csquotes macros. -If OPTIONAL is non-nil, indicate it in minibuffer while reading -user input. PROMPT replaces the standard one \"Language\". This -function checks if the functions `LaTeX-babel-active-languages' -or `LaTeX-polyglossia-active-languages' are bound and use them to -retrieve the active languages. If none available, user is -requested to enter a language." - (cond ((and (fboundp 'LaTeX-babel-active-languages) - (LaTeX-babel-active-languages)) - (completing-read - (TeX-argument-prompt optional prompt "Language") - (LaTeX-babel-active-languages))) -((and (fboundp 'LaTeX-polyglossia-active-languages) - (LaTeX-polyglossia-active-languages)) - (completing-read - (TeX-argument-prompt optional prompt "Language") - (LaTeX-polyglossia-active-languages))) -(t - (TeX-read-string - (TeX-argument-prompt optional prompt "Language") - -(defun LaTeX-arg-csquotes-language (optional &optional prompt) - "Insert a language for csquotes macros. -If OPTIONAL is non-nil, insert the language in square brackets. -PROMPT replaces the standard one \"Language\"." - (TeX-argument-insert - (LaTeX-csquotes-read-language optional prompt) - optional)) +(defun LaTeX-csquotes-language-list () + "Return a list of active languages for csquotes macros. +This function checks if the functions +`LaTeX-babel-active-languages' or +`LaTeX-polyglossia-active-languages' are bound and use them to +retrieve the active languages." + (or (and (fboundp 'LaTeX-babel-active-languages) + (LaTeX-babel-active-languages)) + (and (fboundp 'LaTeX-polyglossia-active-languages) + (LaTeX-polyglossia-active-languages (TeX-add-style-hook "csquotes" @@ -92,10 +73,14 @@ PROMPT replaces the standard one \"Language\"." '("enquote*" 1) ;; 3.2 Quoting Text in a Foreign Language - '("foreignquote" LaTeX-arg-csquotes-language 1) - '("foreignquote*" LaTeX-arg-csquotes-language 1) - '("hyphenquote" LaTeX-arg-csquotes-language 1) - '("hyphenquote*" LaTeX-arg-csquotes-language 1) + '("foreignquote" +(TeX-arg-completing-read (LaTeX-csquotes-language-list)) t) + '("foreignquote*" +(TeX-arg-completing-read (LaTeX-csquotes-language-list)) t) + '("hyphenquote" +(TeX-arg-completing-read (LaTeX-csquotes-language-list)) t) + '("hyphenquote*" +(TeX-arg-completing-read (LaTeX-csquotes-language-list)) t) ;; 3.3 Formal Quoting of Regular Text '("textquote" ["Citation"] ["Punctuation"] t) @@ -103,24 +88,31 @@ PROMPT replaces the standard one \"Language\"." ;; 3.4 Formal Quoting of Text in a Foreign Language '("foreigntextquote" -LaTeX-arg-csquotes-language ["Citation"] ["Punctuation"] t) +(TeX-arg-completing-read (LaTeX-csquotes-language-list)) +["Citation"] ["Punctuation"] t) '("foreigntextquote*" -LaTeX-arg-csquotes-language ["Citation"] ["Punctuation"] t) +(TeX-arg-completing-read (LaTeX-csquotes-language-list)) +["Citation"] ["Punctuation"] t) '("hyphentextquote" -LaTeX-arg-csquotes-language ["Citation"] ["Punctuation"] t) +(TeX-arg-completing-read (LaTeX-csquotes-language-list)) +["Citation"] ["Punctuation"] t) '("hyphentextquote*" -LaTeX-arg-csquotes-language ["Citation"] ["Punctuation"] t) +(TeX-arg-completing-read (LaTeX-csquotes-language-list)) +["Citation"] ["Punctuation"] t) ;; 3.5 Block Quoting of Regular Text '("blockquote" ["Citation"] ["Punctuation"] t) ;; 3.6 Block Quoting of Text in a Foreign Language '("foreignblockquote" -LaTeX-arg-csquotes-language ["Citation"] ["Punctuation"] t) +(TeX-arg-completing-read (LaTeX-csquotes-language-list)) +["Citation"] ["Punctuation"] t) '("hyphenblockquote" -LaTeX-arg-csquotes-language ["Citation"] ["Punctuation"] t) +(TeX-arg-completing-read (LaTeX-csquotes-language-list)) +["Citation"] ["Punctuation"] t)
[elpa] externals/auctex eca0fadbc3 18/76: ; Trivial cleanups
branch: externals/auctex commit eca0fadbc3462aebc48f8a672243a2776e148d8a Author: Ikumi Keita Commit: Ikumi Keita ; Trivial cleanups * tex.el (TeX-search-unescaped): Quote function names by #'. (TeX-parse-all-errors): Remove comment which no longer applies since tex-buf.el was merged into tex.el. (TeX-insert-braces): Signal error in read-only buffer when called interactively. * context.el (TeX-ConTeXt-sentinel, ConTeXt-find-matching-start) (ConTeXt-dialect, ConTeXt-mode-common-initialization) * plain-tex.el (plain-TeX-dialect) * tex-info.el (Texinfo-mark-environment) (Texinfo-nodename-de-escape, Texinfo-nodename-escape) (Texinfo-reftex-section-info, TeX-texinfo-mode): Fix word spacings in comments and doc strings. * latex.el (LaTeX-error-description-list): Delete trailing space in explanatory sentences. (LaTeX-fill-paragraph): Signal error in read-only buffer when called interactively. --- context.el | 20 ++-- latex.el | 8 plain-tex.el | 2 +- tex-info.el | 10 +- tex.el | 11 +++ 5 files changed, 23 insertions(+), 28 deletions(-) diff --git a/context.el b/context.el index c278e460ea..c8a99b94c6 100644 --- a/context.el +++ b/context.el @@ -598,7 +598,7 @@ for a label to be inserted after the sectioning command." (cond ((TeX-TeX-sentinel-check process name)) ((save-excursion ;; in a full ConTeXt run there will multiple texutil - ;; outputs. Just looking for "another run needed" would + ;; outputs. Just looking for "another run needed" would ;; find the first occurence (goto-char (point-max)) (re-search-backward "TeXUtil " nil t) @@ -906,9 +906,9 @@ set to the point where this function starts. Point will be at (ConTeXt--env-parse-args args)) -;; with the following we can call a function on an environment. Say +;; with the following we can call a function on an environment. Say ;; you have metapost stuff within your TeX file, go to the environment -;; and run ConTeXt-work-on-environment (suggested Key: C-c !). AUCTeX +;; and run ConTeXt-work-on-environment (suggested Key: C-c !). AUCTeX ;; sees that you are inside e.g. \startMPpage\stopMPpage and ;; looks in ConTeXt-environment-helper for a function to be called. @@ -953,7 +953,7 @@ An entry looks like: (\"environment\" . function)") (context-mode) (widen)) -;; find smarter name. Suggestions welcome +;; find smarter name. Suggestions welcome (defun ConTeXt-work-on-environment () "Takes current environment and does something on it (todo: documentation)." (interactive) @@ -1049,10 +1049,10 @@ If INNER is non-nil, go to the point just past the \\start... macro." (setq level (1- level)) ;; now we have to look if we want to start behind the \start... macro (when inner - ;; \startfoo can have 0 or more {} and [] pairs. I assume that - ;; skipping all those parens will be smart enough. It fails when + ;; \startfoo can have 0 or more {} and [] pairs. I assume that + ;; skipping all those parens will be smart enough. It fails when ;; the first part in the \start-\stop-environment is { or [, like - ;; in \startquotation {\em important} \stopquotation. There is + ;; in \startquotation {\em important} \stopquotation. There is ;; yet another pitfall: \startsetups SomeSetup foo bar ;; \stopsetups will use SomeSetup as the argument and the ;; environment @@ -1262,7 +1262,7 @@ An optional fourth (or sixth) element means always replace if t." (match-string 1) (buffer-substring-no-properties (point) (line-end-position) -;; This imenu also includes commented out chapters. Perhaps a feature +;; This imenu also includes commented out chapters. Perhaps a feature ;; for LaTeX, not sure we want or need that for ConTeXt. (defun ConTeXt-imenu-create-index-function () @@ -1799,7 +1799,7 @@ Use `ConTeXt-Mark-version' to choose the command." (defconst ConTeXt-dialect :context "Default dialect for use with function `TeX-add-style-hook' for argument DIALECT-EXPR when the hook is to be run only on ConTeXt -file, or any mode derived thereof. See variable +file, or any mode derived thereof. See variable `TeX-style-hook-dialect'." ) (defcustom ConTeXt-clean-intermediate-suffixes @@ -1851,7 +1851,7 @@ that is, you do _not_ have to cater for this yourself by adding \\=' or $." (setq ConTeXt-indent-item-re (concat "\\(" (mapconcat #'identity ConTeXt-item-list "\\|") "\\)\\>")) ;; What's the deepest level at we can collapse a document? - ;; set only if user has not set it. Need to be set before menu is created. + ;; set only if user has not set it. Need to be set before menu is created. ;; level 2 is "section" (or ConTeXt-largest-level (setq ConTeXt-largest-lev
[elpa] externals/auctex updated (945aba3d41 -> 358b4d0785)
tsdh pushed a change to branch externals/auctex. from 945aba3d41 Release GNU AUCTeX 13.1.6 new 6bdb392dfe ; * style/theorem.el ("theorem"): Fix last change. new a3887ad184 Ignore errors from dbus-ping (fixes bug#59380). new 6a5c691f7e Simplify implementation of style/amsthm.el new aaf71ede5d Simplify implementation of style/ntheorem.el new 7f9e7ec8a1 * style/array.el ("array"): Replace `TeX-arg-eval' with a closure. new 08f4fda5bd * style/attachfile.el ("attachfile"): Replace `TeX-arg-eval'. new 5c67eb2dfd Simplify implementation of style/babel.el new 2342a342f9 Simplify implementation of style/bigstrut.el new 75bea89b03 Simplify implementation of style/booktabs.el new 94c28a3214 Enhance scope environmnent support new ee9e8a2b6e Move `TeX-TikZ-point-name-regexp' to tex-style.el new c60ed913a0 ; Remove unnecessary `declare-function' new 65652e8c2d Simplify implementation of style/breqn.el new e4ceb88bb7 Bind a value to `LaTeX-current-environment' locally new 00f9192bbb Check the value of `LaTeX-current-environment' first new d937d4035c Simplify implementation of style/changelog.el new 3d5ac9cf7a Cleanup newcommand/newenvironment support new eca0fadbc3 ; Trivial cleanups new d55a960018 Simplify implementation of style/changes.el new 7bb6878867 Simplify implementation of style/CJK.el new 0cea7e107a Simplify implementation of style/cleveref.el new a648993763 * style/comment.el ("comment"): Replace `TeX-arg-eval'. new 1c7a1b582e Simplify implementation of style/csquotes.el new c7de94dc94 Replace `TeX-arg-eval' new d7dc696f47 * latex.el (LaTeX-env-contents): Add the "nowarn" key. new 7da1860c2a Support starred section names new ba70baec6c Fix doc strings regarding to section commands new 13c77f998e Simplify implementation of style/empheq.el new 4b9dafad86 Simplify implementation of style/fancyvrb.el new 287da56401 Revert "Bind a value to `LaTeX-current-environment' locally" new 5484b57bc4 Don't rely on the value of `LaTeX-current-environment' new 1a72c0f884 Simplify implementation of style/floatrow.el new 8941bd640f * style/fontspec.el ("fontspec"): Replace `TeX-arg-eval'. new 517d5a6e4e ; * style/floatrow.el ("floatrow"): Fix last change. new 3e8aa71ef2 Fix bug#58689 with a bit of optiomization new ac7ad4fff4 Simplify implementation of style/footmisc.el new 2664170ecc Update style/fvextra.el to package version 1.5 new 33bb54bb9e Simplify implementation of style/geometry.el new 1def8bd570 ; * style/graphics.el ("graphics"): Remove unnecessary `function'. new b7b498baad Simplify implementation of style/graphicx.el new 324cb5c913 Simplify implementation of style/hologo.el new 5b693f4e2e ; * style/hyperref.el ("hyperref"): Don't use list inside vector. new f84b1a5fdb Simplify implementation of style/ifthen.el new eb7b8d4de4 * style/listings.el ("listings"): Replace `TeX-arg-eval'. new 68e14e7ce4 * style/ltablex.el ("ltablex"): Add fontification support. new 83622003aa * style/enumitem.el ("enumitem"): Replace `TeX-arg-eval'. new 7c15b32d06 Simplify implementation of style/ltugboat.el new 982b20571c * style/ltxdoc.el ("ltxdoc"): Replace `TeX-arg-eval'. new fb9c5645dc * style/ltxtable.el ("ltxtable"): Replace `TeX-arg-eval'. new 28eee191b2 ; * style/enumitem.el ("enumitem"): Slightly improve last change. new 5b73efbfe3 ; * latex.el (LaTeX-what-macro): Assign values in one go. new 22336f15bd Simplify implementation of style/mathtools.el new e772b93525 * style/mdframed.el ("mdframed"): Replace `TeX-arg-eval'. new d43bfae3fa Overhaul beamer.el new 22fa670915 ; Fix doc strings new 3806176ba2 Fix argument description in doc strings new 288665587a Use `symbol-value' instead of `eval' new 5f129b5dca Support starred variant name new a57e627284 Improve consistency between similar functions new d3ab64f893 Reduce redundancy in regexp new bf66b302a4 Improve the previous commit slightly new e97fb94f4e Pacify compiler warning new 46c1a5a592 Add filename as a prefix to catchfilebetweentags counter new 4700af5dd4 ; Delete ineffective string escapes reported by Relint new ff65b9b4d0 Avoid compiler warnings with long function names new b2b899a450 ; * style/pstricks.el (LaTeX-package-parameter-value): Pacify compiler. new 54c82bd093 New style file physics.el new 906e57dfb8 ; * style/physics.el: Write proper date. new 2d0fdebac0 Preserve braces after @TeX and similar macros. new f9b378a45c Support detached arguments new 30bca31f77 ; * style/xcolor.el ("xcolor"): R
[elpa] externals/auctex aaf71ede5d 04/76: Simplify implementation of style/ntheorem.el
branch: externals/auctex commit aaf71ede5d17fb83107a22b5952e45ac31a15159 Author: Arash Esbati Commit: Arash Esbati Simplify implementation of style/ntheorem.el * style/ntheorem.el (LaTeX-ntheorem-fontdecl) (LaTeX-arg-ntheorem-fontdecl, LaTeX-ntheorem-env-label): Delete variable and functions. (LaTeX-ntheorem-auto-cleanup): Use `LaTeX-env-label-args' instead of `LaTeX-ntheorem-env-label'. ("ntheorem"): Replace `TeX-arg-eval' with a closure. Replace functionality of deleted functions with standard ones. --- style/ntheorem.el | 179 ++ 1 file changed, 73 insertions(+), 106 deletions(-) diff --git a/style/ntheorem.el b/style/ntheorem.el index aa28c31f88..59455b996e 100644 --- a/style/ntheorem.el +++ b/style/ntheorem.el @@ -29,10 +29,20 @@ ;; This file adds support for `ntheorem.sty' (v1.33) from 2011/08/15. ;; `ntheorem.sty' is and part of TeXLive. -;; The style provides the function `LaTeX-ntheorem-env-label' which -;; enables new defined environments with "\newtheoreom" to interact -;; with AUCTeX and RefTeX mechanisms for inserting labels. Check -;; docstring of `LaTeX-ntheorem-env-label' for instructions. +;; This style interacts with AUCTeX and RefTeX mechanisms for +;; inserting labels into new defined environments with "\newtheoreom". +;; AUCTeX users need to add the new environment to `LaTeX-label-alist' +;; via customize or in init-file like this: +;; +;; (add-to-list 'LaTeX-label-alist '("lemma" . "lem:")) +;; +;; RefTeX users have to add the value to both `LaTeX-label-alist' and +;; `reftex-label-alist' like this: +;; +;; (add-to-list 'LaTeX-label-alist '("lemma" . "lem:")) +;; (add-to-list 'reftex-label-alist +;;'("lemma" ?m "lem:" "~ref{%s}" +;; nil ("Lemma" "lemma") nil)) ;;; Code @@ -65,60 +75,6 @@ defined with \"\\newtheoremstyle\".") \"\\theoremlisttype\" provided by `ntheorem.el' and new ones defined with \"\\newtheoremlisttype\".") -(defvar LaTeX-ntheorem-fontdecl - '(;; family -"rmfamily" "sffamily" "ttfamily" -;; series -"mdseries" "bfseries" -;; shape -"upshape" "itshape" "slshape" "scshape" -;; size -"tiny" "scriptsize" "footnotesize" -"small" "normalsize" "large" -"Large" "LARGE" "huge" "Huge" -;; reset macro -"normalfont") - "List of font declaration commands for \"\\newtheoremstyle\".") - -(defun LaTeX-arg-ntheorem-fontdecl (optional &optional prompt) - "Prompt for font declaration commands in \"\\theorem(body|header)font\". -If OPTIONAL is non-nil, insert the resulting value as an optional -argument. Use PROMPT as the prompt string." - (let* ((crm-separator (regexp-quote TeX-esc)) - (fontdecl (mapconcat #'identity - (TeX-completing-read-multiple - (TeX-argument-prompt optional prompt "Font declaration: \\" t) - LaTeX-ntheorem-fontdecl) - TeX-esc))) -(TeX-argument-insert fontdecl - optional - (when (and fontdecl (not (string= fontdecl ""))) - TeX-esc - -(defun LaTeX-ntheorem-env-label (environment) - "Insert ENVIRONMENT, query for an optional argument and prompt -for label. AUCTeX users should add ENVIRONMENT to -`LaTeX-label-alist' via customize or in init-file with: - - (add-to-list \\='LaTeX-label-alist \\='(\"lemma\" . \"lem:\")) - -RefTeX users should customize or add ENVIRONMENT to -`LaTeX-label-alist' and `reftex-label-alist', for example - - (add-to-list \\='LaTeX-label-alist \\='(\"lemma\" . \"lem:\")) - (add-to-list \\='reftex-label-alist - \\='(\"lemma\" ?m \"lem:\" \"~\\ref{%s}\" - nil (\"Lemma\" \"lemma\") nil))" - (let ((opthead (TeX-read-string - (TeX-argument-prompt t nil "Heading" -(LaTeX-insert-environment environment - (when (and opthead - (not (string= opthead ""))) -(format "[%s]" opthead - (when (LaTeX-label environment 'environment) -(LaTeX-newline) -(indent-according-to-mode))) - ;; Setup parsing for \newtheorem (TeX-auto-add-type "ntheorem-newtheorem" "LaTeX") @@ -141,9 +97,10 @@ make them available as new environments. Update `LaTeX-ntheorem-theoremstyle-list' with styles defined with \"\\newtheoremstyle\"." (dolist (newthm (mapcar #'car (LaTeX-ntheorem-newtheorem-list))) -(LaTeX-add-environments (list newthm #'LaTeX-ntheorem-env-label)) +(LaTeX-add-environments (list newthm + #'LaTeX-env-label-args ["Heading"])) (LaTeX-add-environments (list (concat newthm "*") - #'LaTeX-ntheorem-env-label))) + #'LaTeX-env-label-args ["Heading"]))) (dolist (newthmstyle (LaTeX-ntheor
[elpa] externals/auctex 7bb6878867 20/76: Simplify implementation of style/CJK.el
branch: externals/auctex commit 7bb6878867c22ae1a259ffc27a6183cc539bb9ec Author: Arash Esbati Commit: Arash Esbati Simplify implementation of style/CJK.el * style/CJK.el (LaTeX-CJK-fontenc-list): New variable. (LaTeX-env-CJK): Delete function ("CJK"): Replace functionality of deleted function with standard ones. --- style/CJK.el | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/style/CJK.el b/style/CJK.el index baee5d93c9..030cc8c5a6 100644 --- a/style/CJK.el +++ b/style/CJK.el @@ -1,6 +1,6 @@ ;;; CJK.el --- AUCTeX style for the CJK package. -*- lexical-binding: t; -*- -;; Copyright (C) 2009-2021 Free Software Foundation, Inc. +;; Copyright (C) 2009-2022 Free Software Foundation, Inc. ;; Author: Ralf Angeli ;; Maintainer: auctex-de...@gnu.org @@ -43,17 +43,9 @@ "CNS2" "CNS3" "CNS4" "CNS5" "CNS6" "CNS7" "CEFX" "CEFY") "List of encodings supported by the CJK package.") -(defun LaTeX-env-CJK (env) - "Prompt for the arguments of ENV and insert it. -The function can be used for CJK and CJK* environments." - (LaTeX-insert-environment - env - (concat -(let ((font-enc (TeX-read-string "(Optional) Font encoding: "))) - (unless (zerop (length font-enc)) (format "[%s]" font-enc))) -(format "{%s}" (completing-read "Encoding: " -(mapcar #'list LaTeX-CJK-enc-list))) -(format "{%s}" (TeX-read-string "Font family: ") +(defvar LaTeX-CJK-fontenc-list + '("pmC" "dnp" "wn" "HL") + "List of font encodings supported by the CJK package.") (TeX-add-style-hook "CJK" @@ -90,8 +82,15 @@ The function can be used for CJK and CJK* environments." "CJKverbatim") ;; New environments (LaTeX-add-environments -'("CJK" LaTeX-env-CJK) -'("CJK*" LaTeX-env-CJK))) +'("CJK" LaTeX-env-args + [TeX-arg-completing-read LaTeX-CJK-fontenc-list "Font encoding"] + (TeX-arg-completing-read LaTeX-CJK-enc-list "Encoding") + "Font family") + +'("CJK*" LaTeX-env-args + [TeX-arg-completing-read LaTeX-CJK-fontenc-list "Font encoding"] + (TeX-arg-completing-read LaTeX-CJK-enc-list "Encoding") + "Font family"))) TeX-dialect) ;;; CJK.el ends here
[elpa] externals/auctex 28eee191b2 50/76: ; * style/enumitem.el ("enumitem"): Slightly improve last change.
branch: externals/auctex commit 28eee191b21ab0e65feee0de1fa99bfb850e91f6 Author: Arash Esbati Commit: Arash Esbati ; * style/enumitem.el ("enumitem"): Slightly improve last change. --- style/enumitem.el | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/style/enumitem.el b/style/enumitem.el index 6363a244da..5c120e33a5 100644 --- a/style/enumitem.el +++ b/style/enumitem.el @@ -238,8 +238,7 @@ `(,env LaTeX-env-item-args [TeX-arg-key-val (LaTeX-enumitem-key-val-options)])) ;; Tell AUCTeX about parsed description like environments. - (when (or (string-equal type "description") -(string-equal type "description*")) + (when (member type '("description" "description*")) (add-to-list 'LaTeX-item-list `(,env . LaTeX-item-argument))) ;; Add new env's to `ispell-tex-skip-alist': skip the opt. arg: (TeX-ispell-skip-setcdr `((,env ispell-tex-arg-end 0)) @@ -356,15 +355,14 @@ macro. Insert the value in brackets if OPTIONAL is non-nil." (mapcar #'cadr (LaTeX-enumitem-newlist-list))) "Type") - (TeX-arg-string "Max-depth") + "Max-depth" ,(lambda (_optional) (save-excursion (re-search-backward "newlist{\\([^}]+\\)}{\\([^}]+\\)}" (line-beginning-position) t)) (let ((name (match-string-no-properties 1)) (type (match-string-no-properties 2))) - (when (or (string-equal type "description") - (string-equal type "description*")) + (when (member type '("description" "description*")) (add-to-list 'LaTeX-item-list `(,name . LaTeX-item-argument))) (LaTeX-add-enumitem-newlists (list name type) @@ -433,8 +431,7 @@ macro. Insert the value in brackets if OPTIONAL is non-nil." (dolist (env-type (LaTeX-enumitem-newlist-list)) (let ((env (car env-type)) (type (cadr env-type))) -(when (or (string-equal type "enumerate") - (string-equal type "enumerate*")) +(when (member type '("enumerate" "enumerate*")) (push env enums enums)) "List name"))
[elpa] externals/auctex 6a5c691f7e 03/76: Simplify implementation of style/amsthm.el
branch: externals/auctex commit 6a5c691f7e23a14518510d505281ad9cb2b738a5 Author: Arash Esbati Commit: Arash Esbati Simplify implementation of style/amsthm.el * style/amsthm.el (LaTeX-amsthm-fontdecl) (LaTeX-arg-amsthm-fontdecl, LaTeX-amsthm-env-label): Delete variable and functions. (LaTeX-amsthm-auto-cleanup): Use `LaTeX-env-label-args' instead of `LaTeX-amsthm-env-label'. ("amsthm"): Replace `TeX-arg-eval' with a closure. Replace functionality of deleted functions with standard ones. --- style/amsthm.el | 139 +++- 1 file changed, 56 insertions(+), 83 deletions(-) diff --git a/style/amsthm.el b/style/amsthm.el index 64589c5bf4..ad06ff8919 100644 --- a/style/amsthm.el +++ b/style/amsthm.el @@ -1,6 +1,6 @@ ;;; amsthm.el --- Style hook for the AMS-LaTeX amsthm package. -*- lexical-binding: t; -*- -;; Copyright (C) 1997, 2013--2015, 2018, 2020 Free Software Foundation, Inc. +;; Copyright (C) 1997--2022 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Maintainer: auctex-de...@gnu.org @@ -24,10 +24,23 @@ ;;; Commentary: -;; The style provides the function `LaTeX-amsthm-env-label' which -;; enables new defined environments with "\newtheoreom" to interact -;; with AUCTeX and RefTeX mechanisms for inserting labels. Check -;; docstring of `LaTeX-amsthm-env-label' for instructions. +;; This file adds support for `theorem.sty' (v2.2c) from 2014/10/28. +;; `theorem.sty' is a standard LaTeX package and part of TeXLive. + +;; This style interacts with AUCTeX and RefTeX mechanisms for +;; inserting labels into new defined environments with "\newtheoreom". +;; AUCTeX users need to add the new environment to `LaTeX-label-alist' +;; via customize or in init-file like this: +;; +;; (add-to-list 'LaTeX-label-alist '("lemma" . "lem:")) +;; +;; RefTeX users have to add the value to both `LaTeX-label-alist' and +;; `reftex-label-alist' like this: +;; +;; (add-to-list 'LaTeX-label-alist '("lemma" . "lem:")) +;; (add-to-list 'reftex-label-alist +;;'("lemma" ?m "lem:" "~ref{%s}" +;; nil ("Lemma" "lemma") nil)) ;;; Code: @@ -42,60 +55,6 @@ (defvar LaTeX-amsthm-package-options nil "Package options for the amsthm package.") -(defvar LaTeX-amsthm-fontdecl - '(;; family -"rmfamily" "sffamily" "ttfamily" -;; series -"mdseries" "bfseries" -;; shape -"upshape" "itshape" "slshape" "scshape" -;; size -"tiny" "scriptsize" "footnotesize" -"small" "normalsize" "large" -"Large" "LARGE" "huge" "Huge" -;; reset macro -"normalfont") - "List of font declaration commands for \"\\newtheoremstyle\".") - -(defun LaTeX-arg-amsthm-fontdecl (optional &optional prompt) - "Prompt for font declaration commands in \"\\newtheoremstyle\". -If OPTIONAL is non-nil, insert the resulting value as an optional -argument. Use PROMPT as the prompt string." - (let* ((crm-separator (regexp-quote TeX-esc)) - (fontdecl (mapconcat #'identity - (TeX-completing-read-multiple - (TeX-argument-prompt optional prompt "Font: \\" t) - LaTeX-amsthm-fontdecl) - TeX-esc))) -(TeX-argument-insert fontdecl - optional - (when (and fontdecl (not (string= fontdecl ""))) - TeX-esc - -(defun LaTeX-amsthm-env-label (environment) - "Insert ENVIRONMENT, query for an optional argument and prompt -for label. AUCTeX users should add ENVIRONMENT to -`LaTeX-label-alist' via customize or in init-file with: - - (add-to-list \\='LaTeX-label-alist \\='(\"lemma\" . \"lem:\")) - -RefTeX users should customize or add ENVIRONMENT to -`LaTeX-label-alist' and `reftex-label-alist', for example - - (add-to-list \\='LaTeX-label-alist \\='(\"lemma\" . \"lem:\")) - (add-to-list \\='reftex-label-alist - \\='(\"lemma\" ?m \"lem:\" \"~\\ref{%s}\" - nil (\"Lemma\" \"lemma\") nil))" - (let ((opthead (TeX-read-string - (TeX-argument-prompt t nil "Heading" -(LaTeX-insert-environment environment - (when (and opthead - (not (string= opthead ""))) -(format "[%s]" opthead - (when (LaTeX-label environment 'environment) -(LaTeX-newline) -(indent-according-to-mode))) - ;; Setup parsing for \newtheorem (TeX-auto-add-type "amsthm-newtheorem" "LaTeX") @@ -112,7 +71,7 @@ RefTeX users should customize or add ENVIRONMENT to "Move parsed results from `LaTeX-auto-amsthm-newtheorem' and make them available as new environments." (dolist (newthm (mapcar #'car (LaTeX-amsthm-newtheorem-list))) -(LaTeX-add-environments (list newthm #'LaTeX-amsthm-env-label +(LaTeX-add-environments (list newthm #'LaTeX-env-label-args ["Headin
[elpa] externals/auctex 2342a342f9 08/76: Simplify implementation of style/bigstrut.el
branch: externals/auctex commit 2342a342f91f773bc6a4a95542b62798819584fd Author: Arash Esbati Commit: Arash Esbati Simplify implementation of style/bigstrut.el * style/bigstrut.el (TeX-arg-bigstrut): Delete the function and replace the functionality with `TeX-arg-completing-read' inside the hook. --- style/bigstrut.el | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/style/bigstrut.el b/style/bigstrut.el index 874a11802a..ae14b3b261 100644 --- a/style/bigstrut.el +++ b/style/bigstrut.el @@ -41,7 +41,9 @@ "bigstrut" (lambda () (TeX-add-symbols -'("bigstrut" [ TeX-arg-bigstrut ])) +'("bigstrut" + [TeX-arg-completing-read ("t" "b") + "Strut to top (t) or bottom (b)"])) (LaTeX-add-lengths "bigstrutjot") @@ -52,17 +54,6 @@ 'function))) TeX-dialect) -(defun TeX-arg-bigstrut (optional &optional prompt) - "Prompt for the optional argument in \\bigstrut. -If OPTIONAL is non-nil, insert the argument in brackets. PROMPT -replaces the standard one." - (TeX-argument-insert - (completing-read -(TeX-argument-prompt - optional prompt "Strut to top (t) or bottom (b)") -'("t" "b")) - optional)) - (defvar LaTeX-bigstrut-package-options nil "Package options for the bigstrut package.")
[elpa] externals/auctex ee9e8a2b6e 11/76: Move `TeX-TikZ-point-name-regexp' to tex-style.el
branch: externals/auctex commit ee9e8a2b6ef5677f7739e8dd19a31563520e93d3 Author: Ikumi Keita Commit: Ikumi Keita Move `TeX-TikZ-point-name-regexp' to tex-style.el * tex-style.el: * style/tikz.el (TeX-TikZ-point-function-map): Move defcustom into tex-style.el. (AUCTeX-TikZ): Delete group. --- style/tikz.el | 10 -- tex-style.el | 7 +++ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/style/tikz.el b/style/tikz.el index b812346851..e97a5fb6e8 100644 --- a/style/tikz.el +++ b/style/tikz.el @@ -39,16 +39,6 @@ (declare-function ConTeXt-insert-environment "context" (environment &optional extra)) -(defgroup AUCTeX-TikZ nil - "AUCTeX TikZ support" - :group 'AUCTeX) - -(defcustom TeX-TikZ-point-name-regexp - "(\\([A-Za-z0-9]+\\))" - "A regexp that matches TikZ names." - :type 'regexp - :group 'AUCTeX-TikZ) - (defconst TeX-TikZ-point-function-map '(("Rect Point" TeX-TikZ-arg-rect-point) ("Polar Point" TeX-TikZ-arg-polar-point) diff --git a/tex-style.el b/tex-style.el index b880bfcc25..d273ea082b 100644 --- a/tex-style.el +++ b/tex-style.el @@ -411,6 +411,13 @@ must be unique. It is initialized to ?s when added to `reftex-index-macros'." :type 'character) +;; style/tikz.el + +(defcustom TeX-TikZ-point-name-regexp + "(\\([A-Za-z0-9]+\\))" + "A regexp that matches TikZ names." + :type 'regexp) + ;; Don't look for file-local variables before this line, so that the ;; example in the docstring of `LaTeX-shortvrb-chars' isn't picked up.
[elpa] externals/auctex 3d5ac9cf7a 17/76: Cleanup newcommand/newenvironment support
branch: externals/auctex commit 3d5ac9cf7af5bedbae2e430024f001168d4e4a99 Author: Ikumi Keita Commit: Ikumi Keita Cleanup newcommand/newenvironment support * latex.el (LaTeX-common-initialization): Use `TeX-arg-define-macro-arguments' for optional argument for (re)newenvironment(*). Remove duplicated entries. (TeX-arg-define-macro-arguments): Fix line break of doc string. --- latex.el | 30 +++--- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/latex.el b/latex.el index ab6dcdc79b..354bb2f3a6 100644 --- a/latex.el +++ b/latex.el @@ -2406,9 +2406,9 @@ string." optional)) (defun TeX-arg-define-macro-arguments (optional &optional prompt) - "Prompt for the number of arguments for a LaTeX macro. If this -is non-zero, also prompt for the default value for the first -argument. + "Prompt for the number of arguments for a LaTeX macro. +If this is non-zero, also prompt for the default value for the +first argument. If OPTIONAL is non-nil, insert the resulting value as an optional argument, otherwise as a mandatory one. Use PROMPT as the prompt @@ -8095,17 +8095,17 @@ function would return non-nil and `(match-string 1)' would return '("newcommand" TeX-arg-define-macro [ TeX-arg-define-macro-arguments ] t) '("renewcommand" TeX-arg-macro [ TeX-arg-define-macro-arguments ] t) '("newenvironment" TeX-arg-define-environment - [ "Number of arguments"] t t) + [ TeX-arg-define-macro-arguments ] 2) '("renewenvironment" TeX-arg-environment - [ "Number of arguments"] t t) + [ TeX-arg-define-macro-arguments ] 2) '("providecommand" TeX-arg-define-macro [ TeX-arg-define-macro-arguments ] t) '("providecommand*" TeX-arg-define-macro [ TeX-arg-define-macro-arguments ] t) '("newcommand*" TeX-arg-define-macro [ TeX-arg-define-macro-arguments ] t) '("renewcommand*" TeX-arg-macro [ TeX-arg-define-macro-arguments ] t) '("newenvironment*" TeX-arg-define-environment - [ "Number of arguments"] t t) + [ TeX-arg-define-macro-arguments ] 2) '("renewenvironment*" TeX-arg-environment - [ "Number of arguments"] t t) + [ TeX-arg-define-macro-arguments ] 2) '("newtheorem" TeX-arg-define-environment [ TeX-arg-environment "Numbered like" ] t [ (TeX-arg-eval progn (if (eq (save-excursion @@ -8546,22 +8546,6 @@ function would return non-nil and `(match-string 1)' would return (setq TeX-font-list LaTeX-font-list) (setq TeX-font-replace-function #'TeX-font-replace-macro) (TeX-add-symbols - '("newcommand" TeX-arg-define-macro - [ TeX-arg-define-macro-arguments ] t) - '("renewcommand" TeX-arg-macro - [ TeX-arg-define-macro-arguments ] t) - '("providecommand" TeX-arg-define-macro - [ TeX-arg-define-macro-arguments ] t) - '("providecommand*" TeX-arg-define-macro - [ TeX-arg-define-macro-arguments ] t) - '("newcommand*" TeX-arg-define-macro - [ TeX-arg-define-macro-arguments ] t) - '("renewcommand*" TeX-arg-macro - [ TeX-arg-define-macro-arguments ] t) - '("newenvironment" TeX-arg-define-environment - [ TeX-arg-define-macro-arguments ] t t) - '("renewenvironment" TeX-arg-environment - [ TeX-arg-define-macro-arguments ] t t) '("usepackage" LaTeX-arg-usepackage) '("RequirePackage" LaTeX-arg-usepackage) '("ProvidesPackage" (TeX-arg-file-name-sans-extension "Package name")
[elpa] externals/auctex d55a960018 19/76: Simplify implementation of style/changes.el
branch: externals/auctex commit d55a9600188a65c6ed290f2f2baeb0a8adf4f741 Author: Arash Esbati Commit: Arash Esbati Simplify implementation of style/changes.el * style/changes.el (LaTeX-arg-changes-definechangesauthor) (LaTeX-arg-changes-markup): Delete functions. The functionality is provided inside the hook. (LaTeX-changes-definechangesauthor-key-val-options) (LaTeX-changes-key-val-options): New functions. ("changes"): Adjust the hook acc. to the changes above. --- style/changes.el | 92 1 file changed, 32 insertions(+), 60 deletions(-) diff --git a/style/changes.el b/style/changes.el index ba38bc5dc5..b0277686b4 100644 --- a/style/changes.el +++ b/style/changes.el @@ -60,56 +60,22 @@ (add-hook 'TeX-auto-prepare-hook #'LaTeX-changes-auto-prepare t) (add-hook 'TeX-update-style-hook #'TeX-auto-parse t) -(defun LaTeX-arg-changes-definechangesauthor (optional) - "Prompt for the arguments of \\definechangesauthor macro. -While reading the first optional argument, remove space from -`crm-local-completion-map' and `minibuffer-local-completion-map'. -Insert the argument in brackets if OPTIONAL is non-nil." - (let* ((crm-local-completion-map - (remove (assoc 32 crm-local-completion-map) - crm-local-completion-map)) - (minibuffer-local-completion-map - (remove (assoc 32 minibuffer-local-completion-map) - minibuffer-local-completion-map)) - (TeX-last-optional-rejected nil) - (keyval (LaTeX-check-insert-macro-default-style - (TeX-read-key-val - t - `(("name") - ("color" - ,(cond -((and (member "xcolor" (TeX-style-list)) - (fboundp 'LaTeX-xcolor-definecolor-list)) - (mapcar #'car (LaTeX-xcolor-definecolor-list))) -((and (member "color" (TeX-style-list)) - (fboundp 'LaTeX-color-definecolor-list)) - (mapcar #'car (LaTeX-color-definecolor-list))) -(t nil))) - (TeX-arg-opening-brace LaTeX-optop) - (TeX-arg-closing-brace LaTeX-optcl)) -(when keyval (TeX-argument-insert keyval t))) - (let ((id (TeX-read-string - (TeX-argument-prompt optional nil "Author ID" -(LaTeX-add-changes-definechangesauthors id) -(TeX-argument-insert id optional))) - -(defun LaTeX-arg-changes-markup (optional) - "Prompt for the argument of various markup commands. -Remove space from `crm-local-completion-map' and -`minibuffer-local-completion-map' while reading user input. -Insert the argument in brackets if OPTIONAL is non-nil." - (let* ((crm-local-completion-map - (remove (assoc 32 crm-local-completion-map) - crm-local-completion-map)) - (minibuffer-local-completion-map - (remove (assoc 32 minibuffer-local-completion-map) - minibuffer-local-completion-map)) - (keyval (TeX-read-key-val - optional - `(("id" ,(mapcar #'car - (LaTeX-changes-definechangesauthor-list))) -("comment") -(TeX-argument-insert keyval optional))) +(defun LaTeX-changes-definechangesauthor-key-val-options () + "Return a key=val list for the \\definechangesauthor macro." + `(("name") +("color" ,(cond ((and (member "xcolor" (TeX-style-list)) + (fboundp 'LaTeX-xcolor-definecolor-list)) + (mapcar #'car (LaTeX-xcolor-definecolor-list))) +((and (member "color" TeX-active-styles) + (fboundp 'LaTeX-color-definecolor-list)) + (mapcar #'car (LaTeX-color-definecolor-list))) +(t nil) + +(defun LaTeX-changes-key-val-options () + "Return a key=val list for the change management macros." + `(("id" ,(mapcar #'car + (LaTeX-changes-definechangesauthor-list))) +("comment"))) (TeX-add-style-hook "changes" @@ -134,17 +100,16 @@ Insert the argument in brackets if OPTIONAL is non-nil." (TeX-add-symbols ;; 4.2 Change management -'("added"[ LaTeX-arg-changes-markup ] 1) -'("deleted" [ LaTeX-arg-changes-markup ] 1) -'("replaced" [ LaTeX-arg-changes-markup ] 2) +'("added"[TeX-arg-key-val LaTeX-changes-key-val-options nil nil ?\s] 1) +'("deleted" [TeX-arg-key-val LaTeX-changes-key-val-options nil nil ?\s] 1) +'("replaced" [TeX-arg-key-val LaTeX-changes-key-val-options nil nil ?\s] 2) ;; 4.3 Highlighting and Comments -'("highlight" [ LaTeX-arg-changes-markup ] 1) -'("comment" - [TeX-arg-eval - TeX-read-key-val t `(("id" - ,(mapcar #'car - (LaTeX-changes-def
[elpa] externals/auctex 08f4fda5bd 06/76: * style/attachfile.el ("attachfile"): Replace `TeX-arg-eval'.
branch: externals/auctex commit 08f4fda5bd98608b9e384e034effc34fc4b03eb8 Author: Arash Esbati Commit: Arash Esbati * style/attachfile.el ("attachfile"): Replace `TeX-arg-eval'. --- style/attachfile.el | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/style/attachfile.el b/style/attachfile.el index c090b5a447..e3fe5eb7f6 100644 --- a/style/attachfile.el +++ b/style/attachfile.el @@ -1,6 +1,6 @@ ;;; attachfile.el --- AUCTeX style for `attachfile.sty' (v1.6) -*- lexical-binding: t; -*- -;; Copyright (C) 2015, 2018, 2020 Free Software Foundation, Inc. +;; Copyright (C) 2015--2022 Free Software Foundation, Inc. ;; Author: Arash Esbati ;; Maintainer: auctex-de...@gnu.org @@ -80,26 +80,26 @@ (TeX-add-symbols ;; \attachfile[]{} -'("attachfile" +`("attachfile" [TeX-arg-key-val LaTeX-attachfile-key-val-options] - (TeX-arg-eval - (lambda () + ,(lambda (optional) (let ((atfi (file-relative-name - (read-file-name "File to attach: " - (format "%s" atfi) + (read-file-name + (TeX-argument-prompt optional nil "File to attach") + (TeX-argument-insert atfi optional ;; \noattachfile[] '("noattachfile" [TeX-arg-key-val LaTeX-attachfile-key-val-options] ) ;; \textattachfile[]{}{} -'("textattachfile" +`("textattachfile" [TeX-arg-key-val LaTeX-attachfile-key-val-options] - (TeX-arg-eval - (lambda () + ,(lambda (optional) (let ((atfi (file-relative-name - (read-file-name "File to attach: " - (format "%s" atfi + (read-file-name + (TeX-argument-prompt optional nil "File to attach") + (TeX-argument-insert atfi optional))) t) ;; \notextattachfile[]{}
[elpa] externals/auctex 00f9192bbb 15/76: Check the value of `LaTeX-current-environment' first
branch: externals/auctex commit 00f9192bbbfbc1ecfc784f5a1b8c5e9880d7d44a Author: Arash Esbati Commit: Arash Esbati Check the value of `LaTeX-current-environment' first * style/breqn.el (LaTeX-breqn-key-val-options): Check if the variable `LaTeX-current-environment' contains a name before running the function of the same name. --- style/breqn.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/style/breqn.el b/style/breqn.el index bdca52839f..9b2ae933f7 100644 --- a/style/breqn.el +++ b/style/breqn.el @@ -66,7 +66,8 @@ The keys \"label\" and \"labelprefix\" are omitted.") (defun LaTeX-breqn-key-val-options () "Return updated key=val's based on the current \"breqn\" environment." - (let ((currenv (LaTeX-current-environment))) + (let ((currenv (or LaTeX-current-environment + (LaTeX-current-environment (cond ((string-match-p "\\`dgroup" currenv) (append '(("noalign") ("brace")) LaTeX-breqn-key-val-options))
[elpa] externals/auctex 3e8aa71ef2 35/76: Fix bug#58689 with a bit of optiomization
branch: externals/auctex commit 3e8aa71ef28ad05bd32bedf18bbeb4d8cd35c069 Author: Ikumi Keita Commit: Ikumi Keita Fix bug#58689 with a bit of optiomization * latex.el (LaTeX-modify-environment): Comment out redundant `beginning-of-line' and `end-of-line'. --- latex.el | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/latex.el b/latex.el index 69924b2152..04caaf539a 100644 --- a/latex.el +++ b/latex.el @@ -871,30 +871,32 @@ position just before \\begin and the position just before (LaTeX-environment-name-regexp) "\\)" (regexp-quote TeX-grcl)) -(save-excursion (beginning-of-line 1) (point) +(line-beginning-position (goto-begin (lambda () (LaTeX-find-matching-begin) (prog1 (point) (re-search-forward (concat (regexp-quote TeX-esc) "begin" (regexp-quote TeX-grop) - "\\(" + "\\(?:" (LaTeX-environment-name-regexp) "\\)" (regexp-quote TeX-grcl)) - (save-excursion (end-of-line 1) (point))) + (line-end-position)) (save-excursion (funcall goto-end) - (let ((old-env (match-string 1))) + (let ((old-env (match-string-no-properties 1)) +beg-pos) (replace-match environment t t nil 1) -(beginning-of-line 1) -(funcall goto-begin) +;; This failed when \begin and \end lie on the same line. (bug#58689) +;; (beginning-of-line 1) +(setq beg-pos (funcall goto-begin)) (replace-match environment t t nil 1) -(end-of-line 1) +;; (end-of-line 1) (run-hook-with-args 'LaTeX-after-modify-env-hook environment old-env -(save-excursion (funcall goto-begin)) -(progn (funcall goto-end) (point))) +beg-pos +(funcall goto-end)) (defvar LaTeX-syntactic-comments) ;; Defined further below.
[elpa] externals/auctex 75bea89b03 09/76: Simplify implementation of style/booktabs.el
branch: externals/auctex commit 75bea89b0304cd560ef83910f3899520f1e85c15 Author: Arash Esbati Commit: Arash Esbati Simplify implementation of style/booktabs.el * style/booktabs.el ("booktabs"): Delete the function `LaTeX-booktabs-arg-paren' and use `TeX-arg-string' instead. --- style/booktabs.el | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/style/booktabs.el b/style/booktabs.el index 79571ea3c5..bf3c0f532e 100644 --- a/style/booktabs.el +++ b/style/booktabs.el @@ -1,6 +1,6 @@ ;;; booktabs.el -- AUCTeX style for booktabs.sty -*- lexical-binding: t; -*- -;; Copyright (C) 2003, 2004, 2013, 2018, 2020 Free Software Foundation, Inc. +;; Copyright (C) 2003--2022 Free Software Foundation, Inc. ;; Author: Ralf Angeli ;; Maintainer: auctex-de...@gnu.org @@ -37,14 +37,6 @@ "font-latex" (keywords class)) -(defun LaTeX-booktabs-arg-paren (optional prompt) - "Prompt for a value and use parentheses when it is inserted. -If OPTIONAL is non-nil the parameter is labeled as optional. -PROMPT is the value of the prompt to be shown." - (let ((TeX-arg-opening-brace "(") -(TeX-arg-closing-brace ")")) -(TeX-parse-argument optional prompt))) - (TeX-add-style-hook "booktabs" (lambda () @@ -61,7 +53,8 @@ PROMPT is the value of the prompt to be shown." '("bottomrule" [ "Thickness" ]) ;; The `ignore' resets `TeX-last-optional-rejected' to nil so that the trim ;; argument is prompted also when the thickness is skipped. -'("cmidrule" [ "Thickness" ] (ignore) [ LaTeX-booktabs-arg-paren "Trim" ] +'("cmidrule" [ "Thickness" ] (ignore) + [TeX-arg-string "Trim" nil nil nil "(" ")"] "Column(s)") '("addlinespace" [ "Height" ]) '("morecmidrules")
[elpa] externals/auctex 2664170ecc 37/76: Update style/fvextra.el to package version 1.5
branch: externals/auctex commit 2664170ecc27c68c2c3f6c06ab04fed8fdd6c5d4 Author: Arash Esbati Commit: Arash Esbati Update style/fvextra.el to package version 1.5 * style/fvextra.el (LaTeX-fvextra-key-val-options): Add new key=vals. ("fvextra"): Add support for the new "VerbEnv" environment. --- style/fvextra.el | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/style/fvextra.el b/style/fvextra.el index 3bb11e811d..c74baf13d0 100644 --- a/style/fvextra.el +++ b/style/fvextra.el @@ -26,7 +26,7 @@ ;;; Commentary: -;; This file adds support for `fvextra.sty' (v1.4) from 2019/02/04. +;; This file adds support for `fvextra.sty' (v1.5) from 2022/11/30. ;; `fvextra.sty' is part of TeXLive. ;;; Code: @@ -75,7 +75,7 @@ ("tabcolor" ("none")) ;; 7.1 Line breaking options ("breakafter" ("none")) -("breakaftergroup" ("true" "false")) +("breakafterinrun" ("true" "false")) ("breakaftersymbolpre") ("breakaftersymbolpost") ("breakanywhere" ("true" "false")) @@ -83,12 +83,13 @@ ("breakanywheresymbolpost") ("breakautoindent" ("true" "false")) ("breakbefore") -("breakbeforegroup" ("true" "false")) +("breakbeforeinrun" ("true" "false")) ("breakbeforesymbolpre") ("breakbeforesymbolpost") ("breakindent") ("breakindentnchars") ("breaklines" ("true" "false")) +("breaknonspaceingroup" ("true" "false")) ("breaksymbol") ("breaksymbolleft") ("breaksymbolright") @@ -118,6 +119,7 @@ '("fvinlineset" (TeX-arg-key-val (LaTeX-fancyvrb-key-val-options))) ;; 4.2 Line and text formatting +"FancyVerbFormatInline" "FancyVerbFormatText" ;; 6 New commands and environments @@ -136,6 +138,16 @@ "FancyVerbBreakBeforeBreak" "FancyVerbBreakAfterBreak") + ;; 6.2 VerbEnv environment + (LaTeX-add-environments +'("VerbEnv" LaTeX-env-args + [TeX-arg-key-val (LaTeX-fancyvrb-key-val-options)])) + + ;; Filling + (add-to-list 'LaTeX-verbatim-environments-local "VerbEnv") + (add-to-list (make-local-variable 'LaTeX-indent-environment-list) +'("VerbEnv" current-indentation) t) + ;; Add \Verb*? and \EscVerb*? to ;; `LaTeX-verbatim-macros-with-braces-local': (let ((macs '("Verb" "Verb*"
[elpa] externals/auctex fb9c5645dc 49/76: * style/ltxtable.el ("ltxtable"): Replace `TeX-arg-eval'.
branch: externals/auctex commit fb9c5645dcd76b4136d42caa13917d2743735a31 Author: Arash Esbati Commit: Arash Esbati * style/ltxtable.el ("ltxtable"): Replace `TeX-arg-eval'. --- style/ltxtable.el | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/style/ltxtable.el b/style/ltxtable.el index 51b9b02550..3a0b97ea83 100644 --- a/style/ltxtable.el +++ b/style/ltxtable.el @@ -58,19 +58,18 @@ The regexp for the 2. argument is the same as for \"input\" and (TeX-run-style-hooks "tabularx" "longtable") (TeX-add-symbols -'("LTXtable" +`("LTXtable" (TeX-arg-length "Width" "1.0\\linewidth") - (TeX-arg-eval - (lambda () + ,(lambda (optional) (let ((longtable (file-relative-name (read-file-name -"File with longtable: " +(TeX-argument-prompt optional nil "File with longtable") nil nil nil nil (lambda (x) (or (file-directory-p x) (string-match "\\.\\(tex\\|ltx\\)\\'" x (TeX-master-directory - (format "%s" longtable)) + (TeX-argument-insert longtable optional) ;; Make sure that \LTXtable stays in its own line: (LaTeX-paragraph-commands-add-locally "LTXtable")
[elpa] externals/auctex e772b93525 53/76: * style/mdframed.el ("mdframed"): Replace `TeX-arg-eval'.
branch: externals/auctex commit e772b935252a3ffc461cb9db366612645b0e0f3a Author: Arash Esbati Commit: Arash Esbati * style/mdframed.el ("mdframed"): Replace `TeX-arg-eval'. --- style/mdframed.el | 40 ++-- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/style/mdframed.el b/style/mdframed.el index 53981d6207..b04f2f37a8 100644 --- a/style/mdframed.el +++ b/style/mdframed.el @@ -276,17 +276,16 @@ and prepends them to variable `LaTeX-mdframed-key-val-options'." '("mdfsetup" (TeX-arg-key-val (LaTeX-mdframed-key-val-options))) -'("newmdenv" +`("newmdenv" [TeX-arg-key-val (LaTeX-mdframed-key-val-options)] - (TeX-arg-eval - (lambda () + ,(lambda (optional) (let ((env (TeX-read-string - (TeX-argument-prompt nil nil "Environment" + (TeX-argument-prompt optional nil "Environment" (LaTeX-add-environments `(,env LaTeX-env-args [TeX-arg-key-val (LaTeX-mdframed-key-val-options)])) ;; Add new env's to `ispell-tex-skip-alist': skip the optional argument (TeX-ispell-skip-setcdr `((,env ispell-tex-arg-end 0))) - (format "%s" env) + (TeX-argument-insert env optional '("renewmdenv" [TeX-arg-key-val (LaTeX-mdframed-key-val-options)] @@ -306,13 +305,12 @@ and prepends them to variable `LaTeX-mdframed-key-val-options'." "Length")) ;; 5. Defining your own style -'("mdfdefinestyle" - (TeX-arg-eval - (lambda () +`("mdfdefinestyle" + ,(lambda (optional) (let ((style (TeX-read-string - (TeX-argument-prompt nil nil "Style name" + (TeX-argument-prompt optional nil "Style name" (LaTeX-add-mdframed-mdfdefinestyles style) - (format "%s" style + (TeX-argument-insert style optional))) (TeX-arg-key-val (LaTeX-mdframed-key-val-options))) '("mdfapptodefinestyle" @@ -325,15 +323,14 @@ and prepends them to variable `LaTeX-mdframed-key-val-options'." "Subtitle") ;; 8. Theorems -'("newmdtheoremenv" +`("newmdtheoremenv" [TeX-arg-key-val (LaTeX-mdframed-key-val-options)] - (TeX-arg-eval - (lambda () + ,(lambda (optional) (let ((nthm (TeX-read-string - (TeX-argument-prompt nil nil "Environment" + (TeX-argument-prompt optional nil "Environment" (LaTeX-add-environments (list nthm (vector "Heading"))) - (format "%s" nthm - [ TeX-arg-environment "Numbered like" ] + (TeX-argument-insert nthm optional))) + [TeX-arg-environment "Numbered like"] t [ (TeX-arg-eval progn (if (eq (save-excursion (backward-char 2) (preceding-char)) @@ -342,16 +339,15 @@ and prepends them to variable `LaTeX-mdframed-key-val-options'." (TeX-arg-counter t "Within counter")) "") ]) -'("mdtheorem" +`("mdtheorem" [TeX-arg-key-val (LaTeX-mdframed-key-val-options)] - (TeX-arg-eval - (lambda () + ,(lambda (optional) (let ((nthm (TeX-read-string - (TeX-argument-prompt nil nil "Environment" + (TeX-argument-prompt optional nil "Environment" (LaTeX-add-environments (list nthm (vector "Heading")) (list (concat nthm "*") (vector "Heading"))) - (format "%s" nthm - [ TeX-arg-environment "Numbered like" ] + (TeX-argument-insert nthm optional))) + [TeX-arg-environment "Numbered like"] t [ (TeX-arg-eval progn (if (eq (save-excursion (backward-char 2) (preceding-char))
[elpa] externals/auctex b2b899a450 66/76: ; * style/pstricks.el (LaTeX-package-parameter-value): Pacify compiler.
branch: externals/auctex commit b2b899a450a918322eb5449ede8bf385b44ec741 Author: Arash Esbati Commit: Arash Esbati ; * style/pstricks.el (LaTeX-package-parameter-value): Pacify compiler. --- style/pstricks.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/style/pstricks.el b/style/pstricks.el index 6a6707f38c..b5b93df663 100644 --- a/style/pstricks.el +++ b/style/pstricks.el @@ -136,6 +136,8 @@ available through package name PNAME and return \"param=value\"." ((string-match bregexp param) 'LaTeX-pst-boolean-list))) val compl) +;; See FIXME below: The next form is just to silence the compiler: +(setq compl nil) ;; ask for value (setq val (TeX-arg-compl-list (symbol-value parlist)
[elpa] externals/auctex d43bfae3fa 54/76: Overhaul beamer.el
branch: externals/auctex commit d43bfae3fa7aa016120da7a36ed46b83133e5ba4 Author: Ikumi Keita Commit: Ikumi Keita Overhaul beamer.el * style/beamer.el (LaTeX-beamer-after-insert-env): Use `member' instead of `TeX-member'. Add comment. (TeX-arg-beamer-overlay-spec): Simplify by feature implemented recently in `TeX-arg-string'. (TeX-arg-beamer-default-overlay-spec): New function. (TeX-arg-beamer-frametitle,TeX-arg-beamer-note): Delete. (LaTeX-item-beamer): Accept optional argument for bibitem. Simplify. (LaTeX-bibitem-beamer): New function to use `LaTeX-item-beamer'. (LaTeX-beamer-search-themes): Use `length' instead of `string-width'. Use `substring-no-properties' instead of `substring'. (LaTeX-beamer-themes-list,LaTeX-beamer-inner-themes-list) (LaTeX-beamer-outer-themes-list,LaTeX-beamer-color-themes-list) (LaTeX-beamer-font-themes-list): New functions to use with `TeX-arg-completing-read'. (LaTeX-arg-beamer-theme,LaTeX-arg-beamer-inner-theme) (LaTeX-arg-beamer-outer-theme,LaTeX-arg-beamer-color-theme) (LaTeX-arg-beamer-font-theme): Turn into the above new functions. (LaTeX-beamer-env-frame): Factor out former lambda form into an individual function and adapt for new usage in `LaTeX-add-environments'. (LaTeX-beamer-section): New function to insert section commands as well as asking for their optional arguments. ("beamer"): Update support of section commands with the above new function. Add and improve input support for many macros and environments. Add syntax highlight support. Update local value of `LaTeX-clean-intermediate-suffixes' so that "Clean" command cleans .vrb files. (LaTeX-beamer-class-options): Update class options for current beamer. * style/beamerarticle.el ("beamerarticle"): Allow (sub)paragraph commands. --- style/beamer.el| 702 + style/beamerarticle.el | 6 +- 2 files changed, 479 insertions(+), 229 deletions(-) diff --git a/style/beamer.el b/style/beamer.el index 589a26ad27..9a33b348c2 100644 --- a/style/beamer.el +++ b/style/beamer.el @@ -1,8 +1,9 @@ ;;; beamer.el --- AUCTeX style for the latex-beamer class -*- lexical-binding: t; -*- -;; Copyright (C) 2003-2021 Free Software Foundation, Inc. +;; Copyright (C) 2003-2022 Free Software Foundation, Inc. ;; Author: Thomas Baumann +;; Maintainer: auctex-de...@gnu.org ;; Created: 2003-12-20 ;; Keywords: tex @@ -41,7 +42,7 @@ "Do beamer-specific stuff after the insertion of an environment." ;; Add `fragile' as an optional argument to the frame environment if ;; a verbatim environment is inserted. - (when (and (TeX-member env (LaTeX-verbatim-environments) #'string-equal) + (when (and (member env (LaTeX-verbatim-environments)) (save-excursion (goto-char start) (string-equal (LaTeX-current-environment) "frame"))) @@ -49,6 +50,7 @@ (when (re-search-backward "begin[ \t]*{frame}" nil t) (let ((end-of-begin (match-end 0))) (goto-char end-of-begin) + ;; FIXME: Add support for skipping over overlay options. (while (forward-comment 1)) (if (eq (char-after) (string-to-char LaTeX-optop)) (progn @@ -70,16 +72,26 @@ (TeX-run-style-hooks "amsmath" "amssymb" "amsthm" "color" "geometry" "hyperref" "inputenc" "translator" "xcolor") - (unless LaTeX-beamer-section-labels-flag - (make-local-variable 'LaTeX-section-hook) - (setq LaTeX-section-hook - '(LaTeX-section-heading - LaTeX-section-title - LaTeX-section-section))) + (LaTeX-section-list-add-locally +'(("part" 0) + ("section" 1) + ("subsection" 2) + ("subsubsection" 3)) +t) + (LaTeX-largest-level-set "part") + (make-local-variable 'LaTeX-section-hook) + (setq LaTeX-section-hook + '(LaTeX-section-heading + LaTeX-section-title + LaTeX-beamer-section)) + (if LaTeX-beamer-section-labels-flag + (setq LaTeX-section-hook + (append LaTeX-section-hook '(LaTeX-section-label (setq LaTeX-item-list (append '(("itemize" . LaTeX-item-beamer) - ("enumerate" . LaTeX-item-beamer)) + ("enumerate" . LaTeX-item-beamer) + ("thebibliography" . LaTeX-bibitem-beamer)) LaTeX-item-list)) (setq LaTeX-default-document-environment "frame") @@ -87,96 +99,240 @@ (LaTeX-paragraph-commands-add-locally "frametitle") (TeX-add-symbols -'("alert" [ TeX-arg-beamer-overlay-spec ] 1) -'("alt" [ TeX-arg-beamer-overlay-spec ] 2) +'("AtBeginSection" ["Special star text"] t) +'("AtBeginSubsection" ["Special star text"] t) +'("AtBeginSubsubsection" ["Special star text"] t) +'("AtBeginPart" t) +'("AtBeginLecture" t) +
[elpa] externals/auctex 5b73efbfe3 51/76: ; * latex.el (LaTeX-what-macro): Assign values in one go.
branch: externals/auctex commit 5b73efbfe39d2a301d7581082f0b194a26b797e6 Author: Arash Esbati Commit: Arash Esbati ; * latex.el (LaTeX-what-macro): Assign values in one go. --- latex.el | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/latex.el b/latex.el index 04caaf539a..29ac950252 100644 --- a/latex.el +++ b/latex.el @@ -7385,10 +7385,13 @@ this point. If nil, limit to the previous 15 lines." (error nil)) ;; Set the initial value of argument counter (setq cnt 1) - ;; Note that we count also the right opt. or man. arg: - (setq cnt-opt (if (= (following-char) ?\{) 0 1)) - ;; Record if we're inside a mand. or opt. argument - (setq type (if (= (following-char) ?\{) 'mandatory 'optional)) + ;; Note that we count also the right opt. or man. arg and + ;; record if we're inside a mand. or opt. argument + (if (= (following-char) ?\{) + (setq cnt-opt 0 +type 'mandatory) +(setq cnt-opt 1 + type 'optional)) ;; Move back over any touching sexps (while (and (LaTeX-move-to-previous-arg bound) (condition-case nil
[elpa] externals/auctex 288665587a 57/76: Use `symbol-value' instead of `eval'
branch: externals/auctex commit 288665587a4fcb6b7fc356e86a86ee9670186232 Author: Ikumi Keita Commit: Ikumi Keita Use `symbol-value' instead of `eval' * multi-prompt.el (multi-prompt-expand-completion-table): Use `symbol-value' explicitly instead of `eval' to obtain the value of variable. --- multi-prompt.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multi-prompt.el b/multi-prompt.el index 06f28ca544..5ce11d5135 100644 --- a/multi-prompt.el +++ b/multi-prompt.el @@ -171,7 +171,7 @@ This is achieved by eval'ing all variables in the value parts of the alist elements." (mapcar (lambda (x) (if (and (cadr x) (symbolp (cadr x)) (not (functionp (cadr x -(cons (car x) (list (eval (cadr x) t))) +(cons (car x) (list (symbol-value (cadr x x)) table))
[elpa] externals/auctex 287da56401 30/76: Revert "Bind a value to `LaTeX-current-environment' locally"
branch: externals/auctex commit 287da56401c7e8d465cc60844756162d49c6bb22 Author: Arash Esbati Commit: Arash Esbati Revert "Bind a value to `LaTeX-current-environment' locally" This reverts commit e4ceb88bb7cb4f406874de196aa71118449fe373. This change had negative side effects for indentation. See https://lists.gnu.org/archive/html/auctex-devel/2022-11/msg00057.html --- latex.el | 27 --- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/latex.el b/latex.el index 6303c3371f..69924b2152 100644 --- a/latex.el +++ b/latex.el @@ -572,11 +572,11 @@ Styles such as tabularx may set it according to their needs.") (defvar LaTeX-environment-history nil) -(defvar LaTeX-current-environment nil - "Cache holding the name of current enviroment for repeated tasks. -Example for a repeated task is indenting each line in a paragraph -to be filled. Therefore, this variable is meant to be let-bound -in a function and nil globally.") +;; Variable used to cache the current environment, e.g. for repeated +;; tasks in an environment, like indenting each line in a paragraph to +;; be filled. It must not have a non-nil value in general. That +;; means it is usually let-bound for such operations. +(defvar LaTeX-current-environment nil) (defun LaTeX-environment (arg) "Make LaTeX environment (\\begin{...}-\\end{...} pair). @@ -1114,10 +1114,9 @@ The first item is inserted by the function `LaTeX--env-item'." (defun LaTeX-env-item-args (environment &rest args) "Insert ENVIRONMENT followed by ARGS and first item. The first item is inserted by the function `LaTeX--env-item'." - (let ((LaTeX-current-environment environment)) -(LaTeX-insert-environment environment) -(LaTeX--env-parse-args args) -(LaTeX--env-item environment))) + (LaTeX-insert-environment environment) + (LaTeX--env-parse-args args) + (LaTeX--env-item environment)) (defcustom LaTeX-label-alist '(("figure" . LaTeX-figure-label) @@ -1329,9 +1328,8 @@ Just like array and tabular." (defun LaTeX-env-label-args (environment &rest args) "Run `LaTeX-env-label' on ENVIRONMENT and insert ARGS." - (let ((LaTeX-current-environment environment)) -(LaTeX-env-label environment) -(LaTeX--env-parse-args args))) + (LaTeX-env-label environment) + (LaTeX--env-parse-args args)) (defun LaTeX-env-list (environment) "Insert ENVIRONMENT and the first item." @@ -1458,9 +1456,8 @@ Just like array and tabular." (defun LaTeX-env-args (environment &rest args) "Insert ENVIRONMENT and arguments defined by ARGS." - (let ((LaTeX-current-environment environment)) -(LaTeX-insert-environment environment) -(LaTeX--env-parse-args args))) + (LaTeX-insert-environment environment) + (LaTeX--env-parse-args args)) (defun LaTeX-env-label-as-keyval (_optional &optional keyword keyvals environment) "Query for a label and insert it in the optional argument of an environment.
[elpa] externals/auctex 68e14e7ce4 45/76: * style/ltablex.el ("ltablex"): Add fontification support.
branch: externals/auctex commit 68e14e7ce4d3041273e3242d89059c3ee9a535cc Author: Arash Esbati Commit: Arash Esbati * style/ltablex.el ("ltablex"): Add fontification support. --- style/ltablex.el | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/style/ltablex.el b/style/ltablex.el index 1a6c0148bc..828abfce10 100644 --- a/style/ltablex.el +++ b/style/ltablex.el @@ -1,6 +1,6 @@ ;;; ltablex.el --- AUCTeX style for `ltablex.sty' (v1.1) -*- lexical-binding: t; -*- -;; Copyright (C) 2015, 2020 Free Software Foundation, Inc. +;; Copyright (C) 2015--2022 Free Software Foundation, Inc. ;; Author: Arash Esbati ;; Maintainer: auctex-de...@gnu.org @@ -34,6 +34,11 @@ ;;; Code: +;; Silence the compiler: +(declare-function font-latex-add-keywords + "font-latex" + (keywords class)) + (require 'tex) (TeX-add-style-hook @@ -42,7 +47,14 @@ (TeX-run-style-hooks "tabularx" "longtable") (TeX-add-symbols '("keepXColumns" 0) -'("convertXColumns" 0))) +'("convertXColumns" 0)) + + ;; Fontification + (when (and (featurep 'font-latex) + (eq TeX-install-font-lock 'font-latex-setup)) + (font-latex-add-keywords '(("keepXColumns""") +("convertXColumns" "")) + 'function))) TeX-dialect) (defvar LaTeX-ltablex-package-options nil
[elpa] externals/auctex f84b1a5fdb 43/76: Simplify implementation of style/ifthen.el
branch: externals/auctex commit f84b1a5fdbb9cccebf3f6831973ea29d6725ef2c Author: Arash Esbati Commit: Arash Esbati Simplify implementation of style/ifthen.el * style/ifthen.el (LaTeX-ifthen-test): New variable. (LaTeX-arg-ifthen-test): Delete and move the functionality into the hook. --- style/ifthen.el | 28 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/style/ifthen.el b/style/ifthen.el index 6610f88e82..0650975e43 100644 --- a/style/ifthen.el +++ b/style/ifthen.el @@ -31,33 +31,29 @@ ;;; Code: (require 'tex) +(require 'latex) ;; Silence the compiler: (declare-function font-latex-add-keywords "font-latex" (keywords class)) -(defun LaTeX-arg-ifthen-test (optional &optional prompt) - "Query and insert skeleton for a test in ifthen macros." - (TeX-argument-insert - (completing-read -(TeX-argument-prompt optional prompt "Test") -'("<" "=" ">" - "\\isodd{}" - "\\isundefined{}" - "\\equal{}{}" - "\\lengthtest{<}" - "\\lengthtest{=}" - "\\lengthtest{>}" - "\\boolean{}")) - optional)) +(defvar LaTeX-ifthen-test '("<" "=" ">" +"\\isodd{}" +"\\isundefined{}" +"\\equal{}{}" +"\\lengthtest{<}" +"\\lengthtest{=}" +"\\lengthtest{>}" +"\\boolean{}") + "List of tests in ifthen macros.") (TeX-add-style-hook "ifthen" (lambda () (TeX-add-symbols -'("ifthenelse" LaTeX-arg-ifthen-test t nil) -'("whiledo"LaTeX-arg-ifthen-test t) +'("ifthenelse" (TeX-arg-completing-read LaTeX-ifthen-test "Test") t nil) +'("whiledo"(TeX-arg-completing-read LaTeX-ifthen-test "Test") t) "AND" "OR" "NOT"
[elpa] externals/auctex 7c15b32d06 47/76: Simplify implementation of style/ltugboat.el
branch: externals/auctex commit 7c15b32d06b28dd0ddceb77a02fe71a0a666e9c0 Author: Arash Esbati Commit: Arash Esbati Simplify implementation of style/ltugboat.el * style/ltugboat.el (LaTeX-env-ltugboat-verbatim): Remove function and move the functionality into the hook. --- style/ltugboat.el | 26 -- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/style/ltugboat.el b/style/ltugboat.el index 92811ddec7..67d58e6378 100644 --- a/style/ltugboat.el +++ b/style/ltugboat.el @@ -40,23 +40,6 @@ "font-latex" (keywords class)) -(defun LaTeX-env-ltugboat-verbatim (environment) - "Insert verbatim environment with an optional argument." - (let* ((crm-separator (regexp-quote TeX-esc)) - (opts (mapconcat #'identity - (TeX-completing-read-multiple - (TeX-argument-prompt t nil "command(s)") - '("\\tiny" "\\scriptsize" "\\footnotesize" - "\\small" "\\normalsize" "\\large" - "\\Large" "\\LARGE" "\\huge" - "\\Huge" "\\makevmeta" "\\ruled") - nil nil TeX-esc) - TeX-esc))) -(LaTeX-insert-environment environment - (when (and opts - (not (string= opts ""))) -(concat LaTeX-optop opts LaTeX-optcl) - (TeX-add-style-hook "ltugboat" (lambda () @@ -106,7 +89,14 @@ ;; 8 Verbatim text (LaTeX-add-environments -'("verbatim" LaTeX-env-ltugboat-verbatim)) +`("verbatim" LaTeX-env-args + [TeX-arg-completing-read-multiple ("tiny" "scriptsize" "footnotesize" + "small" "normalsize" "large" + "Large" "LARGE" "huge" + "Huge" "makevmeta" "ruled") +"Command(s)" nil nil +,(regexp-quote TeX-esc) +,TeX-esc nil nil nil nil ,TeX-esc])) ;; 10.1 Acronyms and logos (TeX-add-symbols
[elpa] externals/auctex 13c77f998e 28/76: Simplify implementation of style/empheq.el
branch: externals/auctex commit 13c77f998ee45193257bc0f62ba784bad51e3e28 Author: Arash Esbati Commit: Arash Esbati Simplify implementation of style/empheq.el * style/empheq.el (LaTeX-empheq-env): Reduce functionality in the function which now adds a number of columns to 'alignat*?' environments and adds a label where applicable. (LaTeX-empheq-env-overload): Delete function and move the functionality into the hook. (LaTeX-empheq-item-equation): Use the environment name "empheq" instead of a call of `LaTeX-current-environment'. Other minor improvements. ("empheq"): Use standard functions inside the hook. Replace `TeX-arg-eval'. --- style/empheq.el | 208 1 file changed, 103 insertions(+), 105 deletions(-) diff --git a/style/empheq.el b/style/empheq.el index b9f32b160b..39c3f00e38 100644 --- a/style/empheq.el +++ b/style/empheq.el @@ -1,6 +1,6 @@ ;;; empheq.el --- AUCTeX style for `empheq.sty' (v2.14) -*- lexical-binding: t; -*- -;; Copyright (C) 2016-2021 Free Software Foundation, Inc. +;; Copyright (C) 2016-2022 Free Software Foundation, Inc. ;; Author: Arash Esbati ;; Maintainer: auctex-de...@gnu.org @@ -162,69 +162,31 @@ delimiters and prepends them to variable ("right" ,rvals LaTeX-empheq-key-val-options)) -(defun LaTeX-empheq-env (env) - "Query for a supported amsmath environment and insert it accordingly. -ENV is the name of environment passed to the function in the style hook." - (let* ((keyvals (TeX-read-key-val t (LaTeX-empheq-key-val-options))) - (amsenv (completing-read - (TeX-argument-prompt nil nil "amsmath environment") - LaTeX-empheq-supported-amsmath-envs)) - (ncols (when (or (string= amsenv "alignat") - (string= amsenv "alignat*")) - (TeX-read-string - (TeX-argument-prompt nil nil "Number of columns" - num) -(LaTeX-insert-environment - env - (concat - (when (and keyvals (not (string= keyvals ""))) -(concat LaTeX-optop keyvals LaTeX-optcl)) - TeX-grop - (if (and ncols (not (string= ncols ""))) - (concat amsenv "=" ncols) -amsenv) - TeX-grcl)) -(when (and (assoc amsenv LaTeX-label-alist) - (LaTeX-label amsenv 'environment)) - (LaTeX-newline) - (indent-according-to-mode)) -(when (and ncols (not (string= ncols ""))) - (setq num (string-to-number ncols)) +(defun LaTeX-empheq-env (optional) + "Insert a label inside empheq environment. +In addition, query for a column number for the alignat*? +environments and insert suitable number of ampersands. If +OPTIONAL is non-nil, indicate it in the prompt." + (save-excursion +(TeX-looking-at-backward (concat TeX-grop "\\([^" TeX-grcl "]+\\)" TeX-grcl) + 20)) + (let* ((amsenv (match-string-no-properties 1)) + ncols) +(when (string-match-p "\\`alignat" amsenv) + (setq ncols (read-number + (TeX-argument-prompt optional nil "Number of columns"))) (save-excursion -(insert (make-string (+ num num -1) ?&)) - -(defun LaTeX-empheq-env-overload (env &optional _ignore) - "Insert amsmath ENV's when option overload is given to empheq package. -This function combines the capabilities of `LaTeX-env-label' and -`LaTeX-amsmath-env-alignat'. It overwrites the definitions of -`amsmath.el'." - (if (or (string= env "alignat") - (string= env "alignat*")) - (let ((ncols (TeX-read-string -(TeX-argument-prompt nil nil "Number of columns"))) -(keyvals (TeX-read-key-val t - (LaTeX-empheq-key-val-options) - "empheq options (k=v)"))) -(LaTeX-insert-environment env - (concat TeX-grop ncols TeX-grcl - (when (and keyvals - (not (string= keyvals ""))) -(concat LaTeX-optop -keyvals -LaTeX-optcl -(LaTeX-item-equation-alignat t)) -(let ((keyvals - (TeX-read-key-val t - (LaTeX-empheq-key-val-options) - "empheq options (k=v)"))) - (LaTeX-insert-environment env -(when (and keyvals - (not (string= keyvals ""))) - (concat LaTeX-optop - keyvals - LaTeX-optcl))) - (when (and (assoc env LaTeX-label-alist) - (LaTeX-label env 'environment)) +(goto-char (match-
[elpa] externals/auctex a648993763 22/76: * style/comment.el ("comment"): Replace `TeX-arg-eval'.
branch: externals/auctex commit a648993763fbc2f0f096eee0752f9c9552440527 Author: Arash Esbati Commit: Arash Esbati * style/comment.el ("comment"): Replace `TeX-arg-eval'. --- style/comment.el | 43 +++ 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/style/comment.el b/style/comment.el index 11a14192df..b9edd1c996 100644 --- a/style/comment.el +++ b/style/comment.el @@ -112,26 +112,29 @@ ;; New symbols (TeX-add-symbols -'("includecomment" - (TeX-arg-eval let ((env (TeX-read-string - (TeX-argument-prompt nil nil "Name" -(LaTeX-add-comment-incl-excls `(,env "include")) -(LaTeX-comment-auto-cleanup) -(format "%s" env))) - -'("excludecomment" - (TeX-arg-eval let ((env (TeX-read-string - (TeX-argument-prompt nil nil "Name" -(LaTeX-add-comment-incl-excls `(,env "exclude")) -(LaTeX-comment-auto-cleanup) -(format "%s" env))) - -'("specialcomment" - (TeX-arg-eval let ((env (TeX-read-string - (TeX-argument-prompt nil nil "Name" -(LaTeX-add-comment-incl-excls `(,env "special")) -(LaTeX-comment-auto-cleanup) -(format "%s" env)) +`("includecomment" + ,(lambda (optional) + (let ((env (TeX-read-string + (TeX-argument-prompt optional nil "Name" + (LaTeX-add-comment-incl-excls `(,env "include")) + (LaTeX-comment-auto-cleanup) + (TeX-argument-insert env optional + +`("excludecomment" + ,(lambda (optional) + (let ((env (TeX-read-string + (TeX-argument-prompt optional nil "Name" + (LaTeX-add-comment-incl-excls `(,env "exclude")) + (LaTeX-comment-auto-cleanup) + (TeX-argument-insert env optional + +`("specialcomment" + ,(lambda (optional) + (let ((env (TeX-read-string + (TeX-argument-prompt optional nil "Name" + (LaTeX-add-comment-incl-excls `(,env "special")) + (LaTeX-comment-auto-cleanup) + (TeX-argument-insert env optional))) "Before commands" "After commands") '("processcomment" "Name" "Each-line commands"
[elpa] externals/auctex d937d4035c 16/76: Simplify implementation of style/changelog.el
branch: externals/auctex commit d937d4035cc8754cc95a379cfba59cf88fd951f6 Author: Arash Esbati Commit: Arash Esbati Simplify implementation of style/changelog.el * style/changelog.el (LaTeX-changelog-key-val-options): New function returning key=vals. The functionality used to be part of `LaTeX-env-changelog'. (LaTeX-env-changelog): Adjust in order to insert a label into optional argument. ("changelog"): Adjust function usage in the hook accordingly. --- style/changelog.el | 97 -- 1 file changed, 51 insertions(+), 46 deletions(-) diff --git a/style/changelog.el b/style/changelog.el index a4ebb43cfa..227caa3c81 100644 --- a/style/changelog.el +++ b/style/changelog.el @@ -1,6 +1,6 @@ ;;; changelog.el --- AUCTeX style for `changelog.sty' (v2.0.0) -*- lexical-binding: t; -*- -;; Copyright (C) 2019, 2020 Free Software Foundation, Inc. +;; Copyright (C) 2019--2022 Free Software Foundation, Inc. ;; Author: Arash Esbati ;; Maintainer: auctex-de...@gnu.org @@ -57,67 +57,72 @@ The keys sectioncmd and label are added in the function ("short" ("true" "false"))) "key=value options for version environment.") -(defun LaTeX-env-changelog (environment) - "Insert ENVIRONMENT, ask for optional argument and insert a label." - (let* ((seccmds (mapcar #'car LaTeX-section-list)) - ;; Collect the key=vals acc. to environment & documentclass - (opts (TeX-read-key-val -t -(if (string= environment "changelog") -(append - `(("sectioncmd" -,(if (< (LaTeX-largest-level) 2) - (append - (mapcar (lambda (cmd) (concat TeX-esc cmd)) - seccmds) - (mapcar (lambda (cmd) (concat TeX-esc cmd "*")) - seccmds)) - (append -(mapcar (lambda (cmd) (concat TeX-esc cmd)) -(remove "chapter" seccmds)) -(mapcar (lambda (cmd) (concat TeX-esc cmd "*")) -(remove "chapter" seccmds)) - LaTeX-changelog-env-key-val-options - LaTeX-changelog-version-env-key-val-options) - LaTeX-changelog-version-env-key-val-options))) +(defun LaTeX-changelog-key-val-options () + "Return an updated list of key=vals from changelog package." + (let ((currenv (or LaTeX-current-environment + (LaTeX-current-environment))) +(seccmds (mapcar #'car LaTeX-section-list))) +(if (string= currenv "changelog") +(append + `(("sectioncmd" +,(if (< (LaTeX-largest-level) 2) + (append (mapcar (lambda (cmd) (concat TeX-esc cmd)) + seccmds) + (mapcar (lambda (cmd) (concat TeX-esc cmd "*")) + seccmds)) + (append (mapcar (lambda (cmd) (concat TeX-esc cmd)) + (remove "chapter" seccmds)) + (mapcar (lambda (cmd) (concat TeX-esc cmd "*")) + (remove "chapter" seccmds)) + LaTeX-changelog-env-key-val-options + LaTeX-changelog-version-env-key-val-options) + LaTeX-changelog-version-env-key-val-options))) + +(defun LaTeX-env-changelog (_optional) + "Insert a label into the optional argument of changelog environment. +OPTIONAL is ignored." + (let* ((s (save-excursion + (LaTeX-find-matching-begin) + (point))) + (currenv LaTeX-current-environment) ;; Extract the chosen sectioning command - (sec (progn -(string-match "sectioncmd=\\([a-z]+\\)\\(\\*?\\)" opts) -(match-string-no-properties 1 opts))) + (sec (save-excursion +(re-search-backward + (concat "sectioncmd=\\([a-z]+\\)\\(\\*?\\)" + "\\|" + "\\<\\(section\\)\\(?:=true\\)?") + s t) +(or (match-string-no-properties 1) +(match-string-no-properties 3 ;; Temp. re-bind `LaTeX-label-alist' and pick the label ;; prefix from `LaTeX-section-label' (LaTeX-label-alist - (when (and (string= environment "changelog") - (match-string 2 opts) - (not (string= (match-string 2 opts) "*"))) -`(,(cons environment + (when (or (and (match-string 2) + (not (string= (match-string 2) "*"))) +(match-string 3)) +`(,(cons currenv (cdr (assoc sec LaTeX-section-label)) ;; Temp. re-bind `reftex-label-alis
[elpa] externals/auctex 5b693f4e2e 42/76: ; * style/hyperref.el ("hyperref"): Don't use list inside vector.
branch: externals/auctex commit 5b693f4e2e8b8c1f81f95ae80e6047516a530b1c Author: Arash Esbati Commit: Arash Esbati ; * style/hyperref.el ("hyperref"): Don't use list inside vector. --- style/hyperref.el | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/style/hyperref.el b/style/hyperref.el index c225359be1..7c123a9100 100644 --- a/style/hyperref.el +++ b/style/hyperref.el @@ -226,7 +226,7 @@ (TeX-add-symbols '("hypersetup" (TeX-arg-key-val LaTeX-hyperref-package-options-list)) -'("href" [ (TeX-arg-key-val LaTeX-hyperref-href-options) ] "URL" "Text") +'("href" [TeX-arg-key-val LaTeX-hyperref-href-options] "URL" "Text") ;; Completion for \url is provided via url.el. Hence the entry in ;; this style is commented: ;; '("url" "URL" ignore) @@ -236,8 +236,8 @@ '("hyperdef" "Category" "Name" "Text") '("hyperref" (TeX-arg-conditional (y-or-n-p "Insert a label and text? ") - ([TeX-arg-ref] "Text") - ("URL" "Category" "Name" "Text"))) + ([TeX-arg-ref] "Text") +("URL" "Category" "Name" "Text"))) '("hyperlink" "Name" "Text") '("hypertarget" "Name" "Text") '("phantomsection" 0) @@ -258,12 +258,12 @@ ;; The next 6 macros take Key-vals defined in ;; "LaTeX-hyperref-forms-options". For an example, see ;; https://github.com/latex3/hyperref/blob/main/test/testform.tex -'("TextField" [ (TeX-arg-key-val LaTeX-hyperref-forms-options) ] "Label") -'("CheckBox" [ (TeX-arg-key-val LaTeX-hyperref-forms-options) ] "Label") -'("ChoiceMenu" [ (TeX-arg-key-val LaTeX-hyperref-forms-options) ] "Label" "Choices") -'("PushButton" [ (TeX-arg-key-val LaTeX-hyperref-forms-options) ] "Label") -'("Submit" [ (TeX-arg-key-val LaTeX-hyperref-forms-options) ] "Label") -'("Reset" [ (TeX-arg-key-val LaTeX-hyperref-forms-options) ] "Label") +'("TextField" [TeX-arg-key-val LaTeX-hyperref-forms-options] "Label") +'("CheckBox" [TeX-arg-key-val LaTeX-hyperref-forms-options] "Label") +'("ChoiceMenu" [TeX-arg-key-val LaTeX-hyperref-forms-options] "Label" "Choices") +'("PushButton" [TeX-arg-key-val LaTeX-hyperref-forms-options] "Label") +'("Submit" [TeX-arg-key-val LaTeX-hyperref-forms-options] "Label") +'("Reset" [TeX-arg-key-val LaTeX-hyperref-forms-options] "Label") '("LayoutTextField" "Label" "Field") '("LayoutChoiceField" "Label" "Field") '("LayoutCheckField" "Label" "Field")
[elpa] externals/auctex 22fa670915 55/76: ; Fix doc strings
branch: externals/auctex commit 22fa670915fb1fb6a08b60c7bb5acfb79684dd55 Author: Ikumi Keita Commit: Ikumi Keita ; Fix doc strings * tex.el (TeX-command-list): Quote Lisp symbols. (TeX-insert-braces): Fix a typo. * latex.el (LaTeX--completion-annotation-from-math-menu) (LaTeX-completion-parse-args): Rewrite "e.g." and "i.e." in doc strings, following `(elisp) Documentation Tips'. --- latex.el | 6 +++--- tex.el | 30 +++--- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/latex.el b/latex.el index 29ac950252..0a49fccdfc 100644 --- a/latex.el +++ b/latex.el @@ -6304,8 +6304,8 @@ See also `LaTeX-math-menu'." (defun LaTeX--completion-annotation-from-math-menu (sym) "Return a completion annotation for a SYM. The annotation is usually a unicode representation of the macro -SYM's compiled representation, e.g., if SYM is alpha, α is -returned." +SYM's compiled representation, for example, if SYM is alpha, α +is returned." (catch 'found (dolist (var (list LaTeX-math-list LaTeX-math-default)) (dolist (e var) @@ -7535,7 +7535,7 @@ COLLECTION is an list of strings." (defun LaTeX-completion-parse-args (entry) "Return the match of buffer position ENTRY with AUCTeX macro definitions. ENTRY is generated by the function `LaTeX-what-macro'. This -function matches the current buffer position (i.e., which macro +function matches the current buffer position (that is, which macro argument) with the corresponding definition in `TeX-symbol-list' or `LaTeX-environment-list' and returns it." (let* ((name (nth 0 entry)) diff --git a/tex.el b/tex.el index f7b822f5f2..9671d5f30e 100644 --- a/tex.el +++ b/tex.el @@ -270,41 +270,41 @@ expanded. The expansion is done using the information found in The third element is the function which actually start the process. Several such hooks have been defined: -TeX-run-command: Start up the process and show the output in a +`TeX-run-command': Start up the process and show the output in a separate buffer. Check that there is not two commands running for the same file. Return the process object. -TeX-run-format: As `TeX-run-command', but assume the output is created +`TeX-run-format': As `TeX-run-command', but assume the output is created by a TeX macro package. Return the process object. -TeX-run-TeX: For TeX output. +`TeX-run-TeX': For TeX output. -TeX-run-interactive: Run TeX or LaTeX interactively. +`TeX-run-interactive': Run TeX or LaTeX interactively. -TeX-run-BibTeX: For BibTeX output. +`TeX-run-BibTeX': For BibTeX output. -TeX-run-Biber: For Biber output. +`TeX-run-Biber': For Biber output. -TeX-run-compile: Use `compile' to run the process. +`TeX-run-compile': Use `compile' to run the process. -TeX-run-shell: Use `shell-command' to run the process. +`TeX-run-shell': Use `shell-command' to run the process. -TeX-run-discard: Start the process in the background, discarding its +`TeX-run-discard': Start the process in the background, discarding its output. -TeX-run-background: Start the process in the background, show output +`TeX-run-background': Start the process in the background, show output in other window. -TeX-run-silent: Start the process in the background. +`TeX-run-silent': Start the process in the background. -TeX-run-discard-foreground: Start the process in the foreground, +`TeX-run-discard-foreground': Start the process in the foreground, discarding its output. -TeX-run-function: Execute the Lisp function or function call +`TeX-run-function': Execute the Lisp function or function call specified by the string in the second element. Consequently, this hook does not start a process. -TeX-run-discard-or-function: If the command is a Lisp function, +`TeX-run-discard-or-function': If the command is a Lisp function, execute it as such, otherwise start the command as a process, discarding its output. @@ -3260,7 +3260,7 @@ See `completion-at-point-functions'." (make-variable-buffer-local 'TeX-default-macro) (defcustom TeX-insert-braces t - "If non-nil, append a empty pair of braces after inserting a macro. + "If non-nil, append an empty pair of braces after inserting a macro. See also `TeX-insert-braces-alist'." :group 'TeX-macro
[elpa] externals/auctex 5c67eb2dfd 07/76: Simplify implementation of style/babel.el
branch: externals/auctex commit 5c67eb2dfdf7d383f67c1b318c72f508319e307c Author: Arash Esbati Commit: Arash Esbati Simplify implementation of style/babel.el * style/babel.el (TeX-arg-babel-lang, LaTeX-env-babel-lang): Delete functions. ("babel"): Replace functionality of deleted functions with standard ones. For "babelfont", move code inside the query for "Font family" into a closure at the end of the entry and drop `TeX-arg-eval'. --- style/babel.el | 115 +++-- 1 file changed, 63 insertions(+), 52 deletions(-) diff --git a/style/babel.el b/style/babel.el index c58ea9fab6..70cc56585d 100644 --- a/style/babel.el +++ b/style/babel.el @@ -40,6 +40,9 @@ (declare-function font-latex-add-keywords "font-latex" (keywords class)) +(declare-function LaTeX-fontspec-auto-cleanup + "fontspec" + ()) (defvar LaTeX-babel-language-list '("afrikaans" @@ -202,10 +205,9 @@ (let ((fam (concat elt "family")) (def (concat elt "default")) (mac (concat "text" elt))) - (apply #'TeX-add-symbols - `((,fam -1) - (,def -1) - (,mac t))) + (apply #'TeX-add-symbols `((,fam -1) + (,def -1) + (,mac t))) ;; Cater for fontification: (when (and (featurep 'font-latex) (eq TeX-install-font-lock 'font-latex-setup)) @@ -229,20 +231,6 @@ (add-hook 'TeX-auto-cleanup-hook #'LaTeX-babel-auto-cleanup t) (add-hook 'TeX-update-style-hook #'TeX-auto-parse t) -(defun TeX-arg-babel-lang (optional &optional prompt) - "Prompt for a language with completion and insert it as an argument." - (TeX-argument-insert - (completing-read -(TeX-argument-prompt optional prompt "Language") -(LaTeX-babel-active-languages)) - optional)) - -(defun LaTeX-env-babel-lang (env) - "Prompt for a language and insert it as an argument of ENV." - (LaTeX-insert-environment - env (format "{%s}" (completing-read "Language: " - (LaTeX-babel-active-languages) - (defun LaTeX-babel-load-languages () "Load style files of babel active languages." ;; Run style hooks for every active language in loading order, so @@ -263,22 +251,29 @@ (TeX-add-symbols ;; 1.7 Basic language selectors -'("selectlanguage" TeX-arg-babel-lang) -'("foreignlanguage" TeX-arg-babel-lang t) +'("selectlanguage" + (TeX-arg-completing-read (LaTeX-babel-active-languages) + "Language")) +'("foreignlanguage" + (TeX-arg-completing-read (LaTeX-babel-active-languages) + "Language") + t) ;; 1.9 More on selection '("babeltags" t) -'("babelensure" (TeX-arg-key-val - (("include") ("exclude") - ("fontenc" (;; 128+ glyph encodings (text) - "OT1" "OT2" "OT3" "OT4" "OT6" - ;; 256 glyph encodings (text) - "T1" "T2A" "T2B" "T2C" "T3" "T4" "T5" - ;; 256 glyph encodings (text extended) - "X2" - ;; Other encodings - "LY1" "LV1" "LGR" - TeX-arg-babel-lang) +'("babelensure" + (TeX-arg-key-val + (("include") ("exclude") +("fontenc" (;; 128+ glyph encodings (text) +"OT1" "OT2" "OT3" "OT4" "OT6" +;; 256 glyph encodings (text) +"T1" "T2A" "T2B" "T2C" "T3" "T4" "T5" +;; 256 glyph encodings (text extended) +"X2" +;; Other encodings +"LY1" "LV1" "LGR" + (TeX-arg-completing-read (LaTeX-babel-active-languages) + "Language")) ;; 1.10 Shorthands '("shorthandon""Shorthands list") '("shorthandoff" "Shorthands list") @@ -289,7 +284,9 @@ [TeX-arg-completing-read-multiple (LaTeX-babel-active-languages) "Language(s)"] t nil) -'("languageshorthands" TeX-arg-babel-lang) +'("languageshorthands" + (TeX-arg-completing-read (LaTeX-babel-active-languages) + "Language")) '("babelshorthand" "Short hand") '("ifbabelshorthand" "Character" t nil) '("aliasshorthand" "Original" "Alias") @@ -300,24 +297,26 @@ t) ;; 1.14 Selecting fonts -'("babelfont" +`("babelfont" [TeX-arg-completing-read-multiple LaTeX-babel-language-list "Language(s)"] - (TeX-arg-eval let ((fontfam (completing-read -
[elpa] externals/auctex 906e57dfb8 68/76: ; * style/physics.el: Write proper date.
branch: externals/auctex commit 906e57dfb87d0a297164364f0c771151a86d8f9c Author: Ikumi Keita Commit: Ikumi Keita ; * style/physics.el: Write proper date. --- style/physics.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/style/physics.el b/style/physics.el index 8676a696a2..f805df1b75 100644 --- a/style/physics.el +++ b/style/physics.el @@ -4,7 +4,7 @@ ;; Author: Ikumi Keita ;; Maintainer: auctex-de...@gnu.org -;; Created: 2022-12-xx +;; Created: 2022-12-20 ;; Keywords: tex ;; This file is part of AUCTeX.
[elpa] externals/auctex ac7ad4fff4 36/76: Simplify implementation of style/footmisc.el
branch: externals/auctex commit ac7ad4fff4800ae1397235d3559bb48609890abc Author: Arash Esbati Commit: Arash Esbati Simplify implementation of style/footmisc.el * style/footmisc.el (LaTeX-footmisc-fnsymbols-set): New variable. ("footmisc"): Use it in the hook. Remove support for the \footref macro which is now part of LaTeX kernel. --- style/footmisc.el | 30 ++ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/style/footmisc.el b/style/footmisc.el index 2fb0385f9f..02dd833da2 100644 --- a/style/footmisc.el +++ b/style/footmisc.el @@ -37,6 +37,10 @@ "font-latex" (keywords class)) +(defvar LaTeX-footmisc-fnsymbols-set '("bringhurst" "chicago" "wiley" + "lamport" "lamport*") + "Sets of footnote symbols provided by the footmisc package.") + (TeX-add-style-hook "footmisc" (lambda () @@ -47,34 +51,24 @@ ;; 1.7 The \setfnsymbol and \DefineFNsymbols commands '("DefineFNsymbols" - (TeX-arg-completing-read ("bringhurst" "chicago" "wiley" -"lamport" "lamport*") - "Name") + (TeX-arg-completing-read LaTeX-footmisc-fnsymbols-set "Name") [TeX-arg-completing-read ("text" "math") "Style"] 1) '("DefineFNsymbols*" - (TeX-arg-completing-read ("bringhurst" "chicago" "wiley" -"lamport" "lamport*") - "Name") + (TeX-arg-completing-read LaTeX-footmisc-fnsymbols-set "Name") [TeX-arg-completing-read ("text" "math") "Style"] 1) ;; These two commands define both text and math variants of the ;; footnote symbols '("DefineFNsymbolsTM" - (TeX-arg-completing-read ("bringhurst" "chicago" "wiley" -"lamport" "lamport*") - "Name") + (TeX-arg-completing-read LaTeX-footmisc-fnsymbols-set "Name") 1) '("DefineFNsymbolsTM*" - (TeX-arg-completing-read ("bringhurst" "chicago" "wiley" -"lamport" "lamport*") - "Name") + (TeX-arg-completing-read LaTeX-footmisc-fnsymbols-set "Name") 1) '("setfnsymbol" - (TeX-arg-completing-read ("bringhurst" "chicago" "wiley" -"lamport" "lamport*") - "Name")) + (TeX-arg-completing-read LaTeX-footmisc-fnsymbols-set "Name")) ;; 1.11 Option hang "hangfootparskip" @@ -85,8 +79,6 @@ "multfootsep" ;; 1.16 User interface -;; The following command references a label inside in a footnote -'("footref" TeX-arg-ref) "mpfootnotemark") ;; 1.9 Option marginal @@ -103,9 +95,7 @@ (font-latex-add-keywords '(("DefineFNsymbols" "*{[{") ("DefineFNsymbolsTM" "*{{") ("setfnsymbol" "{")) - 'function) - (font-latex-add-keywords '(("footref")) - 'reference))) + 'function))) TeX-dialect) (defvar LaTeX-footmisc-package-options '("perpage" "side" "ragged"
[elpa] externals/auctex 4700af5dd4 64/76: ; Delete ineffective string escapes reported by Relint
branch: externals/auctex commit 4700af5dd44af4b56981aafbc481452d1f0d65da Author: Arash Esbati Commit: Arash Esbati ; Delete ineffective string escapes reported by Relint * font-latex.el (font-latex-make-built-in-keywords): Remove ineffective escaping of parenthesis in strings. --- font-latex.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/font-latex.el b/font-latex.el index 4067564d17..b78cf58ad2 100644 --- a/font-latex.el +++ b/font-latex.el @@ -631,12 +631,12 @@ use." (if (eq type 'command) "\ This must be a list where each element is a list consisting of a -keyword string \(not a regular expression\) omitting the leading +keyword string (not a regular expression) omitting the leading backslash and a format specifier as described in the doc string of `font-latex-user-keyword-classes'." "\ -This must be a list where each element is a keyword string \(not a -regular expression\) omitting the leading backslash.") +This must be a list where each element is a keyword string (not a +regular expression) omitting the leading backslash.") "\n\n\ This is an internal variable which should not be set directly.
[elpa] externals/auctex 83622003aa 46/76: * style/enumitem.el ("enumitem"): Replace `TeX-arg-eval'.
branch: externals/auctex commit 83622003aa2bd9a8402f7f4edfc9abd0d0d05031 Author: Arash Esbati Commit: Arash Esbati * style/enumitem.el ("enumitem"): Replace `TeX-arg-eval'. --- style/enumitem.el | 35 --- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/style/enumitem.el b/style/enumitem.el index f8e8737beb..6363a244da 100644 --- a/style/enumitem.el +++ b/style/enumitem.el @@ -343,25 +343,30 @@ macro. Insert the value in brackets if OPTIONAL is non-nil." ;; But we go the extra mile to improve the user experience and add ;; the arguments directly to appropriate lists. ;; \newlist{}{}{} -'("newlist" - (TeX-arg-eval - (lambda () - (let ((name (TeX-read-string "Name: ")) - (type (completing-read - "Type: " - (mapcar #'cadr (LaTeX-enumitem-newlist-list - (depth (TeX-read-string "Max-depth: "))) - (when (or (string-equal type "description") - (string-equal type "description*")) - (add-to-list 'LaTeX-item-list `(,name . LaTeX-item-argument))) +`("newlist" + ,(lambda (optional) + (let ((name (TeX-read-string + (TeX-argument-prompt optional nil "Name" (LaTeX-add-environments `(,name LaTeX-env-item-args [TeX-arg-key-val (LaTeX-enumitem-key-val-options)])) - (LaTeX-add-enumitem-newlists (list name type)) (TeX-ispell-skip-setcdr `((,name ispell-tex-arg-end 0))) - (TeX-argument-insert name nil) - (TeX-argument-insert type nil) - (format "%s" depth) + (TeX-argument-insert name optional))) + (TeX-arg-completing-read ,(lambda () + (mapcar #'cadr + (LaTeX-enumitem-newlist-list))) + "Type") + (TeX-arg-string "Max-depth") + ,(lambda (_optional) + (save-excursion + (re-search-backward "newlist{\\([^}]+\\)}{\\([^}]+\\)}" + (line-beginning-position) t)) + (let ((name (match-string-no-properties 1)) + (type (match-string-no-properties 2))) + (when (or (string-equal type "description") + (string-equal type "description*")) + (add-to-list 'LaTeX-item-list `(,name . LaTeX-item-argument))) + (LaTeX-add-enumitem-newlists (list name type) ;; \renewlist{}{}{} `("renewlist"
[elpa] externals/auctex 643d39a10c 75/76: Update Pygments style names
branch: externals/auctex commit 643d39a10cf777579dc5210b6566df9b9137cc72 Author: Arash Esbati Commit: Arash Esbati Update Pygments style names * style/minted.el (LaTeX-minted-key-val-options): Update style names provided by Pygments version 2.14.0. --- style/minted.el | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/style/minted.el b/style/minted.el index 152fe929d0..a3e721feca 100644 --- a/style/minted.el +++ b/style/minted.el @@ -132,18 +132,17 @@ ;; in a .tex file, Emacs asks to apply a variable which is not ;; safe and does not restore the window; the splitted frame ;; remains. I couldn't figure out why, so for now, I add the -;; styles from Pygments version 2.11 here. +;; styles from Pygments version 2.14.0 here. ("style" ("abap" "algol" "algol_nu" "arduino" "autumn" "borland" "bw" "colorful" "default" "dracula" "emacs" "friendly" "friendly_grayscale" "fruity" - "gruvbox-dark" "gruvbox-light" "igor" "inkpot" - "lilypond" "lovelace" "manni" "material" - "monokai" "murphy" "native" "one-dark" - "paraiso-dark" "paraiso-light" "pastie" "perldoc" - "rainbow_dash" "rrt" "sas" "solarized-dark" - "solarized-light" "stata-dark" "stata-light" - "stata" "tango" "trac" "vim" "vs" "xcode" - "zenburn")) + "github-dark" "gruvbox-dark" "gruvbox-light" + "igor" "inkpot" "lilypond" "lovelace" "manni" "material" + "monokai" "murphy" "native" "nord" "nord-darker" + "one-dark" "paraiso-dark" "paraiso-light" "pastie" "perldoc" + "rainbow_dash" "rrt" "sas" "solarized-dark" "solarized-light" + "staroffice" "stata" "stata-dark" "stata-light" + "tango" "trac" "vim" "vs" "xcode" "zenburn")) ("stepnumber") ("stepnumberfromfirst") ("stepnumberoffsetvalues" ("true" "false"))
[elpa] externals/auctex 7da1860c2a 26/76: Support starred section names
branch: externals/auctex commit 7da1860c2a8cf7a2eb8f1596bf51af5532aa949b Author: Ikumi Keita Commit: Ikumi Keita Support starred section names * latex.el (LaTeX-section-level): Accept starred section names. Simplify. (LaTeX-section-name): Simplify. (LaTeX-section-heading): Include starred variants in completion candidates. * tex.el (LaTeX-command-section-boundaries): Arrange regexp to accept starred section names. Simplify. (LaTeX-command-section-change-level): Simplify. (): Arrange cookies for silencing compiler. * context.el (ConTeXt-numbered-section-name) (ConTeXt-unnumbered-section-name,ConTeXt-numbered-section-level) (ConTeXt-unnumbered-section-level): Simplify. --- context.el | 24 latex.el | 25 - tex.el | 20 3 files changed, 24 insertions(+), 45 deletions(-) diff --git a/context.el b/context.el index c8a99b94c6..1eeda6a9ea 100644 --- a/context.el +++ b/context.el @@ -363,35 +363,19 @@ section." (defun ConTeXt-numbered-section-name (level) "Return the name of the section corresponding to LEVEL." - (let ((entry (TeX-member level ConTeXt-numbered-section-list - (function (lambda (a b) (equal a (nth 1 b))) -(if entry -(nth 0 entry) - nil))) + (car (rassoc (list level) ConTeXt-numbered-section-list))) (defun ConTeXt-unnumbered-section-name (level) "Return the name of the section corresponding to LEVEL." - (let ((entry (TeX-member level ConTeXt-unnumbered-section-list - (function (lambda (a b) (equal a (nth 1 b))) -(if entry -(nth 0 entry) - nil))) + (car (rassoc (list level) ConTeXt-unnumbered-section-list))) (defun ConTeXt-numbered-section-level (name) "Return the level of the section NAME." - (let ((entry (TeX-member name ConTeXt-numbered-section-list - (function (lambda (a b) (equal a (nth 0 b))) -(if entry -(nth 1 entry) - nil))) + (cadr (assoc name ConTeXt-numbered-section-list))) (defun ConTeXt-unnumbered-section-level (name) "Return the level of the section NAME." - (let ((entry (TeX-member name ConTeXt-unnumbered-section-list - (function (lambda (a b) (equal a (nth 0 b))) -(if entry -(nth 1 entry) - nil))) + (cadr (assoc name ConTeXt-unnumbered-section-list))) ;;; Section Hooks. diff --git a/latex.el b/latex.el index 01436f53bd..ac900673dd 100644 --- a/latex.el +++ b/latex.el @@ -259,20 +259,14 @@ used in style files." (defun LaTeX-section-name (level) "Return the name of the section corresponding to LEVEL." - (let ((entry (TeX-member level LaTeX-section-list - (lambda (a b) (equal a (nth 1 b)) -(if entry -(nth 0 entry) - nil))) + (car (rassoc (list level) LaTeX-section-list))) (defun LaTeX-section-level (name) - "Return the level of the section NAME." - (let ((entry (TeX-member name LaTeX-section-list - (lambda (a b) (equal a (nth 0 b)) - -(if entry -(nth 1 entry) - nil))) + "Return the level of the section NAME. +NAME can be starred variant." + (if (string-suffix-p "*" name) + (setq name (substring-no-properties name 0 -1))) + (cadr (assoc name LaTeX-section-list))) (defcustom TeX-outline-extra nil "List of extra TeX outline levels. @@ -474,7 +468,12 @@ Insert this hook into `LaTeX-section-hook' to allow the user to change the name of the sectioning command inserted with \\[LaTeX-section]." (let ((string (completing-read (concat "Level (default " LaTeX-name "): ") - LaTeX-section-list + (append + ;; Include starred variants in candidates. + (mapcar (lambda (sct) +(list (concat (car sct) "*"))) + LaTeX-section-list) + LaTeX-section-list) nil nil nil nil LaTeX-name))) ;; Update LaTeX-name (if (not (zerop (length string))) diff --git a/tex.el b/tex.el index 2dfb7a7654..f7b822f5f2 100644 --- a/tex.el +++ b/tex.el @@ -56,6 +56,7 @@ (bus service path interface signal handler &rest args)) (declare-function LaTeX-environment-list "latex" nil) (declare-function LaTeX-bibliography-list "latex" nil) +(declare-function LaTeX-section-name "latex" (level)) (declare-function comint-exec "ext:comint" (buffer name command startfile switches)) (declare-function comint-mode "ext:comint" nil) @@ -91,7 +92,6 @@ (defvar LaTeX-optcl) (defvar LaTeX-optop) (defvar LaTeX-largest-level) -(defvar LaTeX-section-list) ;; tex-ispell.el (defvar TeX-ispell-verb-delimiters) ;; Others: @@ -9077,8 +9077,7 @@ Initialize it to `LaTeX-largest-level' if needed." determine the current section by `LaTeX-command-section'
[elpa] externals/auctex 2d0fdebac0 69/76: Preserve braces after @TeX and similar macros.
branch: externals/auctex commit 2d0fdebac0ec12676545dd4197171575e7489f56 Author: David Kastrup Commit: David Kastrup Preserve braces after @TeX and similar macros. --- doc/macros.texi | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/doc/macros.texi b/doc/macros.texi index 4162d052c4..478ac18a26 100644 --- a/doc/macros.texi +++ b/doc/macros.texi @@ -50,30 +50,30 @@ font-latex @end ifset @tex \global\let\savedTeX\TeX -\gdef\TeX#1{\savedTeX#1} -\gdef\LaTeX{% +\gdef\TeX#{\savedTeX} +\gdef\LaTeX#{% L\kern-.36em\raise.3ex\hbox{\sc{a}}\kern-.15em\TeX} -\gdef\previewlatex#1{% -{\sf preview-latex}#1} -\gdef\fontlatex#1{% -{\sf font-latex}#1} -\gdef\AUCTeX{AUC\TeX} -\gdef\ConTeXt#1{% -Con\TeX t#1} +\gdef\previewlatex#{% +{\textsf preview-latex}} +\gdef\fontlatex#{% +{\textsf font-latex}} +\gdef\AUCTeX#{AUC\TeX} +\gdef\ConTeXt#{% +Con\TeX{}t} \toks0\expandafter{\indexnofonts - \def\TeX#1{TeX#1}% - \def\LaTeX#1{LaTeX#1}\def\previewlatex#1{preview-latex#1}} + \def\TeX#{TeX}% + \def\LaTeX#{LaTeX}\def\previewlatex#{preview-latex}} \xdef\indexnofonts{\the\toks0} \ifx\commondummies\undefined \else \toks0\expandafter{\commondummies -\def\TeX#1{TeX#1}% -\def\LaTeX#1{LaTeX#1}\def\previewlatex#1{preview-latex#1}} +\def\TeX#{TeX}% +\def\LaTeX#1{LaTeX}\def\previewlatex#1{preview-latex}} \xdef\commondummies{\the\toks0} \fi \ifx\definedummies\undefined \else \toks0\expandafter{\definedummies -\def\TeX#1{TeX#1}% -\def\LaTeX#1{LaTeX#1}\def\previewlatex#1{preview-latex#1}} +\def\TeX#{TeX}% +\def\LaTeX#{LaTeX}\def\previewlatex#{preview-latex}} \xdef\definedummies{\the\toks0} \fi \ifx\acronym\undefined \gdef\acronym#1{{\smallcaps \lowercase{#1}}} \fi
[elpa] externals/auctex 01f84ce9f5 73/76: Simplify implementation of style/minted.el
branch: externals/auctex commit 01f84ce9f5534db8660dc71383d94517a9e57393 Author: Arash Esbati Commit: Arash Esbati Simplify implementation of style/minted.el * style/minted.el (LaTeX-arg-minted-language) (LaTeX-arg-minted-style): Delete functions and move the functionality into the hook. --- style/minted.el | 54 ++ 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/style/minted.el b/style/minted.el index 354213be8a..152fe929d0 100644 --- a/style/minted.el +++ b/style/minted.el @@ -1,6 +1,6 @@ ;;; minted.el --- AUCTeX style for `minted.sty' (v2.5) -*- lexical-binding: t; -*- -;; Copyright (C) 2014-2021 Free Software Foundation, Inc. +;; Copyright (C) 2014--2023 Free Software Foundation, Inc. ;; Author: Tassilo Horn ;; Maintainer: auctex-de...@gnu.org @@ -197,15 +197,6 @@ Update the variable `LaTeX-minted-language-list' if still nil." (setq LaTeX-minted-language-list languages)) LaTeX-minted-language-list -(defun LaTeX-arg-minted-language (optional &optional prompt) -"Insert a selected pygmentize language as argument for macros from minted.sty. -If OPTIONAL is non-nil, insert it as optional argument in -brackets. PROMPT replaces the standard one." - (TeX-argument-insert - (completing-read (TeX-argument-prompt optional prompt "Language") -(LaTeX-minted-language-list)) - optional)) - (defvar LaTeX-minted-style-list nil "List containing styles provided by pymentize program.") @@ -225,15 +216,6 @@ Update the variable `LaTeX-minted-style-list' if still nil." (setq LaTeX-minted-style-list styles)) LaTeX-minted-style-list -(defun LaTeX-arg-minted-style (optional &optional prompt) - "Insert a selected pygmentize style as argument for macros from minted.sty. -If OPTIONAL is non-nil, insert it as optional argument in -brackets. PROMPT replaces the standard one." - (TeX-argument-insert - (completing-read (TeX-argument-prompt optional prompt "Style") -(LaTeX-minted-style-list)) - optional)) - (defvar LaTeX-minted-auto-newminted nil) (defvar LaTeX-minted-newminted-regexp '("newminted\\(?:\\[\\([^]]+\\)\\]\\)?{\\([^}]+\\)}{[^}]*}" @@ -373,38 +355,46 @@ a list of strings." (TeX-add-symbols '("mint" [TeX-arg-key-val (LaTeX-minted-key-val-options)] - LaTeX-arg-minted-language TeX-arg-verb) + (TeX-arg-completing-read (LaTeX-minted-language-list) "Language") + TeX-arg-verb) '("mintinline" [TeX-arg-key-val (LaTeX-minted-key-val-options)] - LaTeX-arg-minted-language TeX-arg-verb-delim-or-brace) -'("newminted" ["Environment Name"] LaTeX-arg-minted-language + (TeX-arg-completing-read (LaTeX-minted-language-list) "Language") + TeX-arg-verb-delim-or-brace) +'("newminted" ["Environment Name"] + (TeX-arg-completing-read (LaTeX-minted-language-list) "Language") (TeX-arg-key-val (LaTeX-minted-key-val-options))) -'("newmint" ["Macro Name"] LaTeX-arg-minted-language +'("newmint" ["Macro Name"] + (TeX-arg-completing-read (LaTeX-minted-language-list) "Language") (TeX-arg-key-val (LaTeX-minted-key-val-options))) -'("newmintinline" ["Macro Name"] LaTeX-arg-minted-language +'("newmintinline" ["Macro Name"] + (TeX-arg-completing-read (LaTeX-minted-language-list) "Language") (TeX-arg-key-val (LaTeX-minted-key-val-options))) -'("newmintedfile" ["Macro Name"] LaTeX-arg-minted-language +'("newmintedfile" ["Macro Name"] + (TeX-arg-completing-read (LaTeX-minted-language-list) "Language") (TeX-arg-key-val (LaTeX-minted-key-val-options))) ;; 3.3 Formatting source code '("inputminted" - [TeX-arg-key-val (LaTeX-minted-key-val-options)] - (LaTeX-arg-minted-language) + [TeX-arg-key-val (LaTeX-minted-key-vaLaTeX-arg-minted-languagel-options)] + (TeX-arg-completing-read (LaTeX-minted-language-list) "Language") TeX-arg-file) ;; 3.4 Using different styles '("usemintedstyle" - [ LaTeX-arg-minted-language ] LaTeX-arg-minted-style) + [TeX-arg-completing-read (LaTeX-minted-language-list) "Language"] + (TeX-arg-completing-read (LaTeX-minted-style-list) "Style")) ;; 5.2 Macro option usage '("setminted" - [ LaTeX-arg-minted-language ] + [TeX-arg-completing-read (LaTeX-minted-language-list) "Language"] (TeX-arg-key-val (LaTeX-minted-key-val-options))) '("setmintedinline" - [ LaTeX-arg-minted-language ] + [TeX-arg-completing-read (LaTeX-minted-language-list) "Language"] (TeX-arg-key-val (LaTeX-minted-key-val-options ;; New environments (LaTeX-add-environments -'("minted" LaTeX-env-args [TeX-arg-key-val (LaTeX-minted-key-val-options)] - LaTeX-arg-minted-language)) +'("minted" LaTeX-env-args + [TeX-arg-key-val (LaTeX-minted-key-val-options)] + (TeX-arg-comple
[elpa] externals/auctex f9b378a45c 70/76: Support detached arguments
branch: externals/auctex commit f9b378a45c89b16a183f46830e4c7ec7b2aec7c5 Author: Ikumi Keita Commit: Ikumi Keita Support detached arguments * tex.el (TeX-find-macro-boundaries): Skip white spaces between a macro argument and comment starter. Fix doc string. Add FIXME comment. (TeX-find-macro-end-helper): Skip white spaces at the beginning of line even when the preceding line doesn't end with comment. * tests/tex/navigation.el (TeX-check-f-m-b): New function. (TeX-find-macro-boundaries-detached-arg): New test. (TeX-find-macro-end-helper): Integrate similar tests into one test. (TeX-check-f-m-e-h): Adapt according to the above integration. --- tests/tex/navigation.el | 75 - tex.el | 17 --- 2 files changed, 69 insertions(+), 23 deletions(-) diff --git a/tests/tex/navigation.el b/tests/tex/navigation.el index 4debb44f5c..45071bf2b8 100644 --- a/tests/tex/navigation.el +++ b/tests/tex/navigation.el @@ -1,6 +1,6 @@ ;;; navigation.el --- tests for navigation function in TeX buffer -*- lexical-binding: t; -*- -;; Copyright (C) 2019-2021 Free Software Foundation, Inc. +;; Copyright (C) 2019-2023 Free Software Foundation, Inc. ;; This file is part of AUCTeX. @@ -26,29 +26,66 @@ (defun TeX-check-f-m-e-h (string &optional position) "Check whether `TeX-find-macro-end-helper' works for exceptional case." + (erase-buffer) + (insert string) + (should (= (or position (point-max)) + (TeX-find-macro-end-helper (point-min) + +(ert-deftest TeX-find-macro-end-helper () (with-temp-buffer -(insert string) -(should (= (or position (point-max)) - (TeX-find-macro-end-helper (point-min)) +(LaTeX-mode) + +;; single macro ending at EOB +(TeX-check-f-m-e-h "\\foo") + +;; curly braces ending at EOB +(TeX-check-f-m-e-h "\\foo{bar}") + +;; curly brace failing to close at EOB +(TeX-check-f-m-e-h "\\foo{bar") + +;; square brackets ending at EOB +(TeX-check-f-m-e-h "\\foo{bar}[baz]") + +;; square bracket failing to close at EOB +(TeX-check-f-m-e-h "\\foo{bar}[baz" (1+ (length "\\foo{bar}") + +(defun TeX-check-f-m-b (string &optional chars) + "Check whether `TeX-find-macro-boundaries' works for exceptional case." + (erase-buffer) + (insert string) + (if chars (backward-char chars)) + (let ((result (TeX-find-macro-boundaries))) +(should (= (point-min) + (car result))) +(should (= (point-max) + (cdr result) + +(ert-deftest TeX-find-macro-boundaries-detached-arg () + (with-temp-buffer +;; necessary to set comment syntax properly +(LaTeX-mode) + +;; argument separated by newline +(TeX-check-f-m-e-h "\\foo{bar} +{baz}") + +(TeX-check-f-m-e-h "\\foo{bar} + {baz}") -(ert-deftest TeX-find-macro-end-helper-single () - ;; single macro ending at EOB - (TeX-check-f-m-e-h "\\foo")) +(TeX-check-f-m-e-h "\\foo{bar} % comment + {baz}") -(ert-deftest TeX-find-macro-end-helper-curly () - ;; curly braces ending at EOB - (TeX-check-f-m-e-h "\\foo{bar}")) +(TeX-check-f-m-b "\\foo{bar} +{baz}" 2) -(ert-deftest TeX-find-macro-end-helper-curly-fail () - ;; curly brace failing to close at EOB - (TeX-check-f-m-e-h "\\foo{bar")) +(TeX-check-f-m-b "\\foo{bar} + {baz}" 2) -(ert-deftest TeX-find-macro-end-helper-square () - ;; square brackets ending at EOB - (TeX-check-f-m-e-h "\\foo{bar}[baz]")) +(TeX-check-f-m-b "\\foo{bar} % comment + {baz}" 2) -(ert-deftest TeX-find-macro-end-helper-square-fail () - ;; square bracket failing to close at EOB - (TeX-check-f-m-e-h "\\foo{bar}[baz" (1+ (length "\\foo{bar}" +(TeX-check-f-m-b "\\foo{bar}% comment + {baz}" 2))) ;;; navigation.el ends here diff --git a/tex.el b/tex.el index e032d8c5e5..456c0310a1 100644 --- a/tex.el +++ b/tex.el @@ -1,6 +1,6 @@ ;;; tex.el --- Support for TeX documents. -*- lexical-binding: t; -*- -;; Copyright (C) 1985-2022 Free Software Foundation, Inc. +;; Copyright (C) 1985-2023 Free Software Foundation, Inc. ;; Maintainer: auctex-de...@gnu.org ;; Keywords: tex @@ -5573,10 +5573,18 @@ in the buffer." (TeX-find-balanced-brace -1 depth limit)) (defun TeX-find-macro-boundaries (&optional lower-bound) - "Return a list containing the start and end of a macro. + "Return a cons containing the start and end of a macro. If LOWER-BOUND is given, do not search backward further than this point in buffer. Arguments enclosed in brackets or braces are considered part of the macro." + ;; FIXME: Pay attention to `texmathp-allow-detached-args' and + ;; `reftex-allow-detached-macro-args'. + ;; Should we handle cases like \"{o} and \\[3mm] (that is, a macro + ;; whose name is a symbol and takes some arguments) as well? Note + ;; that amsmath package arranges the macro \\ so that white spaces + ;; between \\ and [something] prevents the latter to
[elpa] externals/auctex 22336f15bd 52/76: Simplify implementation of style/mathtools.el
branch: externals/auctex commit 22336f15bd9ad769304f502dcaa37552fae58a30 Author: Arash Esbati Commit: Arash Esbati Simplify implementation of style/mathtools.el * style/mathtools.el (LaTeX-mathtools-arg-mathstyle-completion) (LaTeX-mathtools-arg-mathsize-completion): Delete functions and move the functionality into the hook. (LaTeX-mathtools-mathstyle-list): New variable. (LaTeX-mathtools-auto-cleanup): ("mathtools"): Adjust acc. to deleted function(s). Replace `TeX-arg-eval'. --- style/mathtools.el | 144 - 1 file changed, 77 insertions(+), 67 deletions(-) diff --git a/style/mathtools.el b/style/mathtools.el index 505c15718f..6a7928e97b 100644 --- a/style/mathtools.el +++ b/style/mathtools.el @@ -129,14 +129,17 @@ (dolist (delim (LaTeX-mathtools-DeclarePairedDelimiter-list)) (let ((cmd (car delim)) (arg (cadr delim))) -(TeX-add-symbols `(,cmd [ LaTeX-mathtools-arg-mathsize-completion ] -,(if (string= arg "") - 1 - (string-to-number arg))) - `(,(concat cmd "*") - ,(if (string= arg "") -1 - (string-to-number arg))) +(TeX-add-symbols + `(,cmd + [TeX-arg-completing-read ("\\big" "\\Big" "\\bigg" "\\Bigg") +"Command" nil nil nil nil nil nil "\\"] + ,(if (string= arg "") +1 + (string-to-number arg))) + `(,(concat cmd "*") + ,(if (string= arg "") +1 + (string-to-number arg))) (when (LaTeX-mathtools-newgathered-list) (dolist (env (mapcar #'car (LaTeX-mathtools-newgathered-list))) (LaTeX-add-environments env) @@ -151,41 +154,30 @@ (add-hook 'TeX-auto-cleanup-hook #'LaTeX-mathtools-auto-cleanup t) (add-hook 'TeX-update-style-hook #'TeX-auto-parse t) -(defun LaTeX-mathtools-arg-mathstyle-completion (optional) - "Query and insert mathstyle argument to various commands. -If OPTIONAL, insert it as optional argument in brackets." - (TeX-argument-insert - (completing-read -(TeX-argument-prompt optional nil - (concat "Math style: " TeX-esc) t) -'("displaystyle" "textstyle" - "scriptstyle" "scriptscriptstyle")) - optional TeX-esc)) - -(defun LaTeX-mathtools-arg-mathsize-completion (optional) - "Query and insert math size argument to various commands. -If OPTIONAL, insert it as optional argument in brackets." - (TeX-argument-insert - (completing-read -(TeX-argument-prompt optional nil - (concat "Size command: " TeX-esc) t) -'("big" "Big" "bigg" "Bigg")) - optional TeX-esc)) +(defvar LaTeX-mathtools-mathstyle-list + '("\\displaystyle" "\\textstyle" +"\\scriptstyle" "\\scriptscriptstyle") + "List of math styles supported by the mathtools package.") (defun LaTeX-mathtools-arg-declarepaireddelimiter (optional &optional X) - "Query and insert various \\DeclarePairedDelimiter macros from mathtools package." + "Query and insert various \\DeclarePairedDelimiter macros from mathtools package. +If X is non-nil, be aware of the macros \\DeclarePairedDelimiterX +and \\DeclarePairedDelimiterXPP." (let ((cmd (TeX-read-string (concat "Command: " TeX-esc))) (arg (when X (TeX-read-string (TeX-argument-prompt t nil "Number of arguments") -(TeX-add-symbols `(,cmd [ LaTeX-mathtools-arg-mathsize-completion ] -,(if X - ;; This is no precaution, arg has to be > 0 - (string-to-number arg) - 1)) - `(,(concat cmd "*") - ,(if X -(string-to-number arg) - 1))) +(TeX-add-symbols + `(,cmd + [TeX-arg-completing-read ("\\big" "\\Big" "\\bigg" "\\Bigg") +"Command" nil nil nil nil nil nil "\\"] + ,(if X +;; This is no precaution, arg has to be > 0 +(string-to-number arg) + 1)) + `(,(concat cmd "*") + ,(if X +(string-to-number arg) + 1))) (LaTeX-add-mathtools-DeclarePairedDelimiters `(,cmd ,(if X arg ""))) (TeX-argument-insert cmd optional TeX-esc) @@ -289,17 +281,38 @@ Put line break macro on the last line. Next, insert an ampersand." (TeX-add-symbols '("mathtoolsset" (TeX-arg-key-val LaTeX-mathtools-key-val-options)) ;; 3.1.1 A complement to \smash, \llap, and \rlap -'("mathllap" [ LaTeX-mathtools-arg-mathstyle-completion ] t) -'("mathrlap" [ LaTeX-mathtools-arg-mathstyle-completion ] t) -'("mathclap" [ LaTeX-mathtools-arg-mathstyle-completion ]
[elpa] externals/auctex dc6e8c44c9 72/76: Turn `y-or-n-p' into `always' for in-buffer completion
branch: externals/auctex commit dc6e8c44c988ec4824266b01d89b66375ef14a3c Author: Arash Esbati Commit: Arash Esbati Turn `y-or-n-p' into `always' for in-buffer completion * latex.el (LaTeX-completion-parse-args): Turn `y-or-n-p' into `always' inside `TeX-arg-conditional' for in-buffer completion. --- latex.el | 25 +++-- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/latex.el b/latex.el index 7c29306642..56992d54fb 100644 --- a/latex.el +++ b/latex.el @@ -7574,17 +7574,22 @@ or `LaTeX-environment-list' and returns it." (pop arg-list)) ;; Check for `TeX-arg-conditional' here and change `arg-list' -;; accordingly +;; accordingly. +;; FIXME: Turn `y-or-n-p' into `always' otherwise there will be a +;; query during in-buffer completion. This will work for most +;; cases, but will also fail for example in hyperref.el. This +;; decision should revisited at a later stage: (when (assq 'TeX-arg-conditional arg-list) - (while (and arg-list - (setq arg (car arg-list))) -(if (and (listp arg) (eq (car arg) 'TeX-arg-conditional)) -(setq result (append (reverse (if (eval (nth 1 arg) t) - (nth 2 arg) -(nth 3 arg))) - result)) - (push arg result)) -(pop arg-list)) + (cl-letf (((symbol-function 'y-or-n-p) #'always)) +(while (and arg-list +(setq arg (car arg-list))) + (if (and (listp arg) (eq (car arg) 'TeX-arg-conditional)) + (setq result (append (reverse (if (eval (nth 1 arg) t) +(nth 2 arg) + (nth 3 arg))) + result)) +(push arg result)) + (pop arg-list))) (setq arg-list (nreverse result))) ;; Now parse the `arg-list':
[elpa] externals/auctex 324cb5c913 41/76: Simplify implementation of style/hologo.el
branch: externals/auctex commit 324cb5c9134ae2ed974fa58a6584424c899e7289 Author: Arash Esbati Commit: Arash Esbati Simplify implementation of style/hologo.el * style/hologo.el (LaTeX-hologo--arg-use-region-or-query-logo-name): Reduce functionality. (LaTeX-hologo--arg-use-region): New helper function to wrap region in a pair of braces. ("hologo"): Use new functions in combination with `TeX-arg-conditional'. Replace `TeX-arg-eval'. --- style/hologo.el | 144 +--- 1 file changed, 74 insertions(+), 70 deletions(-) diff --git a/style/hologo.el b/style/hologo.el index 7e4608939b..edf24dbb25 100644 --- a/style/hologo.el +++ b/style/hologo.el @@ -32,6 +32,7 @@ ;;; Code: (require 'tex) +(require 'latex) ;; Silence the compiler: (declare-function font-latex-add-keywords @@ -106,17 +107,18 @@ "space" "hyphen" "runtogether"))) ; plainTeX "Local key=value options for hologo macros.") -(defun LaTeX-hologo--arg-use-region-or-query-logo-name (optional) - (if (and (use-region-p) - (member (buffer-substring (region-beginning) (region-end)) - LaTeX-hologo-logo-names)) - (progn -(insert TeX-grop) -(goto-char (region-end)) -(insert TeX-grcl)) -(TeX-argument-insert - (completing-read "Logo name: " LaTeX-hologo-logo-names) - optional))) +(defun LaTeX-hologo--arg-use-region-or-query-logo-name () + "Check if region is active and over element from `LaTeX-hologo-logo-names'." + (and (use-region-p) + (member (buffer-substring (region-beginning) (region-end)) + LaTeX-hologo-logo-names))) + +(defun LaTeX-hologo--arg-use-region (_optional) + "Wrap region around braces. +OPTIONAL is ignored." + (insert TeX-grop) + (goto-char (region-end)) + (insert TeX-grcl)) (TeX-add-style-hook "hologo" @@ -124,35 +126,40 @@ (TeX-add-symbols ;; Insert logo macros -'("hologo" LaTeX-hologo--arg-use-region-or-query-logo-name) -'("Hologo" LaTeX-hologo--arg-use-region-or-query-logo-name) +`("hologo" + (TeX-arg-conditional (LaTeX-hologo--arg-use-region-or-query-logo-name) + (LaTeX-hologo--arg-use-region) +((TeX-arg-completing-read LaTeX-hologo-logo-names "Logo name" +`("Hologo" + (TeX-arg-conditional (LaTeX-hologo--arg-use-region-or-query-logo-name) + (LaTeX-hologo--arg-use-region) +((TeX-arg-completing-read LaTeX-hologo-logo-names "Logo name" ;; Setup macros '("hologoSetup" (TeX-arg-key-val LaTeX-hologo-key-val-options-global)) -'("hologoLogoSetup" - (TeX-arg-eval - (lambda () - (let* ((logo (completing-read "Logo name: " LaTeX-hologo-logo-names)) -(keyval (TeX-read-key-val - nil - (cond ((string= logo "BibTeX") -(append '(("variant" ("sf" "sc"))) -LaTeX-hologo-key-val-options-global)) - ((string= logo "ConTeXt") -(append '(("variant" ("narrow" "simple"))) -LaTeX-hologo-key-val-options-global)) - ((string= logo "plainTeX") -(append '(("variant" ("space" "hyphen" "runtogether"))) -LaTeX-hologo-key-val-options-global)) - ((or (string= logo "SLiTeX") -(string= logo "SliTeX")) -(append '(("variant" ("lift" "narrow" "lift"))) -LaTeX-hologo-key-val-options-global)) - (t -LaTeX-hologo-key-val-options-global) - (TeX-argument-insert logo nil) - (format "%s" keyval) +`("hologoLogoSetup" + (TeX-arg-completing-read LaTeX-hologo-logo-names "Logo name") + (TeX-arg-key-val ,(lambda () + (save-excursion +(re-search-backward "hologoLogoSetup{\\([^}]+\\)}" +(line-beginning-position) t)) + (let ((logo (match-string-no-properties 1))) +(cond ((string= logo "BibTeX") + (append '(("variant" ("sf" "sc"))) + LaTeX-hologo-key-val-options-global)) + ((string= logo "ConTeXt") + (append '(("variant" ("narrow" "simple"))) + LaTeX-hologo-key-val-options-global)) + ((string= logo "plainTeX") + (append '(("variant" ("space" "hyphen" "runtogether"))) +
[elpa] externals/auctex d3ab64f893 60/76: Reduce redundancy in regexp
branch: externals/auctex commit d3ab64f89394d16473ee1af144d5cf6bde77380c Author: Ikumi Keita Commit: Ikumi Keita Reduce redundancy in regexp * latex.el (LaTeX-environment-name-regexp): Don't quote regexp inside [^...]. (LaTeX-modify-environment): Omit spurious regexp group. (already given by `LaTeX-environment-name-regexp') --- latex.el | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/latex.el b/latex.el index b41d7f9b18..8d181f6982 100644 --- a/latex.el +++ b/latex.el @@ -848,10 +848,9 @@ environment just inserted, the buffer position just before "Return the regexp matching the name of a LaTeX environment. This matches everything different from a TeX closing brace but allowing one level of TeX group braces." - (concat "\\([^" (regexp-quote TeX-grcl) (regexp-quote TeX-grop) "]*\\(" - (regexp-quote TeX-grop) "[^" (regexp-quote TeX-grcl) - (regexp-quote TeX-grop) "]*" (regexp-quote TeX-grcl) "\\)*[^" - (regexp-quote TeX-grcl) (regexp-quote TeX-grop) "]*\\)")) + (concat "\\([^" TeX-grcl TeX-grop "]*\\(" (regexp-quote TeX-grop) + "[^" TeX-grcl TeX-grop "]*" (regexp-quote TeX-grcl) "\\)*[^" + TeX-grcl TeX-grop "]*\\)")) (defvar LaTeX-after-modify-env-hook nil "List of functions to be run at the end of `LaTeX-modify-environment'. @@ -867,9 +866,7 @@ position just before \\begin and the position just before (re-search-backward (concat (regexp-quote TeX-esc) "end" (regexp-quote TeX-grop) -"\\(" (LaTeX-environment-name-regexp) -"\\)" (regexp-quote TeX-grcl)) (line-beginning-position (goto-begin (lambda () @@ -878,9 +875,7 @@ position just before \\begin and the position just before (re-search-forward (concat (regexp-quote TeX-esc) "begin" (regexp-quote TeX-grop) - "\\(?:" (LaTeX-environment-name-regexp) - "\\)" (regexp-quote TeX-grcl)) (line-end-position)) (save-excursion
[elpa] externals/auctex bf66b302a4 61/76: Improve the previous commit slightly
branch: externals/auctex commit bf66b302a4afa297fc2322a875935fd9a4d47525 Author: Ikumi Keita Commit: Ikumi Keita Improve the previous commit slightly * latex.el (LaTeX-current-environment,LaTeX-backward-up-environment): Move the task to find out the environment name from the latter to the former. --- latex.el | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/latex.el b/latex.el index 8d181f6982..7c29306642 100644 --- a/latex.el +++ b/latex.el @@ -905,16 +905,21 @@ environment in commented regions with the same comment prefix. The functions `LaTeX-find-matching-begin' and `LaTeX-find-matching-end' work analogously." - (or (save-excursion (LaTeX-backward-up-environment arg t)) - "document")) + (save-excursion +(if (LaTeX-backward-up-environment arg) +(progn + (re-search-forward (concat + TeX-grop (LaTeX-environment-name-regexp) + TeX-grcl)) + (match-string-no-properties 1)) + "document"))) -(defun LaTeX-backward-up-environment (&optional arg want-name) +(defun LaTeX-backward-up-environment (&optional arg) "Move backward out of the enclosing environment. Helper function of `LaTeX-current-environment' and `LaTeX-find-matching-begin'. With optional ARG>=1, find that outer level. Return non-nil if the operation succeeded. -Return the (outermost) environment name if WANT-NAME is non-nil. Assume the current point is on neither \"begin{foo}\" nor \"end{foo}\"." (setq arg (if arg (if (< arg 1) 1 arg) 1)) @@ -943,13 +948,7 @@ Assume the current point is on neither \"begin{foo}\" nor \"end{foo}\"." (setq arg (if (= (char-after (match-beginning 1)) ?e) (1+ arg) (1- arg) -(if (= arg 0) -(or (not want-name) -(progn - (looking-at (concat (regexp-quote TeX-esc) "begin *" - TeX-grop (LaTeX-environment-name-regexp) - TeX-grcl)) - (match-string-no-properties 1)) +(= arg 0))) (defun docTeX-in-macrocode-p () "Determine if point is inside a macrocode environment."
[elpa] externals/auctex c60ed913a0 12/76: ; Remove unnecessary `declare-function'
branch: externals/auctex commit c60ed913a04656fa346db6403d3adb713d76f975 Author: Ikumi Keita Commit: Ikumi Keita ; Remove unnecessary `declare-function' * style/tikz.el: Remove unnecessary `declare-function' that I shouldn't add. --- style/tikz.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/style/tikz.el b/style/tikz.el index e97a5fb6e8..e0cb04131e 100644 --- a/style/tikz.el +++ b/style/tikz.el @@ -36,8 +36,6 @@ ;; Silence compiler (declare-function ConTeXt-add-environments "context" (&rest environments)) -(declare-function ConTeXt-insert-environment "context" - (environment &optional extra)) (defconst TeX-TikZ-point-function-map '(("Rect Point" TeX-TikZ-arg-rect-point)
[elpa] externals/auctex 3806176ba2 56/76: Fix argument description in doc strings
branch: externals/auctex commit 3806176ba2fa11cc990e49792f9db34532c85258 Author: Ikumi Keita Commit: Ikumi Keita Fix argument description in doc strings * latex.el (TeX-read-key-val): * multi-prompt.el (multi-prompt-key-value): Correct the format of KEY-VAL-ALIST and state that variable is also allowed. * style/acro.el (LaTeX-arg-acro-key-val): Simplify instead of stating the detail. --- latex.el| 8 +--- multi-prompt.el | 10 +++--- style/acro.el | 9 - 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/latex.el b/latex.el index 0a49fccdfc..81db2e760b 100644 --- a/latex.el +++ b/latex.el @@ -3266,9 +3266,11 @@ reading an optional argument. KEY-VAL-ALIST can be - A symbol returning an alist - An alist -The car of each element should be a string representing a key and -the optional cdr should be a list with strings to be used as -values for the key. +Each entry of this alist is a list. The first element of each +list is a string representing a key and the optional second +element is a list with strings to be used as values for the key. +The second element can also be a variable returning a list of +strings. PROMPT replaces the standard one where \\=' (k=v): \\=' is appended to it. If you want the full control over the prompt, diff --git a/multi-prompt.el b/multi-prompt.el index b863271146..06f28ca544 100644 --- a/multi-prompt.el +++ b/multi-prompt.el @@ -185,9 +185,13 @@ the alist elements." hist def inherit-input-method) "Read multiple strings, with completion and key=value support. PROMPT is a string to prompt with, usually ending with a colon -and a space. TABLE is an alist. The car of each element should -be a string representing a key and the optional cdr should be a -list with strings to be used as values for the key. +and a space. + +TABLE is an alist where each entry is a list. The first element +of each list is a string representing a key and the optional +second element is a list with strings to be used as values for +the key. The second element can also be a variable returning a +list of strings. See the documentation for `completing-read' for details on the other arguments: PREDICATE, REQUIRE-MATCH, INITIAL-INPUT, HIST, diff --git a/style/acro.el b/style/acro.el index 56291a1b2c..26e32b8d6a 100644 --- a/style/acro.el +++ b/style/acro.el @@ -152,11 +152,10 @@ in its optional argument.") (defun LaTeX-arg-acro-key-val (optional prompt key-val-alist) "Prompt for keys and values in KEY-VAL-ALIST. key binding in minibuffer is removed temporarily. Insert -the given value as a TeX macro argument. If OPTIONAL is non-nil, -insert it as an optional argument. Use PROMPT as the prompt -string. KEY-VAL-ALIST is an alist. The car of each element -should be a string representing a key and the optional cdr should -be a list with strings to be used as values for the key." +the given value as a TeX macro argument. + +See `TeX-read-key-val' for explanation of OPTIONAL, PROMPT and +KEY-VAL-ALIST." ;; Remove key binding from map used in `multi-prompt-key-value' (called ;; by `TeX-arg-key-val') with `require-match' set to `nil'. (let ((crm-local-completion-map
[elpa] externals/auctex d7dc696f47 25/76: * latex.el (LaTeX-env-contents): Add the "nowarn" key.
branch: externals/auctex commit d7dc696f47b210729885d6e033472db9e6433761 Author: Arash Esbati Commit: Arash Esbati * latex.el (LaTeX-env-contents): Add the "nowarn" key. --- latex.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/latex.el b/latex.el index cea33b1adf..01436f53bd 100644 --- a/latex.el +++ b/latex.el @@ -1435,7 +1435,7 @@ Just like array and tabular." (defun LaTeX-env-contents (environment) "Insert ENVIRONMENT with optional argument and filename for contents." - (let* ((opt '("overwrite" "force" "nosearch")) + (let* ((opt '("overwrite" "force" "nosearch" "nowarn")) (arg (mapconcat #'identity (TeX-completing-read-multiple (TeX-argument-prompt t nil "Options")