Re: custom braced names for filename and syntax

Benno Schulenberg <[email protected]> Wed, 19 Nov 2025 12:21:17 +0100
Newsgroups gmane.editors.nano.devel
Message-ID <[email protected]>
Op 19-11-2025 om 10:56 schreef Luca Coraggio:
> I attach a modified version of your patch to make {filename} return the full
> file path (adding a single line to the paste_filename function in prompt.c).

In theory, get_full_path() can return NULL.  When it does, then your version
will crash nano when {filename} is used.

[While trying to get get_full_path() to actually return NULL, I found an error
in its logic.  Fixed in git, commit 3b983dd8.  So thank you for that.  :) ]

> This would result in cumbersome checks for the user in external scripts
> (e.g. let the script check if the {filename} contains a full path or
> otherwise print the working directory and attach it to the filename).

Checking whether a filename is absolute or relative is hardly cumbersome:
just check whether it starts with a slash or not.  If not, prepend $(pwd)
-- it doesn't matter if the relative name begins with ./ or ../, Linux
will handle that just fine.


> What do you think about it?
I have no plans to include the patch in nano.  So you can customize nano
any way that you like.


Benno
OpenPGP_signature.asc (application/pgp-signature, 840 B)
-----BEGIN PGP SIGNATURE-----

wsF5BAABCAAjFiEEFo5vQpe/16ea/USWUUu+Lrjhlh8FAmkdqC0FAwAAAAAACgkQUUu+Lrjhlh8E
cw/6AzVgzxrw//Hr0SPaULY0VAzxLgUGCtH1uvKN36zzNyROsDTzr3WBpjFRhUoJSeyF3hy1nsI/
ELWTZM780r45N/nOWrZ9BYAGZWMn2/H/fGUMV9rEYZ6+vAXYuqVNJ3DFZya/eAdSCoRuiJ6rPRzC
P5hSWhNIm4raEm2jdo9YdcFjZ4mJ1CJKNovr3UJXg64y6/+VTdAshunQY+XA5yotUE4z8hhOHvp+
XrfSNS94qBnhHOmkeLJTgQjVQAW2QNWc2JXdHUF9qSLO4RprWi3TH6fVoo7wnseCeddweN6Ck3Xc
GngyWmqgh5mH3Emcw05BeChMdGCREvgDp1KLUa5MkwgTSUk7kLx+KLdyxXLHYPHLdtnIkzbkyxwB
9oDiyrGGaIYsPjHlPpbJZNhcVJhYPCuxa+iZDznY+4OFZW0Yqfy0Hq4ciPh22aO9uGQBpXJwwHYz
xIxgNEPsYzzVjF45e2vI0rCwBVaYc7C3X3nrHkVEj1M6olWCafrDQGTt2tvEOujHGZ3YUUh36Ih5
Msyu4uhEoZqTHRJEJxrVj0osgQtO6QQlGL7pMbZejS7Eq/mrdSWVY2IRZcMsYaJMk06Cp//PbY4j
43YhSWok4zyjmIv1YXGOmHVa+z9pIpy8Os1pphjVVcS4E4HjH5ShOhFtiIZesXpunFYVp/enZgRV
46w=
=+pjk
-----END PGP SIGNATURE-----