help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DWIM region


From: Stefan Monnier
Subject: Re: DWIM region
Date: Mon, 08 Jan 2018 09:17:15 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> If there is no interactive string, does that
> mean one has to check manually in the
> interactive form for a/the prefix argument?

"P" just sends `current-prefix-arg` as argument.

    (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)))
      ;; C-u C-u -> unjustify
      (if (equal justify '(16))
          (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


-- Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]