all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Oleh Krehel <ohwoeowho@gmail.com>
To: Leo Liu <sdl.web@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: master 659199f: lisp/emacs-lisp/cl-indent.el: Fix indent of with-output-to-string
Date: Fri, 26 Jun 2015 09:18:13 +0200	[thread overview]
Message-ID: <87bng3ey4q.fsf@gmail.com> (raw)
In-Reply-To: <m2ioab5kug.fsf@gmail.com> (Leo Liu's message of "Fri, 26 Jun 2015 09:17:43 +0800")

Leo Liu <sdl.web@gmail.com> writes:

> On 2015-06-25 19:25 +0800, Oleh Krehel wrote:
>> diff --git a/lisp/emacs-lisp/cl-indent.el b/lisp/emacs-lisp/cl-indent.el
>> index 57da715..9314419 100644
>> --- a/lisp/emacs-lisp/cl-indent.el
>> +++ b/lisp/emacs-lisp/cl-indent.el
>> @@ -827,7 +827,7 @@ optional\\|rest\\|key\\|allow-other-keys\\|aux\\|whole\\|body\\|environment\
>>             (with-accessors . multiple-value-bind)
>>             (with-condition-restarts . multiple-value-bind)
>>  	   (with-compilation-unit (&lambda &body))
>> -           (with-output-to-string (4 2))
>> +           (with-output-to-string 0)
>>             (with-slots . multiple-value-bind)
>>             (with-standard-io-syntax (2)))))
>>    (dolist (el l)
>
> Are you sure you are doing the right thing?

Yes.,

With this in my config:

    (setq lisp-indent-function 'common-lisp-indent-function)

The previous (bad) indent was this:

    (with-output-to-string
        (foo)
      (bar))

The fixed indent is this:

    (with-output-to-string
      (foo)
      (bar))

Which makes sense and is consistent with the indent declaration of
`with-output-to-string', as I mentioned in the commit.

    (defmacro with-output-to-string (&rest body)
      "Execute BODY, return the text it sent to `standard-output', as a string."
      (declare (indent 0) (debug t))
      `(let ((standard-output
    	  (get-buffer-create (generate-new-buffer-name " *string-output*"))))
         (unwind-protect
    	 (progn
    	   (let ((standard-output standard-output))
    	     ,@body)
    	   (with-current-buffer standard-output
    	     (buffer-string)))
           (kill-buffer standard-output))))

I even checked the args of `with-output-to-string' for SBCL, just in
case: they are &rest.



  reply	other threads:[~2015-06-26  7:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20150625112550.14642.54593@vcs.savannah.gnu.org>
     [not found] ` <E1Z85Hy-0003om-JV@vcs.savannah.gnu.org>
2015-06-26  1:17   ` master 659199f: lisp/emacs-lisp/cl-indent.el: Fix indent of with-output-to-string Leo Liu
2015-06-26  7:18     ` Oleh Krehel [this message]
2015-06-26 17:17       ` John Mastro
2015-06-26 17:23         ` John Mastro
2015-06-26 19:32       ` Stefan Monnier
2015-06-28 13:41       ` Oleh Krehel

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bng3ey4q.fsf@gmail.com \
    --to=ohwoeowho@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=sdl.web@gmail.com \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.