]> git.neil.brown.name Git - edlib.git/log
edlib.git
2 years agopython: remove stray edlib.LOG calls.
NeilBrown [Mon, 22 May 2023 11:14:40 +0000 (21:14 +1000)]
python: remove stray edlib.LOG calls.

There debugging calls got left in..

Signed-off-by: NeilBrown <neil@brown.name>
2 years agohandle text-fill in .md files better.
NeilBrown [Mon, 22 May 2023 10:53:47 +0000 (20:53 +1000)]
handle text-fill in .md files better.

Enhance text-fill so that various style attributes can be on the pane
rather than on the character, and set pane attributes for markdown to
notice the starts of various paragraph types, particularly the various
list entries.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agotextfile: copy prefix from most recent line.
NeilBrown [Mon, 22 May 2023 10:08:33 +0000 (20:08 +1000)]
textfile: copy prefix from most recent line.

When wrapping just the last line of a para, copy the prefix from that
line to the next.  This improves stability for ad-hoc formatting.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agonotmuch: include local-time as an extra header
NeilBrown [Mon, 22 May 2023 09:42:59 +0000 (19:42 +1000)]
notmuch: include local-time as an extra header

Determine timestamp in local time and add that as an extra header.
Also move thread-id to the end, so that all file names are together.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoncurses: fix transparent images in default color-space
NeilBrown [Mon, 22 May 2023 09:09:14 +0000 (19:09 +1000)]
ncurses: fix transparent images in default color-space

When fg/bg are the defaults, pair_content() doesn't provide us with
useful information, so we have to assume "white"-ish.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agosearch: avoid infinite look with inconsistent doc:step function.
NeilBrown [Mon, 22 May 2023 08:51:43 +0000 (18:51 +1000)]
search: avoid infinite look with inconsistent doc:step function.

If doc:step moves back further than we expect, search_backwards can loop
forever. So check for that possibility and abort.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoFix missed conversions from -2 to Efail.
NeilBrown [Mon, 22 May 2023 08:50:39 +0000 (18:50 +1000)]
Fix missed conversions from -2 to Efail.

When I changed from magic numbers to words, I missed this one.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoemail: support text display of some office docs.
NeilBrown [Sun, 21 May 2023 23:44:22 +0000 (09:44 +1000)]
email: support text display of some office docs.

 .doc  .docx  .odt

now get passed to lowriter for conversion to text.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agosearch: speed up backwards search.
NeilBrown [Sun, 14 May 2023 23:42:25 +0000 (09:42 +1000)]
search: speed up backwards search.

Rather stepping back one char at a time and attempting a match, step
back larger and larger numbers of chars, and search in that range.
Once we find, search forward for the last match.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorexel: add an 'advance' flag to turn on anchored search.
NeilBrown [Sun, 14 May 2023 09:12:44 +0000 (19:12 +1000)]
rexel: add an 'advance' flag to turn on anchored search.

If we want to find a match that *starts* before a given point but may
continue after that point, we cannot just stop when we reach the point,
but we must enable anchored-match when we do.

Introduce matching "anchor_at_end" flag in lib-search which used this
flag.
With anchor_at_end, the match must start by the end mark.
Without, it must be complete by the end mark.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-search: fix bug with matching a pattern that ends at point
NeilBrown [Sun, 21 May 2023 11:11:46 +0000 (21:11 +1000)]
lib-search: fix bug with matching a pattern that ends at point

Calling rxl_advance() is problematic as merging the two return code is
not trivial.
We really want all the flags that go before a given character to be
handled together.
So set a flag when we see the point, then set the RXL_POINT flag the
next time around.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorexel/c-mode/TODO: minor comment updates.
NeilBrown [Sun, 21 May 2023 11:06:38 +0000 (21:06 +1000)]
rexel/c-mode/TODO: minor comment updates.

Various minor non-code updates

