On Wed, Nov 08, 2023 at 03:51:37PM +0000, Chris Green wrote: > I'm sure this should be obvious but at the moment it's not obvious to > me! :-) > > I want to do something like the following:- > > map #9 :e `pdf $cfilname`^M > > However the above doesn't work, $cfilname is null in the above > context. How can I get the current file's name in this sort of place?
rather than map, doing a bind (to a stored macro) would work. #9 is treated as function-key 9, and by default is bound to the name execute-macro-9 (seen using describe-key): "execute-macro-9" #-9 untested (does pdf echo the name of the file? - I checked with just "echo"), but to give some idea how to organize it: 9 store-macro " make a buffer to get the output of pdf kill-buffer pdf-output edit-file &cat "!pdf " $pathname rename-buffer pdf-output " cursor is at the beginning of the line; open that file find-file $pathname " dispose of the temporary buffer kill-buffer pdf-output ~endm -- Thomas E. Dickey <dic...@invisible-island.net> https://invisible-island.net
signature.asc
Description: PGP signature