all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: master 659199f: lisp/emacs-lisp/cl-indent.el: Fix indent of with-output-to-string
       [not found] ` <E1Z85Hy-0003om-JV@vcs.savannah.gnu.org>
@ 2015-06-26  1:17   ` Leo Liu
  2015-06-26  7:18     ` Oleh Krehel
  0 siblings, 1 reply; 6+ messages in thread
From: Leo Liu @ 2015-06-26  1:17 UTC (permalink / raw)
  To: emacs-devel

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?

Leo




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master 659199f: lisp/emacs-lisp/cl-indent.el: Fix indent of with-output-to-string
  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
  2015-06-26 17:17       ` John Mastro
                         ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Oleh Krehel @ 2015-06-26  7:18 UTC (permalink / raw)
  To: Leo Liu; +Cc: emacs-devel

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.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master 659199f: lisp/emacs-lisp/cl-indent.el: Fix indent of with-output-to-string
  2015-06-26  7:18     ` Oleh Krehel
@ 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
  2 siblings, 1 reply; 6+ messages in thread
From: John Mastro @ 2015-06-26 17:17 UTC (permalink / raw)
  To: Oleh Krehel, emacs-devel; +Cc: Leo Liu

Oleh Krehel <ohwoeowho@gmail.com> wrote:
> I even checked the args of `with-output-to-string' for SBCL, just in
> case: they are &rest.

Hm, not sure why it showed you that, but it's not right.

CL-USER> (lisp-implementation-type)
"SBCL"
CL-USER> (describe 'with-output-to-string)
COMMON-LISP:WITH-OUTPUT-TO-STRING
  [symbol]

WITH-OUTPUT-TO-STRING names a macro:
  Lambda-list: ((VAR &OPTIONAL STRING &KEY (ELEMENT-TYPE ''CHARACTER))
                &BODY FORMS-DECLS)
  Source file: SYS:SRC;CODE;MACROS.LISP

-- 
john



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master 659199f: lisp/emacs-lisp/cl-indent.el: Fix indent of with-output-to-string
  2015-06-26 17:17       ` John Mastro
@ 2015-06-26 17:23         ` John Mastro
  0 siblings, 0 replies; 6+ messages in thread
From: John Mastro @ 2015-06-26 17:23 UTC (permalink / raw)
  To: Oleh Krehel, emacs-devel; +Cc: Leo Liu

John Mastro <john.b.mastro@gmail.com> wrote:
>> I even checked the args of `with-output-to-string' for SBCL, just in
>> case: they are &rest.
>
> Hm, not sure why it showed you that, but it's not right.

But the best source for this sort of thing is the CLHS:
http://www.lispworks.com/documentation/HyperSpec/Body/m_w_out_.htm#with-output-to-string

-- 
john



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master 659199f: lisp/emacs-lisp/cl-indent.el: Fix indent of with-output-to-string
  2015-06-26  7:18     ` Oleh Krehel
  2015-06-26 17:17       ` John Mastro
@ 2015-06-26 19:32       ` Stefan Monnier
  2015-06-28 13:41       ` Oleh Krehel
  2 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2015-06-26 19:32 UTC (permalink / raw)
  To: Oleh Krehel; +Cc: Leo Liu, emacs-devel

> With this in my config:
>     (setq lisp-indent-function 'common-lisp-indent-function)

You're tweaking the common-lisp indentation rules to work for the Elisp
language, at the detriment of the Common-Lisp language (because their
with-output-to-string are rather different)


        Stefan



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master 659199f: lisp/emacs-lisp/cl-indent.el: Fix indent of with-output-to-string
  2015-06-26  7:18     ` Oleh Krehel
  2015-06-26 17:17       ` John Mastro
  2015-06-26 19:32       ` Stefan Monnier
@ 2015-06-28 13:41       ` Oleh Krehel
  2 siblings, 0 replies; 6+ messages in thread
From: Oleh Krehel @ 2015-06-28 13:41 UTC (permalink / raw)
  To: Leo Liu; +Cc: emacs-devel

Oleh Krehel <ohwoeowho@gmail.com> writes:

> 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.

By bad. I've looked at (swank-backend:arglist 'with-output-to-string)
which returned (&REST SB-C::ARGS). I extrapolated from Elisp and thought
that they do the same thing. Thanks for fixing it.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-28 13:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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
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

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.