Signed-off-by: NeilBrown <neil@brown.name>
2 years agocore: make it easy to disable timing when running under gdb.
NeilBrown [Sun, 21 May 2023 11:00:17 +0000 (21:00 +1000)]
core: make it easy to disable timing when running under gdb.

Under gdb, things don't happen fast, so we need to be able to disable
the "pane_too_long()" test.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorexel: store wctype values directly in rxl array
NeilBrown [Fri, 19 May 2023 06:36:50 +0000 (16:36 +1000)]
rexel: store wctype values directly in rxl array

Rather than having a static mapping from a 2-byte value stored in the
rxl array to an 8-byte wctype_t, store the wctype_t directly in the rxl
array, using as many entries as needed.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoTODO.md: clean up
NeilBrown [Wed, 17 May 2023 09:15:10 +0000 (19:15 +1000)]
TODO.md: clean up

Remove a bunch of 'done' things - including some that weren't even
marked as done.
And fix typos etc.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorexel: fix handling of sets for planes > 0
NeilBrown [Tue, 16 May 2023 21:15:19 +0000 (07:15 +1000)]
rexel: fix handling of sets for planes > 0

I wasn't including the plane number in the set size, or extracting and
using it.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorexel: support unicode beyond 0x7ffff
NeilBrown [Tue, 16 May 2023 09:37:14 +0000 (19:37 +1000)]
rexel: support unicode beyond 0x7ffff

The comment said we have to create a set for unicode beyond 15 bits, but
the code doesn't.
Instead reserve 17 code value to identify a unicode plane, and the next
'short' is combined to create a full unicode codepoint.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorexel: properly initialise ->link array
NeilBrown [Tue, 16 May 2023 21:08:12 +0000 (07:08 +1000)]
rexel: properly initialise ->link array

->link[x][0] wasn't being initialised.  I wonder how this ever works.
valgrind wonders why I never asked it before.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoTODO: move in a separate 'priorities' file.
NeilBrown [Mon, 15 May 2023 00:51:55 +0000 (10:51 +1000)]
TODO: move in a separate 'priorities' file.

For some reason I made a separate list of priorites a while ago.  Here
are the remaining one.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorexel: rename RXL_ANCHORED and RXL_BACKTRACK to RXLF_*
NeilBrown [Sun, 14 May 2023 09:02:11 +0000 (19:02 +1000)]
rexel: rename RXL_ANCHORED and RXL_BACKTRACK to RXLF_*

The RXL_ prefix is used for flags to both rxl_prepare() and
rxl_advance(), which might be confusing.
So change the prepare flags to RXLF_ - RXL flag.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agotext: normalize marks before passing to content callback
NeilBrown [Fri, 19 May 2023 01:29:50 +0000 (11:29 +1000)]
text: normalize marks before passing to content callback

The mark that we pass to the content call-back must be normalised - or
bad things happen.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodoc-text: text_check_consistent fixes
NeilBrown [Fri, 19 May 2023 01:28:39 +0000 (11:28 +1000)]
doc-text: text_check_consistent fixes

1/ Don't alter the document while checking - the "normalize" call must
  be on a local variable
2/ check for non-normalized marks when checking marks.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agotests: always specify EDLIB_RECORD with EDLIB_REPLAY
NeilBrown [Sat, 20 May 2023 00:47:12 +0000 (10:47 +1000)]
tests: always specify EDLIB_RECORD with EDLIB_REPLAY

'tests view' was behaving differently to other tests.  It seems to be
because EDLIB_RECORD was missing.  So let's add it.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoAvoid showing shell output when it requested an edit window
NeilBrown [Sat, 13 May 2023 02:13:07 +0000 (12:13 +1000)]
Avoid showing shell output when it requested an edit window

If a shell command is run which creates an edit window using lib-server,
we don't really want to show the output until the command completes.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoemacs: if shell command produces no output - say so.
NeilBrown [Sat, 13 May 2023 01:53:41 +0000 (11:53 +1000)]
emacs: if shell command produces no output - say so.

