From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: How to do a massive unfill paragraph operation over several hundred files? Date: Mon, 01 Oct 2018 17:12:29 +0200 Organization: Aioe.org NNTP Server Message-ID: <86wor1ya3m.fsf@zoho.com> References: <8636ts4jz3.fsf@zoho.com> <86zhvyzq4c.fsf@zoho.com> <86muryype2.fsf@zoho.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1538406820 745 195.159.176.226 (1 Oct 2018 15:13:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 1 Oct 2018 15:13:40 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Oct 01 17:13:36 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g6ztA-0008VJ-9d for geh-help-gnu-emacs@m.gmane.org; Mon, 01 Oct 2018 17:13:36 +0200 Original-Received: from localhost ([::1]:39127 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6zvG-0002cj-Jm for geh-help-gnu-emacs@m.gmane.org; Mon, 01 Oct 2018 11:15:46 -0400 X-Received: by 2002:adf:b2b4:: with SMTP id g49-v6mr1223327wrd.2.1538406751171; Mon, 01 Oct 2018 08:12:31 -0700 (PDT) Original-Path: usenet.stanford.edu!q200-v6no668843wmd.0!news-out.google.com!z184-v6ni2441wmz.0!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweak.nl!144.76.165.73.MISMATCH!news.unit0.net!news.mixmin.net!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 51 Original-NNTP-Posting-Host: onLrbz09yV+MU3RaxdbMkg.user.gioia.aioe.org Original-X-Complaints-To: abuse@aioe.org Mail-Copies-To: never X-Notice: Filtered by postfilter v. 0.8.3 Cancel-Lock: sha1:kas+0wLW9SVzvD8WBLp8uRHu8Pk= Original-Xref: usenet.stanford.edu gnu.emacs.help:223961 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:118087 Archived-At: 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