emacs-devel
[Top][All Lists]
Advanced

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

Re: master 659199f: lisp/emacs-lisp/cl-indent.el: Fix indent of with-out


From: Oleh Krehel
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Leo Liu <address@hidden> 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 via email to

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