Tyler Smith
2016-09-14 15:31:45 UTC
Hi,
I'm trying to define a style hook for a personal macro that takes a file
name, without the extension, as an argument. From the manual, I think
this should be possible via the `TeX-arg-file` argument hook:
'TeX-arg-file'
Prompt for a filename in the current directory, and use it without
the extension.
My style file looks like this:
(TeX-add-style-hook
"cba"
(lambda ()
(TeX-add-symbols
'("ColumnFigure" ["caption"] TeX-arg-file)
'("ColumnPhoto" ["caption"] TeX-arg-file-name)
'("FullPhoto" ["caption"] TeX-arg-file-name-sans-extension)
'("featureAuthor" 1))))
The result is that \ColumnFigure prompts me for the caption, and
completes a file name, but the inserted file includes the extension. You
see I also tried 'TeX-arg-file-name', and
'TeX-arg-file-name-sans-extension', but those don't provide filename
completion, just a prompt. `TeX-arg-input-file` provides completion, but
only for items in TeX's search path, not the current directory.
Looking at the code for TeX-arg-file, neither the code or the doc string
indicate that the extension will be trimmed.
1) Is this a bug in the documentation?
2) Is there a way to prompt the user for an extension-less filename via
style hooks?
Thanks,
Tyler
I'm trying to define a style hook for a personal macro that takes a file
name, without the extension, as an argument. From the manual, I think
this should be possible via the `TeX-arg-file` argument hook:
'TeX-arg-file'
Prompt for a filename in the current directory, and use it without
the extension.
My style file looks like this:
(TeX-add-style-hook
"cba"
(lambda ()
(TeX-add-symbols
'("ColumnFigure" ["caption"] TeX-arg-file)
'("ColumnPhoto" ["caption"] TeX-arg-file-name)
'("FullPhoto" ["caption"] TeX-arg-file-name-sans-extension)
'("featureAuthor" 1))))
The result is that \ColumnFigure prompts me for the caption, and
completes a file name, but the inserted file includes the extension. You
see I also tried 'TeX-arg-file-name', and
'TeX-arg-file-name-sans-extension', but those don't provide filename
completion, just a prompt. `TeX-arg-input-file` provides completion, but
only for items in TeX's search path, not the current directory.
Looking at the code for TeX-arg-file, neither the code or the doc string
indicate that the extension will be trimmed.
1) Is this a bug in the documentation?
2) Is there a way to prompt the user for an extension-less filename via
style hooks?
Thanks,
Tyler
--
plantarum.ca
plantarum.ca