Prevent load-file-name/#$ replacements in strings & comments
This commit is contained in:
parent
b332a923a5
commit
8dab8eefca
1 changed files with 7 additions and 6 deletions
|
@ -315,13 +315,14 @@ them,and remove unnecessary `provide' statements or blank links."
|
||||||
(insert-file-contents-literally file)
|
(insert-file-contents-literally file)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(while (re-search-forward "\\(?:\\_<load-file-name\\|#\\$\\)\\_>" nil t)
|
(while (re-search-forward "\\(?:\\_<load-file-name\\|#\\$\\)\\_>" nil t)
|
||||||
;; Set `load-file-name' so that the contents of autoloads
|
;; `load-file-name' is meaningless in a concatenated
|
||||||
;; files can pretend they're in the file they're expected to
|
;; mega-autoloads file, so we replace references to it and #$ with
|
||||||
;; be in, rather than `doom-package-autoload-file'.
|
;; the file they came from.
|
||||||
(replace-match (prin1-to-string (abbreviate-file-name file))
|
(unless (doom-point-in-string-or-comment-p)
|
||||||
t t)))
|
(replace-match (prin1-to-string (abbreviate-file-name file))
|
||||||
|
t t))))
|
||||||
(while (re-search-forward "^\\(?:;;\\(.*\n\\)\\|\n\\|(provide '[^\n]+\\)" nil t)
|
(while (re-search-forward "^\\(?:;;\\(.*\n\\)\\|\n\\|(provide '[^\n]+\\)" nil t)
|
||||||
(unless (nth 8 (syntax-ppss))
|
(unless (doom-point-in-string-p)
|
||||||
(replace-match "" t t)))
|
(replace-match "" t t)))
|
||||||
(unless (bolp) (insert "\n")))))))
|
(unless (bolp) (insert "\n")))))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue