From: Emanuel Berg <moasenwood@zoho.eu>
To: help-gnu-emacs@gnu.org
Subject: when nothing happens, buffer still marked as modified
Date: Wed, 05 Dec 2018 03:48:59 +0100 [thread overview]
Message-ID: <86sgzcy9gk.fsf@zoho.eu> (raw)
Here [1] is a function I once wrote. My mind
isn't what it was back then, but testing it
with the different options (the `C-u' combos)
I understand it from a user's perspective and
it seems to do what it says.
Only one thing is missing what I can see, and
that is, when nothing happens (i e the piece of
text is already in the desired shape), the
buffer is still marked as modified (the `**')!
What is the correct way to prevent that?
(defun fill-down (start end &optional justify)
"Fill the current paragraph from the current line down.\n
With mark active, act upon the region instead.\n
With \\[universal-argument] before invocation, JUSTIFY fully.
With \\[universal-argument] twice, remove full justification. (Or just fill it!)
With \\[universal-argument] thrice, center."
(interactive
(if (use-region-p)
(list (region-beginning) (region-end) current-prefix-arg)
(list (line-beginning-position)
(save-excursion (forward-paragraph) (point))
current-prefix-arg)))
(if (equal justify '(16)) ; C-u C-u -> unjustify
(canonically-space-region start end)
(fill-region
start end
(pcase justify
(`(4) 'full) ; C-u -> justify
(`(64) 'center) )))) ; C-u C-u C-u -> center
;; no C-u -> none (i e just fill)
[1] http://user.it.uu.se/~embe8573/emacs-init/fill-new.el
--
underground experts united
http://user.it.uu.se/~embe8573
next reply other threads:[~2018-12-05 2:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-05 2:48 Emanuel Berg [this message]
2018-12-05 6:55 ` when nothing happens, buffer still marked as modified Eli Zaretskii
[not found] ` <mailman.5189.1543993692.1284.help-gnu-emacs@gnu.org>
2018-12-05 7:23 ` Emanuel Berg
2018-12-05 8:22 ` Eli Zaretskii
[not found] ` <mailman.5196.1543998171.1284.help-gnu-emacs@gnu.org>
2018-12-05 10:09 ` Emanuel Berg
2018-12-05 10:58 ` Eli Zaretskii
2018-12-05 13:39 ` Amin Bandali
2018-12-05 13:57 ` Eli Zaretskii
2018-12-05 15:00 ` Joost Kremers
2018-12-05 17:54 ` Eli Zaretskii
2018-12-05 18:35 ` Michael Heerdegen
[not found] ` <mailman.5239.1544035085.1284.help-gnu-emacs@gnu.org>
2018-12-06 0:49 ` Emanuel Berg
2018-12-05 11:58 ` Michael Heerdegen
[not found] ` <mailman.5204.1544007548.1284.help-gnu-emacs@gnu.org>
2018-12-06 0:47 ` Emanuel Berg
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=86sgzcy9gk.fsf@zoho.eu \
--to=moasenwood@zoho.eu \
--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).