If a shell command exits quickly with no output, emacs mode currently
writes and empty string (the output) to the message line, which isn't a
lot of help.
Instead, write a message that the command did complete - and report any
exit code.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agonotmuch: simplify how 'new' tag is cleared
NeilBrown [Sat, 13 May 2023 01:39:43 +0000 (11:39 +1000)]
notmuch: simplify how 'new' tag is cleared

When the search view is explicitly closed with 'q', all new
threads/messages that have been listed get the 'new' tag cleared.
Any implicit close no longer does that.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorexel: add lax-searching for quotes.
NeilBrown [Sat, 13 May 2023 01:15:36 +0000 (11:15 +1000)]
rexel: add lax-searching for quotes.

In lax mode, all three ASCII quotes now much the same.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agonotmuch: handle display of alternatives that are multipart.
NeilBrown [Fri, 12 May 2023 09:10:19 +0000 (19:10 +1000)]
notmuch: handle display of alternatives that are multipart.

An alternative can be multipart, e.g. multipart/related.
In that case it won't be the last segment of the path which
says "alternative".  We have to look earlier.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agow3m: Hide all of multiline tag
NeilBrown [Thu, 11 May 2023 23:49:39 +0000 (09:49 +1000)]
w3m: Hide all of multiline tag

Previously we were not hiding the newline in a multiline tag, so it
would appear as blank lines.

Extend markup:not_eol to ignore eol when rendering forward as well as
when moving backward, and use it in w3m to completely hide things.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoemail: ensure text parts always provide characters.
NeilBrown [Thu, 11 May 2023 23:39:00 +0000 (09:39 +1000)]
email: ensure text parts always provide characters.

If a base64 part does not declare a charset, we don't provide one, so no
chars are available, only bytes.
This is fine for PDF which wants bytes, but bad for html.
So check for text and require some charset.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agow3m: reassert attrs at start of line properly
NeilBrown [Thu, 11 May 2023 04:42:48 +0000 (14:42 +1000)]
w3m: reassert attrs at start of line properly

The current code might reassert attrs inside the next tag.  We need to
find tags with no reference to line breaks, then look at newlines
between tags.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agow3m: hide all of a multi-line tag
NeilBrown [Thu, 11 May 2023 04:37:30 +0000 (14:37 +1000)]
w3m: hide all of a multi-line tag

If a tag contains line breaks, we need to reassert the "hide" attribute
on each line.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomarkup: fix normalisation of priorities.
NeilBrown [Thu, 11 May 2023 04:35:00 +0000 (14:35 +1000)]
markup: fix normalisation of priorities.

When I clipped priority to 0:65535, I didn't do it at all for
as_clear(), and not completely for as_add().

Signed-off-by: NeilBrown <neil@brown.name>
2 years agow3m: only mark up html entities between tag.
NeilBrown [Thu, 11 May 2023 01:02:08 +0000 (11:02 +1000)]
w3m: only mark up html entities between tag.

html entities inside tags need to be invisible, so we don't want to mark
them at all.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agow3m: support ALL html entities
NeilBrown [Tue, 9 May 2023 21:44:04 +0000 (07:44 +1000)]
w3m: support ALL html entities

WE now have a list of all HTML entities.
Also fix handling of &#NNN; where NNN is decimal.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agonotmuch/w3m: add more html entities
NeilBrown [Mon, 8 May 2023 11:43:15 +0000 (21:43 +1000)]
notmuch/w3m: add more html entities

Also ensure they get displayed...

Signed-off-by: NeilBrown <neil@brown.name>
2 years agonotmuch: avoid inconsistent value of thread_end
NeilBrown [Mon, 8 May 2023 09:48:49 +0000 (19:48 +1000)]
notmuch: avoid inconsistent value of thread_end

