From: Jean Louis <bugs@gnu.support>
To: help-gnu-emacs@gnu.org
Subject: [solved] Re: How to format paragraph and not to lose spaces between 2 characters?
Date: Wed, 6 Oct 2021 13:18:30 +0300 [thread overview]
Message-ID: <YV139sdQRZVDx5gL@protected.localdomain> (raw)
In-Reply-To: <871r4yy9dh.fsf@zoho.eu>
Thanks, I guess that easiest is to solve my use case and use
non-breaking space. I consider it solved, better this way then that I
fiddle with settings.
Org mode style is nice, though not enough visual for my purposes and
more or less it works only for numbered lines and headings.
,----
| 1. [X] A line of something, like a task for example.
`----
What I personally need is to mark TODO/DONE anywhere in the text in
any kind of mode, including Asciidoc mode, plain text and similar. And
to be able to mark TODO/DONE anywhere on the line.
Like this, it has non-breaking spaces between: ❰ ❱ which may not be
visible on screen, but depending of the Emacs theme, I can see the
non-breaking space as underline:
,----
| ❰ ❱ A line of something, like a task for example.
`----
Then when it is done, I can quickly convert it to DONE.
,----
| ❰DONE❱ A line of something, like a task for example.
`----
And I use only one command: M-x rcd-check which is bound to key. One
could customize it as one wish, maybe like [✔]
Functions are below:
(defun rcd-check ()
"Replace matches of CHECK-IN with CHECK-OUT in a line.
It is useful to toggle [ ] to [✔]"
(interactive)
(let* ((start (line-beginning-position))
(end (line-end-position))
(line (buffer-substring start end)))
(rcd-check-start)
(save-excursion
(cond ((string-match (regexp-quote rcd-check-in) line)
(replace-regexp (regexp-quote rcd-check-in) rcd-check-out nil start end))
((string-match (regexp-quote rcd-check-out) line)
(replace-regexp (regexp-quote rcd-check-out) rcd-check-in nil start end))))))
(defvar rcd-check-in "❰ ❱")
(defvar rcd-check-out "❰DONE❱")
(defun rcd-check-start ()
"Insert variable `rcd-check-in' at the beginning of line."
(interactive)
(let* ((start (line-beginning-position))
(end (line-end-position))
(line (buffer-substring start end)))
(when (and (not (string-match rcd-check-in line))
(not (string-match rcd-check-out line)))
(save-excursion
(goto-char start)
(insert rcd-check-in " "))
(when (= start end)
(goto-char (line-end-position))))))
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
next prev parent reply other threads:[~2021-10-06 10:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-06 5:41 How to format paragraph and not to lose spaces between 2 characters? Jean Louis
2021-10-06 6:04 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-06 6:07 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-06 10:02 ` Jean Louis
2021-10-06 10:24 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-06 13:00 ` tomas
2021-10-06 10:18 ` Jean Louis [this message]
2021-10-06 14:35 ` [solved] " Emanuel Berg via Users list for the GNU Emacs text editor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YV139sdQRZVDx5gL@protected.localdomain \
--to=bugs@gnu.support \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).