From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: [solved] Re: How to format paragraph and not to lose spaces between 2 characters? Date: Wed, 6 Oct 2021 13:18:30 +0300 Message-ID: References: <871r4yy9dh.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28148"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.0.7+183 (3d24855) (2021-05-28) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 06 12:28:50 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mY4AL-00079P-SM for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 06 Oct 2021 12:28:49 +0200 Original-Received: from localhost ([::1]:44178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mY4AK-0000r7-Nr for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 06 Oct 2021 06:28:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58854) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mY498-0000kU-SC for help-gnu-emacs@gnu.org; Wed, 06 Oct 2021 06:27:34 -0400 Original-Received: from stw1.rcdrun.com ([217.170.207.13]:33405) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mY496-0007kS-UI for help-gnu-emacs@gnu.org; Wed, 06 Oct 2021 06:27:34 -0400 Original-Received: from localhost ([::ffff:41.75.189.38]) (AUTH: PLAIN admin, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 0000000000027F7F.00000000615D7A11.000031CF; Wed, 06 Oct 2021 03:27:28 -0700 Mail-Followup-To: help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: <871r4yy9dh.fsf@zoho.eu> Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:133607 Archived-At: 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/