Skip to content

Commit 4ba24ca

Browse files
LemonBreezesWilfred
authored andcommitted
Fix scan-sexps error for C-defined variables
1 parent a835b7e commit 4ba24ca

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

helpful.el

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,10 @@ If the source code cannot be found, return the sexp used."
12591259
;; function.
12601260
(progn
12611261
(setq pos (line-beginning-position))
1262-
(forward-list)
1262+
;; HACK Use the elisp syntax table even though the file is a
1263+
;; C file. This is a temporary workaround for issue #329.
1264+
(with-syntax-table emacs-lisp-mode-syntax-table
1265+
(forward-list))
12631266
(forward-char)
12641267
(narrow-to-region pos (point)))
12651268
;; Narrow to the top-level definition.

test/helpful-unit-test.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,12 @@ in."
782782
(should
783783
(s-starts-with-p "(defun " source))))
784784

785+
(ert-deftest helpful--source-c-fn ()
786+
(-let* (((buf pos _opened) (helpful--definition 'mode-line-format nil))
787+
(source (helpful--source 'mode-line-format nil buf pos)))
788+
(should
789+
(s-starts-with-p "DEFVAR" (s-trim-left source)))))
790+
785791
(ert-deftest helpful--source-autoloaded ()
786792
"We should include the autoload cookie."
787793
(-let* (((buf pos _opened) (helpful--definition #'helpful-at-point t))

0 commit comments

Comments
 (0)