thread_end points to the start of the next thread after thread_start.
Changes to the document can insert another thread in between which
causes strange display.
So always recalc thread_next when the doc changes.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoTODO - remove everything that is marked as done.
NeilBrown [Sun, 7 May 2023 06:36:10 +0000 (16:36 +1000)]
TODO - remove everything that is marked as done.

ta-done

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoncurses: display low-res images
NeilBrown [Sun, 7 May 2023 06:11:19 +0000 (16:11 +1000)]
ncurses: display low-res images

Each character cell can be 2 pixel.  This allows low-res image display.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender: disable background images for text displays
NeilBrown [Sun, 7 May 2023 05:40:35 +0000 (15:40 +1000)]
render: disable background images for text displays

If scale:M isn't set, then we cannot usefully do background images, so
don't even try.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoncurses: manage color pair separately from attributes.
NeilBrown [Sun, 7 May 2023 05:15:05 +0000 (15:15 +1000)]
ncurses: manage color pair separately from attributes.

When we combine the color pair in to the attributes we are limited to
255 pairs.  However we can pass it in separately and get many
more.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomake: restore "replaceable" status for default search term
NeilBrown [Sun, 7 May 2023 02:00:00 +0000 (12:00 +1000)]
make: restore "replaceable" status for default search term

I find that I like the "replaceable" status... maybe it isn't so bad now
that the cursor is at the front.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agonotmuch: allow html even when we have plain text.
NeilBrown [Sun, 7 May 2023 01:49:48 +0000 (11:49 +1000)]
notmuch: allow html even when we have plain text.

Now that I have w3m doing a decent job of html display, use it in
preference to text/plain and see what I think.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoUse w3m to decode HTML in email messages
NeilBrown [Sun, 7 May 2023 01:45:16 +0000 (11:45 +1000)]
Use w3m to decode HTML in email messages

Use "w3m -halfdump" and parse out the remaining markup
to give bold and links etc.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoensure html decoding works over base64
NeilBrown [Sun, 7 May 2023 01:43:26 +0000 (11:43 +1000)]
ensure html decoding works over base64

b64 doesn't provide chars, just bytes.... Maybe it should get
a utf-8 overlay!!

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomarkup: allow text to be inserted into rendering
NeilBrown [Sun, 7 May 2023 01:03:20 +0000 (11:03 +1000)]
markup: allow text to be inserted into rendering

If str2 is given to the map-attr callback, it is inserted.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agonotmuch: allow urls to be extracted from part of a multipath
NeilBrown [Sun, 7 May 2023 00:21:49 +0000 (10:21 +1000)]
notmuch: allow urls to be extracted from part of a multipath

The url might be tagged in just one part - so allow for that.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agonotmuch message-view: improve url attributes.
NeilBrown [Sat, 6 May 2023 23:45:33 +0000 (09:45 +1000)]
notmuch message-view: improve url attributes.

Rather than storing the URL as an attribute of the first char of the
URL, store it as an attribute of the pane, indexed by a tag. This tag
is stored in the render:url attribute instead of a length.
This avoid the need to search backwards for the char with the url
attribute, we can access it directly instead.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorenderline: fix spelling of upscale
NeilBrown [Sat, 6 May 2023 23:19:14 +0000 (09:19 +1000)]
renderline: fix spelling of upscale

A recent patch broke it...

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomarkup: implement "hide" attribute
NeilBrown [Sat, 6 May 2023 23:15:45 +0000 (09:15 +1000)]
markup: implement "hide" attribute

text with attribute "hide" is not rendered at all.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomarkup: make "priority" unsigned.
NeilBrown [Sat, 6 May 2023 23:14:18 +0000 (09:14 +1000)]
markup: make "priority" unsigned.

"priority" is now an unsigned short and the behaviour of integers
outside that range is sensible and documented.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoemail: cause images to behave as 3 lines with 3 char positions each.
NeilBrown [Sat, 29 Apr 2023 10:14:26 +0000 (20:14 +1000)]
email: cause images to behave as 3 lines with 3 char positions each.

