[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master f056a4d 33/42: Minor code shuffling and commenting
From: |
Noam Postavsky |
Subject: |
[elpa] master f056a4d 33/42: Minor code shuffling and commenting |
Date: |
Sun, 22 Dec 2019 17:38:02 -0500 (EST) |
branch: master
commit f056a4def80fa07132d9dd929ddedfb9d0fabd28
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Minor code shuffling and commenting
* yasnippet.el (yas--do-todo-snippet-indent): Renamed from
yas--do-todo-snippet-indent.
---
yasnippet.el | 88 +++++++++++++++++++++++++++++++-----------------------------
1 file changed, 46 insertions(+), 42 deletions(-)
diff --git a/yasnippet.el b/yasnippet.el
index bd915ef..9951940 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -3778,10 +3778,6 @@ BEG, END and LENGTH like overlay modification hooks."
(= beg (yas--field-start field)) ; Insertion at field start?
(not (yas--field-modified-p field))))
-(defvar yas--todo-snippet-indent nil nil)
-(make-variable-buffer-local 'yas--todo-snippet-indent)
-
-(defvar yas--before-change-modified-snippets nil)
(defun yas--merge-and-drop-dups (list1 list2 cmp key)
;; `delete-consecutive-dups' + `cl-merge'.
@@ -3790,6 +3786,9 @@ BEG, END and LENGTH like overlay modification hooks."
#'delete-dups)
(cl-merge 'list list1 list2 cmp :key key)))
+(defvar yas--before-change-modified-snippets nil)
+(make-variable-buffer-local 'yas--before-change-modified-snippets)
+
(defun yas--gather-active-snippets (overlay beg end then-delete)
;; Add active snippets in BEG..END into an OVERLAY keyed entry of
;; `yas--before-change-modified-snippets'. Return accumulated list.
@@ -3813,6 +3812,8 @@ BEG, END and LENGTH like overlay modification hooks."
(when then-delete
(cl-callf2 delq old yas--before-change-modified-snippets)))))
+(defvar yas--todo-snippet-indent nil nil)
+(make-variable-buffer-local 'yas--todo-snippet-indent)
(defun yas--on-field-overlay-modification (overlay after? beg end &optional
length)
"Clears the field and updates mirrors, conditionally.
@@ -3866,7 +3867,9 @@ field start. This hook does nothing if an undo is in
progress."
(lwarn '(yasnippet zombie) :warning "Killing zombie snippet!")
(delete-overlay overlay)))))
-(defun yas--do-todo-field-updates ()
+(defun yas--do-todo-snippet-indent ()
+ ;; Do pending indentation of snippet fields, called from
+ ;; `yas--post-command-handler'.
(when yas--todo-snippet-indent
(save-excursion
(cl-loop for snippet in yas--todo-snippet-indent
@@ -3875,6 +3878,7 @@ field start. This hook does nothing if an undo is in
progress."
(setq yas--todo-snippet-indent nil))))
(defun yas--auto-fill ()
+ ;; Preserve snippet markers during auto-fill.
(let* ((orig-point (point))
(end (progn (forward-paragraph) (point)))
(beg (progn (backward-paragraph) (point)))
@@ -3890,44 +3894,44 @@ field start. This hook does nothing if an undo is in
progress."
reoverlays))
(goto-char orig-point)
(let ((yas--inhibit-overlay-hooks t))
- (if (null yas--original-auto-fill-function)
- ;; Try to get more info on #873/919.
- (let ((yas--fill-fun-values `((t ,(default-value
'yas--original-auto-fill-function))))
- (fill-fun-values `((t ,(default-value 'auto-fill-function))))
- ;; Listing 2 buffers with the same value is enough
- (print-length 3))
- (save-current-buffer
- (dolist (buf (let ((bufs (buffer-list)))
- ;; List the current buffer first.
- (setq bufs (cons (current-buffer)
- (remq (current-buffer) bufs)))))
- (set-buffer buf)
- (let* ((yf-cell (assq yas--original-auto-fill-function
- yas--fill-fun-values))
- (af-cell (assq auto-fill-function fill-fun-values)))
- (when (local-variable-p 'yas--original-auto-fill-function)
- (if yf-cell (setcdr yf-cell (cons buf (cdr yf-cell)))
- (push (list yas--original-auto-fill-function buf)
yas--fill-fun-values)))
- (when (local-variable-p 'auto-fill-function)
- (if af-cell (setcdr af-cell (cons buf (cdr af-cell)))
- (push (list auto-fill-function buf) fill-fun-values))))))
- (lwarn '(yasnippet auto-fill bug) :error
- "`yas--original-auto-fill-function' unexpectedly nil
in %S! Disabling auto-fill.
+ (if yas--original-auto-fill-function
+ (funcall yas--original-auto-fill-function)
+ ;; Shouldn't happen, gather more info about it (see #873/919).
+ (let ((yas--fill-fun-values `((t ,(default-value
'yas--original-auto-fill-function))))
+ (fill-fun-values `((t ,(default-value 'auto-fill-function))))
+ ;; Listing 2 buffers with the same value is enough
+ (print-length 3))
+ (save-current-buffer
+ (dolist (buf (let ((bufs (buffer-list)))
+ ;; List the current buffer first.
+ (setq bufs (cons (current-buffer)
+ (remq (current-buffer) bufs)))))
+ (set-buffer buf)
+ (let* ((yf-cell (assq yas--original-auto-fill-function
+ yas--fill-fun-values))
+ (af-cell (assq auto-fill-function fill-fun-values)))
+ (when (local-variable-p 'yas--original-auto-fill-function)
+ (if yf-cell (setcdr yf-cell (cons buf (cdr yf-cell)))
+ (push (list yas--original-auto-fill-function buf)
yas--fill-fun-values)))
+ (when (local-variable-p 'auto-fill-function)
+ (if af-cell (setcdr af-cell (cons buf (cdr af-cell)))
+ (push (list auto-fill-function buf) fill-fun-values))))))
+ (lwarn '(yasnippet auto-fill bug) :error
+ "`yas--original-auto-fill-function' unexpectedly nil in %S!
Disabling auto-fill.
%S
`auto-fill-function': %S\n%s"
- (current-buffer) yas--fill-fun-values fill-fun-values
- (if (fboundp 'backtrace--print-frame)
- (with-output-to-string
- (mapc (lambda (frame)
- (apply #'backtrace--print-frame frame))
- yas--watch-auto-fill-backtrace))
- ""))
- ;; Try to avoid repeated triggering of this bug.
- (auto-fill-mode -1)
- ;; Don't pop up more than once in a session (still log
though).
- (defvar warning-suppress-types) ; `warnings' is autoloaded by
`lwarn'.
- (add-to-list 'warning-suppress-types '(yasnippet auto-fill
bug)))
- (funcall yas--original-auto-fill-function)))
+ (current-buffer) yas--fill-fun-values fill-fun-values
+ (if (fboundp 'backtrace--print-frame)
+ (with-output-to-string
+ (mapc (lambda (frame)
+ (apply #'backtrace--print-frame frame))
+ yas--watch-auto-fill-backtrace))
+ ""))
+ ;; Try to avoid repeated triggering of this bug.
+ (auto-fill-mode -1)
+ ;; Don't pop up more than once in a session (still log though).
+ (defvar warning-suppress-types) ; `warnings' is autoloaded by
`lwarn'.
+ (add-to-list 'warning-suppress-types '(yasnippet auto-fill bug)))))
(save-excursion
(setq end (progn (forward-paragraph) (point)))
(setq beg (progn (backward-paragraph) (point))))
@@ -4958,7 +4962,7 @@ When multiple expressions are found, only the last one
counts."
;; Don't pop up more than once in a session (still log though).
(defvar warning-suppress-types) ; `warnings' is autoloaded by `lwarn'.
(add-to-list 'warning-suppress-types '(yasnippet auto-fill bug)))
- (yas--do-todo-field-updates)
+ (yas--do-todo-snippet-indent)
(condition-case err
(progn (yas--finish-moving-snippets)
(cond ((eq 'undo this-command)
- [elpa] master 55c448b 32/42: Remove redundant arg to yas-expand-snippet, (continued)
- [elpa] master 55c448b 32/42: Remove redundant arg to yas-expand-snippet, Noam Postavsky, 2019/12/22
- [elpa] master 189f737 26/42: * doc/faq.org: Note that Flyspell problem is (now fixed) Emacs bug., Noam Postavsky, 2019/12/22
- [elpa] master ffce236 30/42: Do auto indentation only in post command hook, Noam Postavsky, 2019/12/22
- [elpa] master 760f77a 12/42: Test for mirroring more than one field, Noam Postavsky, 2019/12/22
- [elpa] master 0f05a75 14/42: Add yas-completing-read, Noam Postavsky, 2019/12/22
- [elpa] master 03aa561 19/42: * doc/snippet-organization.org: Fix typo., Noam Postavsky, 2019/12/22
- [elpa] master 9f51cf2 17/42: Register snippet movement comments for eldoc, Noam Postavsky, 2019/12/22
- [elpa] master 6a738b5 29/42: ; doc/faq.org: Fix example keybinding code., Noam Postavsky, 2019/12/22
- [elpa] master 476bc77 35/42: Fix snippet undo, Noam Postavsky, 2019/12/22
- [elpa] master c432e78 31/42: Fix field adjustment on deletion, Noam Postavsky, 2019/12/22
- [elpa] master f056a4d 33/42: Minor code shuffling and commenting,
Noam Postavsky <=
- [elpa] master bd3572a 36/42: Handle multiple uses of yas-auto-next, Noam Postavsky, 2019/12/22
- [elpa] master e45e3de 34/42: * doc/faq.org: yas-prev should be yas-prev-field, Noam Postavsky, 2019/12/22
- [elpa] master a66f15e 38/42: Fix yas-insert-snippet for keyless snippets, Noam Postavsky, 2019/12/22
- [elpa] master d91dd66 37/42: * yasnippet.el (yas--extra-modes): Move alias before def, Noam Postavsky, 2019/12/22
- [elpa] master 1bee3a3 39/42: Fix #979: grok curly braces with LSP-style escaping, Noam Postavsky, 2019/12/22
- [elpa] master 3bf9a3b 41/42: Release 0.14.0, Noam Postavsky, 2019/12/22
- [elpa] master 4046f61 40/42: * yasnippet.el (yas-field-highlight-face): Remove redundant quote., Noam Postavsky, 2019/12/22
- [elpa] master 32f3512 42/42: * packages/yasnippet: Merge 0.14.0 from upstream., Noam Postavsky, 2019/12/22