nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] feature: 'backupdir' shell expansion


From: Mert Akengin
Subject: [patch] feature: 'backupdir' shell expansion
Date: Wed, 19 Feb 2020 23:01:20 +0000

Hi there.

Attached patch allows user to set 'backupdir' option 
with environment variables included/embedded.
(auto-substitution from shell/environment)

Eg: (nanorc example)

set backup
set backupdir "/tmp/$USER"

EOF

Saving files causes `/tmp/mert/!home!...` files to be created.
ps. Users can use both ${VAR} and $VAR forms

- RWDE_NOCMD option is used: no command execution
  [ via $(command) structure/syntax ]
- WRDE_UNDEF and WRDE_SHOWERR option causes error to be reported
  when an undefined variable comes up.
  [ which I did not handle yet :/ but see below. ]

of course directory must exist to start nano.
I am thinking of submitting follow-up patch to either (or all):

a) create directory/directories with `mkdir(3)`
b) just show error message at the bottom instead of failing.
c) handling of variable substitution errors.

ps(2). Also added _XOPEN_SOURCE macro checking for wordexp stuff.

If you guys see anything odd/wrong. Please do not hesistate to
reply/feedback. Since I am not very familiar with the process :)

ps(3). I am using Docker to build & test (on debian).

FROM debian:stable

RUN apt update
RUN apt install -y \
        git clang build-essential \
        automake autoconf autopoint \
        gettext pkg-config texinfo groff \
        libncursesw5-dev libslang2-dev

WORKDIR /data
COPY \
        ./m4 \
        ./po \
        ./doc \
        ./gnulib \
        ./syntax \
        ./autogen.sh \
        ./Makefile.am \
        ./configure.ac \
        ./nano.spec.in \
        ./
RUN ./autogen.sh

COPY ./src ./
RUN ./configure --enable-utf8
RUN make -C . -j $(nproc)
RUN make -C . -j $(nproc) install


Attachment: 0001-allow-shell-environment-variable-substitution-for-ba.patch
Description: 0001-allow-shell-environment-variable-substitution-for-ba.patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]