all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* paragraph fill and arguments
@ 2007-04-20 10:06 ypitrey
  2007-04-20 14:40 ` martin rudalics
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: ypitrey @ 2007-04-20 10:06 UTC (permalink / raw)
  To: Emacs-devel


Hi everyone,

I a m trying to make my own fill paragraph command, which i want to be an
equivalent of :

'M-x mark-paragraph'
and then
'M-x fill-region-as-paragraph'

I tried to write a function to do that :

      (defun justify ()
	 (interactive)
	 (mark-paragraph)
	 (fill-region-as-paragraphl)
	 )

The M-x twice trick works perfectly, but when I try to do 'M-x justify', I
hav an error message saying :

"justify : Wrong number of arguments: #[nil "ÀÁ!ˆÂÃĉ#ˆÅÁ!‡"
[forward-paragraph 1 push-mark nil t backward-paragraph] 4 1287337 nil], 1"

Does anyone have an idea on what it comes from?

Thanks a lot!

Yohann.



-- 
View this message in context: http://www.nabble.com/paragraph-fill-and-arguments-tf3612075.html#a10094076
Sent from the Emacs - Dev mailing list archive at Nabble.com.

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

* Re: paragraph fill and arguments
  2007-04-20 10:06 paragraph fill and arguments ypitrey
@ 2007-04-20 14:40 ` martin rudalics
  2007-04-20 17:17   ` Yohann Pitrey
  2007-04-20 18:18 ` Stefan Monnier
  2007-04-22  8:10 ` Johan Bockgård
  2 siblings, 1 reply; 9+ messages in thread
From: martin rudalics @ 2007-04-20 14:40 UTC (permalink / raw)
  To: ypitrey; +Cc: Emacs-devel

 > 	 (fill-region-as-paragraphl)
                                   ^
... an "l"?  I you intend to write `fill-region-as-paragraph' here
you should provide FROM and TO arguments.

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

* Re: paragraph fill and arguments
  2007-04-20 14:40 ` martin rudalics
@ 2007-04-20 17:17   ` Yohann Pitrey
  2007-04-21 10:12     ` martin rudalics
  0 siblings, 1 reply; 9+ messages in thread
From: Yohann Pitrey @ 2007-04-20 17:17 UTC (permalink / raw)
  To: Emacs-devel

martin rudalics a écrit :
>  >      (fill-region-as-paragraphl)
>                                   ^
> ... an "l"?  I you intend to write `fill-region-as-paragraph' here
> you should provide FROM and TO arguments.
> 

yes, of course, it's a typing mistake...

how do I get the from an to points of the paragraph?

thanks for your reply.

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

* Re: paragraph fill and arguments
  2007-04-20 10:06 paragraph fill and arguments ypitrey
  2007-04-20 14:40 ` martin rudalics
@ 2007-04-20 18:18 ` Stefan Monnier
  2007-04-21 11:03   ` Yohann Pitrey
  2007-04-22  8:10 ` Johan Bockgård
  2 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2007-04-20 18:18 UTC (permalink / raw)
  To: ypitrey; +Cc: Emacs-devel

> I a m trying to make my own fill paragraph command, which i want to be an
> equivalent of :

> 'M-x mark-paragraph'
> and then
> 'M-x fill-region-as-paragraph'

