[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to do a massive unfill paragraph operation over several hundred
From: |
Emanuel Berg |
Subject: |
Re: How to do a massive unfill paragraph operation over several hundred files? |
Date: |
Mon, 01 Oct 2018 17:12:29 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Gerald Wildgruber wrote:
> Yes, that is the whole point I didn't
> understand! What does "ARGS" have to be when
> called non-interactively in a script.
> From the doc string of the function:
>
> (defun unfill-paragraph (&optional region)
> "Takes a multi-line paragraph and makes it into a single line of text."
> (interactive (progn (barf-if-buffer-read-only) '(t)))
> (let ((fill-column (point-max)))
> (fill-paragraph nil region)))
>
> I cannot see what to put here.
When you call that interactively what happens
is `barf-if-buffer-read-only', which
[s]ignal[s] a `buffer-read-only' error if
the current buffer is read-only
but if that doesn't hold (i.e. the buffer isn't
read-only), then "region", the optional
argument, is assigned `t'.
However when you call it from Lisp, NONE of
this happens so "region" remains nil!
Observe:
(defun test-interactive-optional-args (&optional arg)
(interactive (progn (barf-if-buffer-read-only) '(t)))
(message "arg: %s" arg) )
(call-interactively
#'test-interactive-optional-args) ; arg: t
(test-interactive-optional-args) ; arg: nil
(test-interactive-optional-args t) ; arg: t
and of course:
(test-interactive-optional-args nil) ; arg: nil
So in so many words, why don't you pass `t' as
the argument? :)
--
underground experts united
http://user.it.uu.se/~embe8573
- Re: How to do a massive unfill paragraph operation over several hundred files?, (continued)
- Re: How to do a massive unfill paragraph operation over several hundred files?, Emanuel Berg, 2018/10/01
- Re: How to do a massive unfill paragraph operation over several hundred files?, Gerald Wildgruber, 2018/10/01
- Re: How to do a massive unfill paragraph operation over several hundred files?, Robert Pluim, 2018/10/01
- Re: How to do a massive unfill paragraph operation over several hundred files?, Gerald Wildgruber, 2018/10/02
- Re: How to do a massive unfill paragraph operation over several hundred files?, Noam Postavsky, 2018/10/02
- Re: How to do a massive unfill paragraph operation over several hundred files?, Gerald Wildgruber, 2018/10/03
- Re: How to do a massive unfill paragraph operation over several hundred files?, Noam Postavsky, 2018/10/03
- Re: How to do a massive unfill paragraph operation over several hundred files?, Gerald Wildgruber, 2018/10/08
- Message not available
- Re: How to do a massive unfill paragraph operation over several hundred files?, Emanuel Berg, 2018/10/03
- Message not available
- Re: How to do a massive unfill paragraph operation over several hundred files?, Emanuel Berg, 2018/10/02
Message not available
- Re: How to do a massive unfill paragraph operation over several hundred files?,
Emanuel Berg <=