This allows the cursor to move around the image without jumping the
whole image all at once.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: initial support for multi-line renders.
NeilBrown [Sat, 29 Apr 2023 10:11:44 +0000 (20:11 +1000)]
render-lines: initial support for multi-line renders.

An image will soon appear as multiple lines so that the cursor can
appear at locations within it.

Moving down always goes to start of line.  Moving up goes to top of
image.
These aren't ideal, but better than nothing for now.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: don't set reposition needlessly.
NeilBrown [Sat, 29 Apr 2023 09:57:29 +0000 (19:57 +1000)]
render-lines: don't set reposition needlessly.

If render_prev finds a new first mark we need to set reposition, but if
it is the same first mark as already existed, we don't.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: minor clean up.
NeilBrown [Sat, 29 Apr 2023 04:32:30 +0000 (14:32 +1000)]
render-lines: minor clean up.

1/ Ensure call_render_line_prev() *always* frees m
   if it doesn't return it.

2/ Use gotos to make code easier to follow when render_lines_move_line
   tried to find the target x column.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: allow <image> to have map: attribute.
NeilBrown [Fri, 28 Apr 2023 23:52:41 +0000 (09:52 +1000)]
lib-renderline: allow <image> to have map: attribute.

A "map" helps place the cursor within an image.  The map provides both a
number of rows and columns, and a collection of the characters in the
rendering which can be used to communicate where the cursor is.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: fold more core into render_image()
NeilBrown [Fri, 28 Apr 2023 23:43:20 +0000 (09:43 +1000)]
lib-renderline: fold more core into render_image()

setting line height and cursor pos now happens inside render_image().

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-markup: allow eol chars to be skipped.
NeilBrown [Fri, 28 Apr 2023 23:30:48 +0000 (09:30 +1000)]
lib-markup: allow eol chars to be skipped.

When rendering, lib-markup can be told to use some other function for
line via the markup:func attribute.  This can easily included eol chars
in the range being rendered.

However when moving backwards with doc:render-line-prev there is not
currently a way to skip over some eol chars.

So introduce a mark:not_eol text attributes which can be applied to eol
characters to cause lib-markup to ignore them.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoRemove any suggestion that num2 is significant for doc:render-line
NeilBrown [Fri, 28 Apr 2023 23:29:20 +0000 (09:29 +1000)]
Remove any suggestion that num2 is significant for doc:render-line

render-line does doesn't use num2, only 'num'.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoDraw:image: allow a cursor to be displayed
NeilBrown [Fri, 28 Apr 2023 23:18:20 +0000 (09:18 +1000)]
Draw:image: allow a cursor to be displayed

A cursor is (expected to be) a rectangular outline around a cell of the
image when considered as a matrix of a given number of rows and columns.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoChange numeric args to Draw:image
NeilBrown [Fri, 28 Apr 2023 23:05:59 +0000 (09:05 +1000)]
Change numeric args to Draw:image

'num' now combine both the "Stretch" flag and the various alignment
flags.
This leaves num2 open for other purposes.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorenderline: always cache the measured size of the image
NeilBrown [Tue, 25 Apr 2023 06:09:41 +0000 (16:09 +1000)]
renderline: always cache the measured size of the image

Knowing the size of the image can be generally useful so keep track of
it.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agonotmuch: only search 10,000 chars for urls
NeilBrown [Tue, 25 Apr 2023 00:42:59 +0000 (10:42 +1000)]
notmuch: only search 10,000 chars for urls

Searching 50,000 takes too long - particularly over base64.
So drop down to 10,000 to avoid triggering the 15-second timeout.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoAdd a TODO for w3m
NeilBrown [Wed, 26 Apr 2023 03:58:20 +0000 (13:58 +1000)]
Add a TODO for w3m

Want w3m for html email..

Signed-off-by: NeilBrown <neil@brown.name>
2 years agopython: silence a warning
NeilBrown [Tue, 25 Apr 2023 00:18:42 +0000 (10:18 +1000)]
python: silence a warning

