Skip to content

Commit 41c6e12

Browse files
authored
Skip string-fence syntax class in meow--{inner,bounds}-of-string (#318)
This fixes bounds/inner for python triple quoted docstrings, as well as regular strings in nix-mode.
1 parent eebb792 commit 41c6e12

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

meow-thing.el

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
(goto-char (cl-decf beg))))
3838
(cons beg end)))))
3939

40-
(defun meow--bounds-of-string ()
40+
(defun meow--bounds-of-string-1 ()
4141
"Return the bounds of the string under the cursor.
4242
4343
The thing `string' is not available in Emacs 27.'"
@@ -58,20 +58,23 @@ The thing `string' is not available in Emacs 27.'"
5858
(defun meow--inner-of-symbol ()
5959
(bounds-of-thing-at-point 'symbol))
6060

61-
(defun meow--inner-of-string ()
62-
(when-let (bounds (meow--bounds-of-string))
61+
(defun meow--bounds-of-string (&optional inner)
62+
(when-let (bounds (meow--bounds-of-string-1))
6363
(let ((beg (car bounds))
6464
(end (cdr bounds)))
6565
(cons
6666
(save-mark-and-excursion
6767
(goto-char beg)
68-
(skip-syntax-forward "\"")
68+
(funcall (if inner #'skip-syntax-forward #'skip-syntax-backward) "\"|")
6969
(point))
7070
(save-mark-and-excursion
7171
(goto-char end)
72-
(skip-syntax-backward "\"")
72+
(funcall (if inner #'skip-syntax-backward #'skip-syntax-forward) "\"|")
7373
(point))))))
7474

75+
(defun meow--inner-of-string ()
76+
(meow--bounds-of-string t))
77+
7578
(defun meow--inner-of-window ()
7679
(cons (window-start) (window-end)))
7780

0 commit comments

Comments
 (0)