[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Possible new feature: Use insert to try to insert file on current bu
From: |
Benno Schulenberg |
Subject: |
Re: Possible new feature: Use insert to try to insert file on current buffer |
Date: |
Fri, 15 May 2020 17:01:51 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
Op 14-05-2020 om 21:17 schreef Marco Diego Aurélio Mesquita:
> I have some macros
What do you mean with "macros"? String binds? Because nano can
have at most one macro defined.
> that use external tools to add text to the current
> buffer on the current cursor position. Also, it is very common for me
> to open files on new buffers. Once I open a file on a new buffer, my
> macros suddenly stop working because the output of the external tool
> will go to a new buffer instead of the current one.
Yes, it would have been better if M-F (and M-N) were one-time toggles,
having effect only during the current invocation of ^R and forgotten
the next time -- just like M-B is in the ^W menu. Maybe they should
be made to work that way?
> Considering the pressing Ins is already redundant because it has the
> same effect of pressing ^R, I wrote the attached small patch.
Are you using this patch yourself? If yes, how long have you been
running with it?
> With it
> applied, when Ins is pressed, it will try to insert on the current
> buffer independent of the current state of the MULTIBUFFER flag.
> Changes when in this "mode" are also ignored so that it will not mess
> with the value of the MULTIBUFFER flag.
>
> Please consider applying it.
>
>
> Date: Thu, 7 May 2020 15:03:34 -0300
> Subject: [PATCH] Ignore ISSET(MULTIBUFFER) when "Ins" is pressed.
The style of nano's headerlines in git is: a word followed by a colon,
followed by a sentence without a period. The sentence tries to speak
the language of the user, not of the code. How can I take your patches
seriously if even after twenty patches you still don't know how to
format a subject line of patch?
> Content-Transfer-Encoding: 8bit
Where is the commit message? How could I even consider applying it?
> +/* Insert a file but trying to do it in the current buffer first. */
"trying"?
> +void do_inserthere_void(void)
The name is not good. I tend to read it as "do inser there",
and the "_void" is superfluous.
> + bool was_set = ISSET(MULTIBUFFER);
In general: a blank line after declarations.
> + if (was_set)
> + TOGGLE(MULTIBUFFER);
Instead of TOGGLE() I would use UNSET().
Then it's clearer what the effect is.
> + if (ISSET(MULTIBUFFER) != was_set)
> + TOGGLE(MULTIBUFFER);
Your logic is strange. Why not simply:
if (was_set)
SET(MULTIBUFFER);
If the patch were to be applied, it would also need a
bindable function, and documentation. But currently
I'm not inclined to apply it.
Benno
signature.asc
Description: OpenPGP digital signature
- Possible new feature: Use insert to try to insert file on current buffer, Marco Diego Aurélio Mesquita, 2020/05/14
- Re: Possible new feature: Use insert to try to insert file on current buffer,
Benno Schulenberg <=
- Re: Possible new feature: Use insert to try to insert file on current buffer, Marco Diego Aurélio Mesquita, 2020/05/16
- Re: Possible new feature: use 'openfile' to open new buffer, Benno Schulenberg, 2020/05/19
- Re: Possible new feature: use 'openfile' to open new buffer, Marco Diego Aurélio Mesquita, 2020/05/19
- Re: Possible new feature: use 'openfile' to open new buffer, Benno Schulenberg, 2020/05/21
- Re: Possible new feature: use 'openfile' to open new buffer, Marco Diego Aurélio Mesquita, 2020/05/21
- possible new bindable function: 'openfile', to open new buffer, Benno Schulenberg, 2020/05/28