smatch doesn't know 'a' cannot be NULL, so tell it.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolang-python: update initialisation.
NeilBrown [Mon, 24 Apr 2023 23:44:59 +0000 (09:44 +1000)]
lang-python: update initialisation.

Py_SetProgramName and PySys_SetArgv are deprecated, so use
PyConfig to avoid warnings.
Also enable "isolated" initialisation to see if it is a bad idea or not.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoAbort more quickly when time is up.
NeilBrown [Mon, 24 Apr 2023 23:30:54 +0000 (09:30 +1000)]
Abort more quickly when time is up.

After 15 seconds in one command we want to abort to avoid
infinite loops.  However doc:content calls don't get
caught currently because the call to the handler
doesn't go through key_handle().
So add a light-weight test in the call.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomultipart: Set ref mark to NULL when freeing it
NeilBrown [Thu, 20 Apr 2023 22:24:01 +0000 (08:24 +1000)]
multipart: Set ref mark to NULL when freeing it

We usually store a new value in ref.m after freeing this one, but it
possible for that to fail.
So for safety, set to NULL rather than leaving an invalid mark pointer.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoemail/notmuch: attend or a disposition of "attachment"
NeilBrown [Thu, 20 Apr 2023 22:21:36 +0000 (08:21 +1000)]
email/notmuch: attend or a disposition of "attachment"

Keep track of content disposition and if it claims "attachment" then:

 1/ don't highlight URLs etc
 2/ don't make visible by default - even when plain text

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoMake: change how default_arg in added.
NeilBrown [Thu, 20 Apr 2023 22:12:27 +0000 (08:12 +1000)]
Make: change how default_arg in added.

We currently make the default arg 'replacable' so that typing any text
replaces it.  This is sometimes useful, but sometime awkward.
1/ It is clumsy to edit the arg - you need to abort the 'replaceable'
   state first
2/ it doesn't help with added option e.g. to grep.

So don't make it 'replaceable' but instead place the cursor before the
text.  Then it is easy to insert options or edit the text, and replacing
it is as simple as ctrl-K.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoAlways normalise paths returned by find-file.
NeilBrown [Wed, 29 Mar 2023 22:25:18 +0000 (09:25 +1100)]
Always normalise paths returned by find-file.

The "~" prefix is useful when entering a file name, but it need to be
removed before the name is used.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch: change wrapping of subjects
NeilBrown [Thu, 23 Mar 2023 05:47:28 +0000 (16:47 +1100)]
notmuch: change wrapping of subjects

If the subject in the message summary needs to be wrapped, wrap it ALL
onto the next line.  This makes long subjects easier to read.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch: show all filenames in extended headers
NeilBrown [Wed, 22 Feb 2023 23:44:54 +0000 (10:44 +1100)]
notmuch: show all filenames in extended headers

As a message can be found in multiple files, and as notmuch knows them
all, add the complete list to the extended headers.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch/email: allow extra headers to be shown.
NeilBrown [Sun, 19 Feb 2023 21:41:34 +0000 (08:41 +1100)]
notmuch/email: allow extra headers to be shown.

When viewing an email, it can be useful to be some extra headers without
having to look through the complete raw headers.

There is also information that notmuch knows which doesn't exist in the
headers.

So add an "extras" button which causes both doc-email and notmuch to add
extra headers that might be interesting.
 Message-ID
 In-Reply-To
 References
 Filename
 Thread-ID

Signed-off-by: NeilBrown <neil@brown.name>
3 years agomake: allow a config item to say "all direct below".
NeilBrown [Wed, 15 Feb 2023 09:36:12 +0000 (20:36 +1100)]
make: allow a config item to say "all direct below".

make:$MODE config can now be found in a dir with a trailing '/'.
e.g. /home/kernels/

