branch: externals/auctex
commit 3b5cea28deb31ec53182d80cccadd40b103457a2
Author: Arash Esbati <[email protected]>
Commit: Arash Esbati <[email protected]>
Improve completion for \url between url.el and hyperref.el
* style/hyperref.el ("hyperref"): Comment the entry for "url"
since the completion is provided via url.el.
* style/url.el ("url"): Add a conditional to "url" in order to
check if hyperref.el is loaded and then supply the argument in
braces.
Also check for hyperref.el. before adding "url" to
`LaTeX-verbatim-macros-with-delims-local'.
---
style/hyperref.el | 5 +++--
style/url.el | 12 ++++++++++--
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/style/hyperref.el b/style/hyperref.el
index ade5494..5ee8b31 100644
--- a/style/hyperref.el
+++ b/style/hyperref.el
@@ -226,8 +226,9 @@
(TeX-add-symbols
'("hypersetup" (TeX-arg-key-val LaTeX-hyperref-package-options-list))
'("href" [ (TeX-arg-key-val LaTeX-hyperref-href-options) ] "URL" "Text")
- ;; Supply dummy arg `ignore' to override the entry in url.el.
- '("url" "URL" ignore)
+ ;; Completion for \url is provided via url.el. Hence the entry in
+ ;; this style is commented:
+ ;; '("url" "URL" ignore)
'("nolinkurl" t)
'("hyperbaseurl" t)
'("hyperimage" "Image URL" "Text")
diff --git a/style/url.el b/style/url.el
index 24d9441..1f856af 100644
--- a/style/url.el
+++ b/style/url.el
@@ -56,12 +56,20 @@
"UrlRight"
"UrlSpecials"
'("path" (TeX-arg-verb-delim-or-brace "Path"))
- '("url" (TeX-arg-verb-delim-or-brace "Url"))
+ ;; "hyperref" redefines \url so that the argument is only in
+ ;; braces. We check here if hyperref is loaded:
+ '("url" (TeX-arg-conditional (member "hyperref" (TeX-style-list))
+ ("Url")
+ ((TeX-arg-verb-delim-or-brace "Url"))))
"urldef"
'("urlstyle" TeX-arg-urlstyle))
(add-to-list 'LaTeX-verbatim-macros-with-delims-local "path")
- (add-to-list 'LaTeX-verbatim-macros-with-delims-local "url")
+ ;; hyperref.el has some code to remove "url" from
+ ;; `LaTeX-verbatim-macros-with-delims-local', but we check here as
+ ;; well if "hyperref" is already loaded:
+ (unless (member "hyperref" (TeX-style-list))
+ (add-to-list 'LaTeX-verbatim-macros-with-delims-local "url"))
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "path")
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "url")