unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* paragraph fill and wrong number of arguments
@ 2007-04-21 12:14 Yohann Pitrey
  2007-04-21 18:05 ` Dieter Wilhelm
  0 siblings, 1 reply; 4+ messages in thread
From: Yohann Pitrey @ 2007-04-21 12:14 UTC (permalink / raw)
  To: help-gnu-emacs

Hi everyone,

I have been trying to write a function to fill a paragraph using :


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

but it doesn't work , and I get this error message :

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

does anyone have a clue?

thanks a lot!

Yohann.

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

* Re: paragraph fill and wrong number of arguments
  2007-04-21 12:14 paragraph fill and wrong number of arguments Yohann Pitrey
@ 2007-04-21 18:05 ` Dieter Wilhelm
  2007-04-24  9:17   ` Yohann Pitrey
  0 siblings, 1 reply; 4+ messages in thread
From: Dieter Wilhelm @ 2007-04-21 18:05 UTC (permalink / raw)
  To: Yohann Pitrey; +Cc: help-gnu-emacs

Yohann Pitrey <ypitrey@gmail.com> writes:

> I have been trying to write a function to fill a paragraph using :
>
>
>        (defun justify ()
> 	 (interactive)
> 	 (mark-paragraph)
> 	 (fill-region-as-paragraph (region-beginning) (region-end))
> 	 )
>
> "justify: Wrong number of arguments: #[nil "ÀÁ!ˆÂÃĉ#ˆÅÁ!‡"
> [forward-paragraph 1 push-mark nil t backward-paragraph] 4 1287337
> nil], 1"

not so for me, have you re-evaluated your latest definition?

Bye the way, why don't you use M-q (fill-paragraph)?

-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

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

* Re: paragraph fill and wrong number of arguments
  2007-04-21 18:05 ` Dieter Wilhelm
@ 2007-04-24  9:17   ` Yohann Pitrey
  0 siblings, 0 replies; 4+ messages in thread
From: Yohann Pitrey @ 2007-04-24  9:17 UTC (permalink / raw)
  Cc: help-gnu-emacs, Emacs-devel

For information, I finally made it :


	(defun justify ()
	  (interactive)
	  (save-excursion
	    (backward-paragraph -1)
	    (setq from (point))
	    (forward-paragraph -1)
	    (setq to (point))
	    (fill-region-as-paragraph from to)
	    )
	  )


thanks all for your help!

Yohann.

Dieter Wilhelm a écrit :
> Yohann Pitrey <ypitrey@gmail.com> writes:
> 
>> I have been trying to write a function to fill a paragraph using :
>>
>>
>>        (defun justify ()
>> 	 (interactive)
>> 	 (mark-paragraph)
>> 	 (fill-region-as-paragraph (region-beginning) (region-end))
>> 	 )
>>
>> "justify: Wrong number of arguments: #[nil "ÀÁ!ˆÂÃĉ#ˆÅÁ!‡"
>> [forward-paragraph 1 push-mark nil t backward-paragraph] 4 1287337
>> nil], 1"
> 
> not so for me, have you re-evaluated your latest definition?
> 
> Bye the way, why don't you use M-q (fill-paragraph)?
> 

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

* Re: paragraph fill and wrong number of arguments
@ 2007-04-24 14:14 Yohann Pitrey
  0 siblings, 0 replies; 4+ messages in thread
From: Yohann Pitrey @ 2007-04-24 14:14 UTC (permalink / raw)
  To: help-gnu-emacs, Emacs-devel

Thanks for your answer, it perfectly works too!
I didn't know the "progn" trick...

Now, I would like the function to indent the whole paragraph like the first 
line. I tried to write this (this is *exactly* what I wrote) :

(defun justifier () ;; i am french, so justify becomes justifier
	 (interactive)
	 (save-excursion
	   (let ((from (progn
			 (backward-paragraph -1)
			 (beginning-of-line-text)
			 (point)))
		 (column (current-column))
		 (to   (progn
			 (forward-paragraph -1)
			 (point))))
	     (indent-region from to column)
	     (fill-region-as-paragraph from to))))


it doesn't work with the first line's indent, though it aligns the paragraph 
with the second line indent :

* try and change the first line's indent, and execute the function, it shouldn't 
work as I wish.
* then try to change the second line's indent (no matter the first line's 
indent), and the paragraph should align like it.

does anyone have a clue?

thanks,

Yohann.

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

end of thread, other threads:[~2007-04-24 14:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-21 12:14 paragraph fill and wrong number of arguments Yohann Pitrey
2007-04-21 18:05 ` Dieter Wilhelm
2007-04-24  9:17   ` Yohann Pitrey
  -- strict thread matches above, loose matches on Subject: below --
2007-04-24 14:14 Yohann Pitrey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).