This means that it applies to all subdirs.  So "make" etc will be run in
/home/kernels/foo, not in /home/kernels/

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoemail: add "Reply-to" to standard headers
NeilBrown [Wed, 15 Feb 2023 04:35:01 +0000 (15:35 +1100)]
email: add "Reply-to" to standard headers

I probably should make this list of headers configurable.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agopython: handle bad utf-8 in string conversion.
NeilBrown [Wed, 15 Feb 2023 02:50:48 +0000 (13:50 +1100)]
python: handle bad utf-8 in string conversion.

If a string contains bad utf-8, treat it as 8bit ascii.

Also handle failure from python_string() correctly.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch: don't leave un-waited processes.
NeilBrown [Wed, 15 Feb 2023 02:41:14 +0000 (13:41 +1100)]
notmuch: don't leave un-waited processes.

If a timeout expires, kill the process and wait for it.  Don't just
leave it there.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoconfig: add some make defaults for my /home/kernels dir
NeilBrown [Wed, 15 Feb 2023 01:06:51 +0000 (12:06 +1100)]
config: add some make defaults for my /home/kernels dir

I really should move this config file into $HOME/.config ...

Signed-off-by: NeilBrown <neil@brown.name>
3 years agolinefilter: restore damage for doc:replace
NeilBrown [Wed, 15 Feb 2023 00:59:01 +0000 (11:59 +1100)]
linefilter: restore damage for doc:replace

When a change is made we need to reassess if anything is left.
But for view:changed we don't seem to need the damage.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch: when toggling visibility, ensure to move point.
NeilBrown [Sun, 5 Feb 2023 20:50:04 +0000 (07:50 +1100)]
notmuch: when toggling visibility, ensure to move point.

When a Mouse-Activate message arrives, the mark is not the point, so
moving it to the previous part is pointless.  Find the mark and move it.

Also do this whenever visibility changes at all.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoemail: introduce doc:email-step-part
NeilBrown [Sun, 5 Feb 2023 20:46:17 +0000 (07:46 +1100)]
email: introduce doc:email-step-part

doc:email-step-part is like doc:step-part provided by multipath, but it
limits the stepping to visible parts.

Using this for notmuch email viewer when changing the visibilty of a part.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoemacs: don't create empty selection when clicking.
NeilBrown [Sun, 5 Feb 2023 20:43:25 +0000 (07:43 +1100)]
emacs: don't create empty selection when clicking.

When not selection words or line, and when the pointer didn't move,
there cannot be a selection, so don't leave the selection enabled.
Otherwise it can suddenly appear sometimes.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agomultipath: don't step back before the first visible part.
NeilBrown [Sun, 5 Feb 2023 20:41:48 +0000 (07:41 +1100)]
multipath: don't step back before the first visible part.

When considering visibility, never step before the first visible part.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agorenderline: allow a wrap-margin
NeilBrown [Sun, 5 Feb 2023 00:56:02 +0000 (11:56 +1100)]
renderline: allow a wrap-margin

The location of the first wrap-margin tag is remembered, and any
subsequent line wrap is wrapped to that offset.

This is used to wrap subjects for notmuch message summaries.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch: messages in visible thread should not disappear.
NeilBrown [Sun, 5 Feb 2023 00:18:49 +0000 (11:18 +1100)]
notmuch: messages in visible thread should not disappear.

While a thread is visible, background refresh should not cause messages
to disappear - e.g. if I archive one and then a refresh happens.
They should only disappear when I re-visit the thread, or when I
explicitly request a refresh with '='.

So keep track of that explicit request, and when not present but the
query is open, preserve all 'True' matched values.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agopython: avoid buffer overflow in LOG()
NeilBrown [Sun, 5 Feb 2023 00:18:00 +0000 (11:18 +1100)]
python: avoid buffer overflow in LOG()

Due to using and unsigned int, some the tests where were bad.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agocomplete: allow an attribute to be requested.
NeilBrown [Tue, 31 Jan 2023 23:06:48 +0000 (10:06 +1100)]
complete: allow an attribute to be requested.