These are equivalent to

    (command-execute 'mark-paragraph)
and
    (command-execute 'fill-region-as-paragraph)


The `command-execute' function uses the `interactive' form inside the
command to build a list of arguments and then calls the function with
those arguments.

>       (defun justify ()
> 	 (interactive)
> 	 (mark-paragraph)
> 	 (fill-region-as-paragraph))

Here on the other hand, you directly call those commands as function, so if
you want to use this form, you need to pass them arguments "manually".


        Stefan

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

* Re: paragraph fill and arguments
  2007-04-20 17:17   ` Yohann Pitrey
@ 2007-04-21 10:12     ` martin rudalics
  2007-04-21 11:49       ` Andreas Schwab
  0 siblings, 1 reply; 9+ messages in thread
From: martin rudalics @ 2007-04-21 10:12 UTC (permalink / raw)
  To: Yohann Pitrey; +Cc: Emacs-devel

> how do I get the from an to points of the paragraph?

Try

(defun justify ()
   (interactive)
   (mark-paragraph)
   (fill-region-as-paragraph (point) (mark)))

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

* Re: paragraph fill and arguments
  2007-04-20 18:18 ` Stefan Monnier
@ 2007-04-21 11:03   ` Yohann Pitrey
  0 siblings, 0 replies; 9+ messages in thread
From: Yohann Pitrey @ 2007-04-21 11:03 UTC (permalink / raw)
  Cc: Emacs-devel

Thanks for your answers, but i'm sorry, none of them seems to work.

first, I tried to write :

(defun justify ()
	(command-execute 'mark-paragraph)
	(command-execute 'fill-region-as-paragraph)
)

second, as it didn't work (same error message), i tried this one :

(defun justify ()
   (interactive)
   (mark-paragraph)
   (fill-region-as-paragraph (point) (mark))
)

and no more did it work.

any idea? i admit i am completely lost!



Stefan Monnier a écrit :
>> I a m trying to make my own fill paragraph command, which i want to be an
>> equivalent of :
> 
>> 'M-x mark-paragraph'
>> and then
>> 'M-x fill-region-as-paragraph'
> 
> These are equivalent to
> 
>     (command-execute 'mark-paragraph)
> and
>     (command-execute 'fill-region-as-paragraph)
> 
> 
> The `command-execute' function uses the `interactive' form inside the
> command to build a list of arguments and then calls the function with
> those arguments.
> 
>>       (defun justify ()
>> 	 (interactive)
>> 	 (mark-paragraph)
>> 	 (fill-region-as-paragraph))
> 
> Here on the other hand, you directly call those commands as function, so if
> you want to use this form, you need to pass them arguments "manually".
> 
> 
>         Stefan
> 


 >> how do I get the from an to points of the paragraph?

 >Try

 >(defun justify ()
 >  (interactive)
 >  (mark-paragraph)
 >  (fill-region-as-paragraph (point) (mark)))

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

* Re: paragraph fill and arguments
  2007-04-21 10:12     ` martin rudalics
@ 2007-04-21 11:49       ` Andreas Schwab
  2007-04-21 11:59         ` martin rudalics
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2007-04-21 11:49 UTC (permalink / raw)
  To: martin rudalics; +Cc: Yohann Pitrey, Emacs-devel

martin rudalics <rudalics@gmx.at> writes:

>> how do I get the from an to points of the paragraph?

This is off-topic on emacs-devel.  Please use <help-gnu-emacs@gnu.org>
instead.

> (defun justify ()
>   (interactive)
>   (mark-paragraph)
>   (fill-region-as-paragraph (point) (mark)))
    (fill-region-as-paragraph (region-beginning) (region-end)))

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: paragraph fill and arguments
  2007-04-21 11:49       ` Andreas Schwab
@ 2007-04-21 11:59         ` martin rudalics
  0 siblings, 0 replies; 9+ messages in thread
From: martin rudalics @ 2007-04-21 11:59 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Yohann Pitrey, Emacs-devel

> This is off-topic on emacs-devel.  Please use <help-gnu-emacs@gnu.org>
> instead.

... which should also get you the correct answer within one hour or less.

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

* Re: paragraph fill and arguments
  2007-04-20 10:06 paragraph fill and arguments ypitrey
  2007-04-20 14:40 ` martin rudalics
  2007-04-20 18:18 ` Stefan Monnier
@ 2007-04-22  8:10 ` Johan Bockgård
  2 siblings, 0 replies; 9+ messages in thread
From: Johan Bockgård @ 2007-04-22  8:10 UTC (permalink / raw)
  To: emacs-devel

ypitrey <ypitrey@gmail.com> writes:

> I tried to write a function to do that :
>
>       (defun justify ()
> 	 (interactive)
> 	 (mark-paragraph)
> 	 (fill-region-as-paragraphl)
> 	 )
>
> The M-x twice trick works perfectly, but when I try to do 'M-x justify', I
> hav an error message saying :
>
> "justify : Wrong number of arguments: #[nil "ÀÁ!ˆÂÃĉ#ˆÅÁ!‡"
> [forward-paragraph 1 push-mark nil t backward-paragraph] 4 1287337 nil], 1"
>
> Does anyone have an idea on what it comes from?

It seems to come from `mark-paragraph' and says that it was given 1
argument but expected a different number of arguments (zero). This
makes no sense. Please paste *exactly* the code that you tested. Have
you tried "emacs -q -no-site-file"?

-- 
Johan Bockgård

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

end of thread, other threads:[~2007-04-22  8:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-20 10:06 paragraph fill and arguments ypitrey
2007-04-20 14:40 ` martin rudalics
2007-04-20 17:17   ` Yohann Pitrey
2007-04-21 10:12     ` martin rudalics
2007-04-21 11:49       ` Andreas Schwab
2007-04-21 11:59         ` martin rudalics
2007-04-20 18:18 ` Stefan Monnier
2007-04-21 11:03   ` Yohann Pitrey
2007-04-22  8:10 ` Johan Bockgård

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.