Re: How to access vile variables in : command?
On Wed, Nov 08, 2023 at 06:30:21PM -0500, Thomas Dickey wrote: > On Wed, Nov 08, 2023 at 03:51:37PM +, 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 "!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 > Thank you, I suspected there might be some way like this but just couldn't see it. That gives me lots of handles for getting what I want. -- Chris Green
Re: How to access vile variables in : command?
On Thu, Nov 09, 2023 at 09:53:27AM +1100, Brendan O'Dea wrote: > On Thu, 9 Nov 2023 at 02:52, 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? > > > Not sure about variables in general, but you should be able to use % > for the current filename here (and # for the alternate filename). > Of course, lateral thinking required, works a treat, thank you! -- Chris Green
Re: How to access vile variables in : command?
On Wed, Nov 08, 2023 at 03:51:37PM +, 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 "!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 https://invisible-island.net signature.asc Description: PGP signature
Re: How to access vile variables in : command?
Not sure about variables in general, but you should be able to use % for the current filename here (and # for the alternate filename). On Thu, 9 Nov 2023 at 02:52, 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? > > > -- > Chris Green >
How to access vile variables in : command?
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? -- Chris Green