Rendering a fill line is slower than just getting an attribute.
So getting the (new) format:plain attribute is preferred there
it makes sense.

So allow render-complete to be given an attr to use, and do that for
file completion.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agorender-format: support format:plain attribute.
NeilBrown [Fri, 3 Feb 2023 02:42:27 +0000 (13:42 +1100)]
render-format: support format:plain attribute.

"format:plain" allows a caller to get the content of a line without any
markup and so without all the overhead of checking for markup.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agolinefilter: don't cause so much damage
NeilBrown [Wed, 1 Feb 2023 03:32:33 +0000 (14:32 +1100)]
linefilter: don't cause so much damage

Setting damage-view requires the whole doc to be reassessed, which is
slow for large directories.

It isn't clear why this is needed, so remove it for now.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agocomplete: return all of chosen line
NeilBrown [Wed, 1 Feb 2023 02:33:16 +0000 (13:33 +1100)]
complete: return all of chosen line

We currently only return the remainder of the chosen line from the
cursor.  So if the cursor has been moved to the right, the result is
wrong.

Need to move to start of line.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoqprint: don't count flushed lws is reported content size
NeilBrown [Wed, 1 Feb 2023 02:21:24 +0000 (13:21 +1100)]
qprint: don't count flushed lws is reported content size

The content callback reports how many bytes/chars were used.
The lws flushed has already been reported. So don't report it again.

This corrupts a qp file when there is a space before an '='.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoUpdate some copyright dates.
NeilBrown [Wed, 1 Feb 2023 01:33:00 +0000 (12:33 +1100)]
Update some copyright dates.

I wonder if these dates really mean anything..

Signed-off-by: NeilBrown <neil@brown.name>
3 years agorender-format: remove focus arg from next_line()
NeilBrown [Tue, 31 Jan 2023 22:53:30 +0000 (09:53 +1100)]
render-format: remove focus arg from next_line()

next_line() doesn't use focus, so don't require it.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agorender-complete: fix memory leak.
NeilBrown [Tue, 31 Jan 2023 22:52:25 +0000 (09:52 +1100)]
render-complete: fix memory leak.

We allocated this but never freed it.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agocompose-mail: support forwarding emails as attachments
NeilBrown [Tue, 31 Jan 2023 03:19:33 +0000 (14:19 +1100)]
compose-mail: support forwarding emails as attachments

The command 'z' or 'F' with a prefix arg will forward as an attachment.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoAllow a line boundary to be reported by the document.
NeilBrown [Tue, 31 Jan 2023 01:07:12 +0000 (12:07 +1100)]
Allow a line boundary to be reported by the document.

Rendering renders up to a line boundary.  Usually a newline, but the doc
can say where it is.  This allows multi-part to put a boundary between
parts, in case a part contains garbage.

This removes some blank lines in email messages -  nice.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoemail-view: be more selective of alternates.
NeilBrown [Mon, 30 Jan 2023 23:37:19 +0000 (10:37 +1100)]
email-view: be more selective of alternates.

Rather and selecting the first among alternates, select the last that we
understand, but avoid html unless there is no alternative.
This is more standards-compliant, and allows text/calendar to be easily
seen.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agomail-view: move text markup away from visibility setting.
NeilBrown [Mon, 30 Jan 2023 23:03:40 +0000 (10:03 +1100)]
mail-view: move text markup away from visibility setting.

Marking up text is quite separate from setting visibility.  So move
these pieces of code apart.

Also move the 'dup' of the start mark into the code that needs it.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoemail: add parsing of calendars
NeilBrown [Mon, 30 Jan 2023 20:57:40 +0000 (07:57 +1100)]
email: add parsing of calendars

Basinc info is extracted from calendar.  Importantly, the time is
displayed in the local timezone.

Signed-off-by: NeilBrown <neil@brown.name>