Commit Graph

966 Commits (d3a8d81afb3cec2ad5b005aafa87586b5ef01bec)

Author SHA1 Message Date
Benno Schulenberg e16026eacd linter: beep when trying to go beyond first or last message 2019-12-15 16:15:54 +01:00
Benno Schulenberg 76d90617cc build: avoid three compiler warnings when using gcc-9.2 or newer
This addresses https://savannah.gnu.org/bugs/?57360.
Reported-by: Brand Huntsman <alpha@qzx.com>
2019-12-08 11:27:06 +01:00
Benno Schulenberg f516cddce7 build: fix compilation on macOS, where 'st_mtim' is unknown
This fixes https://savannah.gnu.org/bugs/?57367.
Reported-by: Bo Anderson <bo@toxicflames.co.uk>
Tested-by: Bo Anderson <bo@toxicflames.co.uk>
2019-12-06 12:19:32 +01:00
Benno Schulenberg ec569b4bd0 tweaks: rename a variable, to be a bit more fitting 2019-11-27 11:58:40 +01:00
Benno Schulenberg 4d77e0adbb speller: prefer 'hunspell' over 'spell', because it can handle UTF-8
Also, 'hunspell' is sensitive to the 'LANG' environment variable,
so that spell checking will take place for the language that the
user is using, instead of always for English.  (This is a behavior
change, and some people may not like it, expecting the spell check
to occur always for English, but... we'll see.)
2019-11-25 16:57:04 +01:00
Benno Schulenberg 576502a5c5 speller: when 'spell' is not found, try running 'hunspell -l' instead
This increases the chances that spell checking will work out of the box,
without any extra installing or configuration.

This addresses https://savannah.gnu.org/bugs/?57296.
2019-11-24 12:12:38 +01:00
Benno Schulenberg c60d3bbb97 tweaks: don't do in the parent something that only the child needs 2019-11-17 08:20:32 +01:00
Benno Schulenberg 90d4b51837 tweaks: group the closing of two descriptors, and reword two comments 2019-11-17 08:15:52 +01:00
Benno Schulenberg 432388b23e tweaks: add two translator hints
And unmark two identical strings, to cause the marked ones to sit
next to each other in the POT file.
2019-10-27 16:30:50 +01:00
Benno Schulenberg bad618e537 tweaks: harmonize a message with another 2019-10-27 16:19:45 +01:00
Benno Schulenberg 7ae305fdc0 tweaks: group the closing of descriptors together, for compactness 2019-10-27 10:40:09 +01:00
Benno Schulenberg 7d4f279c04 tweaks: close the unused reading ends of two more output pipes
It is done for 'spell', so do it also for 'sort' and 'uniq'.
2019-10-27 10:34:12 +01:00
Benno Schulenberg f230c46e5e tweaks: drop the unneeded closing of descriptors when exiting anyway
Also, when something goes wrong in the later stages of the pipeline,
the error code would try to close descriptors that are already closed,
which is not right.  So, just let exit() handle any file descriptors
that are still open.
2019-10-27 10:25:37 +01:00
Benno Schulenberg bc5a225678 tweaks: improve some comments, and trim some repetitive ones 2019-10-27 10:10:03 +01:00
Benno Schulenberg 493b334ebb tweaks: mark two strings for translation
The marking was accidentally lost two weeks ago in commit d12191db.
2019-10-26 17:09:00 +02:00
Benno Schulenberg 7d54207627 tweaks: be explicit about which program complained 2019-10-26 12:04:10 +02:00
Benno Schulenberg 458933f09e tweaks: elide an unneeded and leaky function 2019-10-26 12:01:23 +02:00
Benno Schulenberg 2b49a19793 linter: report it as an error when running the linting program fails
When something goes wrong, nano should beep and the status bar should
use the error color (red by default).

This fixes https://savannah.gnu.org/bugs/?57116.
2019-10-26 11:52:53 +02:00
Benno Schulenberg fc716156a4 tweaks: correct a comment, and retype a variable 2019-10-26 11:18:38 +02:00
Benno Schulenberg 2b9f06194f formatter: don't let output from the program pollute the screen
Run the formatting program outside of curses mode, so that any output
(complaints) that it produces will be on the terminal after exiting
from nano -- at least on a terminal emulator, not on a Linux VT.

This also allows the formatter to be an interactive program.

The disadvantage is that the screen flickers when typing M-F.

This fixes https://savannah.gnu.org/bugs/?57104.
2019-10-25 19:23:24 +02:00
Benno Schulenberg 631defb8b2 tweaks: reword an undo/redo string that was overlooked during the rename 2019-10-25 19:21:17 +02:00
Benno Schulenberg a6dae403e6 formatter: accept the formatted result also upon a nonzero exit status
For a nonzero exit status of the formatting program, report on the
status bar that the program "complained", but read in the (probably)
reformatted text anyway -- it can be easily undone with M-U.  Only
report failure when the intended program could not be run.

This fixes https://savannah.gnu.org/bugs/?57105.
2019-10-25 17:45:52 +02:00
Benno Schulenberg 4281b6becb commands: rename 'fixer' to 'formatter', to be less misleading
The word "fixer" sounds too much as if the command would be able
to fix mistakes or correct errors.  Especially when seen next to
"linter", it sounds as if one does a syntax check and the other
fixes the found mistakes.  (Although the command might in theory
be used for this, it is not its intended purpose.)
2019-10-25 17:24:28 +02:00
Benno Schulenberg fa88fcc8f2 tweaks: rename a function, and elide a parameter that is always NULL
After the previous change, all remaining calls of parse_mbchar() have
NULL as their third parameter.  So, drop that parameter and remove the
chunk of code that handles it.  Also rename the function, as there are
already too many functions that start with "parse".
2019-10-21 12:35:14 +02:00
Benno Schulenberg c2d8641f01 chars: add a faster version of the character-parsing function
It elides a parameter that is always NULL, and elides two ifs
that always take the same path.
2019-10-21 12:24:23 +02:00
Benno Schulenberg 17c16a4bf5 tweaks: rename a function and elide its first parameter 2019-10-20 09:45:58 +02:00
Benno Schulenberg b4a5fac744 tweaks: use a literal NULL instead of a variable that is NULL
Now all calls of mallocstrncpy() have NULL as the first parameter
(apart from one call in utils.c, but that can be changed), so the
function can be simplified.
2019-10-20 09:45:58 +02:00
Benno Schulenberg 7c5b104859 tweaks: rename three variables, to match others elsewhere 2019-10-16 11:46:22 +02:00
Benno Schulenberg d8c03cd4cd tweaks: elide a variable, and add a condition to elide an assignment 2019-10-14 10:28:45 +02:00
Benno Schulenberg 1536a76ced tweaks: normalize the indentation after the previous change 2019-10-14 10:28:45 +02:00
Benno Schulenberg d2fb371fe2 feedback: say it when spell check or manipulation did not change anything 2019-10-14 10:28:45 +02:00
Benno Schulenberg 34170611d3 restored feature: a per-syntax 'fixer' command that processes the buffer
The command can be used to run some kind of formatter or corrector or
arranging tool on the buffer.  By default the command is bound to M-F.
The formatter/corrector/arranging program must be non-interactive.

This addresses https://savannah.gnu.org/bugs/?55365,
and addresses https://savannah.gnu.org/bugs/?54651.
2019-10-14 10:28:45 +02:00
Benno Schulenberg f551c07e7a tweaks: add some "fall-through" comments, and reshuffle some breaks 2019-10-13 17:35:57 +02:00
Benno Schulenberg 2656f543f4 undo: don't try to copy a string that doesn't exist
This fixes https://savannah.gnu.org/bugs/?57051.

Bug existed since commit d256d0cb from earlier today.
2019-10-13 17:31:53 +02:00
Benno Schulenberg d256d0cbc0 tweaks: add a helper function without the ubiquitous NULL argument
For conciseness and clarity.
2019-10-13 12:24:27 +02:00
Benno Schulenberg 0374708597 undo: put the cursor back on the original row for a full-buffer operation
When an operation that replaces the entire buffer is undone, the
position of the viewport is lost.  Compensate for this by storing
the row of the cursor in the undo item, and, after executing the
undo item, arranging the viewport so that the cursor is back on
the original row -- the row where the operation was invoked.

This fixes https://savannah.gnu.org/bugs/?57039.
2019-10-12 11:20:41 +02:00
Benno Schulenberg ad451933c6 tweaks: rename a function and add a parameter, so it becomes more general
Also adjust the comments and rename three variables.
2019-10-10 08:28:08 +02:00
Benno Schulenberg 222e67300e tweaks: reshuffle some declarations, and rename a variable 2019-10-10 08:23:16 +02:00
Benno Schulenberg d12191db5a tweaks: pass any special undo/redo messages to the add_undo() function
For the three operations (justification, spell checking, and filtering)
that need to undo or redo two suboperations (cutting and then pasting)
in one go, pass the message that describes the operation to add_undo(),
so that the undo item does not need to be modified after the call.

This looks better, but does add some twenty NULL parameters elsewhere.
2019-10-09 19:21:27 +02:00
Benno Schulenberg 785efc2087 tweaks: make a function do a check so its calls don't need to 2019-10-09 18:58:30 +02:00
Benno Schulenberg 01b840890d tweaks: rename another type, again to better fit the general pattern 2019-10-02 19:32:41 +02:00
Benno Schulenberg 9bd60e7d5d tweaks: frob a few comments 2019-10-02 17:46:20 +02:00
Benno Schulenberg c5e46101b1 tweaks: reshuffle some lines, to elide an unneeded assignment 2019-10-02 17:39:45 +02:00
Benno Schulenberg 53b77cb4c6 tweaks: rename another type, to also better fit the general pattern 2019-10-02 17:18:51 +02:00
Benno Schulenberg 3644d51b97 new feature: a 'tabgives' command to define what the Tab key produces
The 'tabgives' command is syntax-specific and should be followed by a
string containing the character(s) that a single press of the <Tab> key
should produce -- most likely a single TAB or a small bunch of spaces,
but any string is allowed.  This overrides the 'tabstospaces' option.

When one wants to make sure <Tab> inserts always four spaces and never
a TAB when editing a Python file, one could add to one's nanorc:

  extendsyntax python tabgives "    "

where there are four spaces between the quotes.  And when one wants
to ensure, when editing a Makefile, that <Tab> always inserts a TAB
and never spaces, independent of what tabstospaces is set to, one
could add to one's nanorc:

  extendsyntax makefile tabgives "	"

where there is a literal TAB character between the quotes.

This fulfills https://savannah.gnu.org/bugs/?53661,
Requested-by: Andrew Pennebaker <andrew.pennebaker@gmail.com>
And addresses https://savannah.gnu.org/bugs/?54760.
Requested-by: Henry van Megen <hvanmegen@gmail.com>
And addresses part of https://savannah.gnu.org/bugs/?54775.
Requested-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
2019-09-25 19:35:07 +02:00
Benno Schulenberg 4d44b03fc8 tweaks: rename a variable, to be more compact 2019-09-22 17:38:22 +02:00
Benno Schulenberg 2d16c27820 tweaks: add two hints for translators, to try and help avoid mistakes 2019-09-22 17:31:27 +02:00
Benno Schulenberg ab6390cad0 tweaks: remove two superfluous macros, as sizeof(char) is always 1 2019-09-18 15:20:08 +02:00
Benno Schulenberg 63e04ac31e tweaks: make a function name unique, to not overlap with others 2019-08-09 19:34:03 +02:00
Benno Schulenberg 0c63b50fdc tweaks: move a general function to a better place 2019-08-09 19:24:30 +02:00