preserves-looking-at-syntax-p

This commit is contained in:
Tony Garnock-Jones 2019-04-25 19:47:58 +01:00
parent 5de9e31bdb
commit 328f82acbc
1 changed files with 6 additions and 2 deletions

View File

@ -91,11 +91,15 @@
(skip-syntax-backward " ")
(eq (char-before) ?\\)))))
(defun preserves-looking-at-syntax-p (ch)
(let ((ch-here (char-after)))
(and ch-here (eq (char-syntax ch-here) ch))))
(defun preserves-hanging-paren-p ()
(save-excursion
(forward-char)
(while (and (not (eq (char-after) ?\n))
(eq (char-syntax (char-after)) ?\s))
(preserves-looking-at-syntax-p ?\s))
(forward-char))
(eolp)))
@ -104,7 +108,7 @@
(save-excursion
(beginning-of-line)
(skip-syntax-forward " ")
(let* ((at-close-paren (eq (char-syntax (char-after)) ?\)))
(let* ((at-close-paren (preserves-looking-at-syntax-p ?\)))
(ppss (syntax-ppss)))
(cond
((cadddr ppss) nil) ;; when we are in a string, don't reindent