unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Yohann Pitrey <ypitrey@gmail.com>
Cc: Emacs-devel@gnu.org
Subject: Re: paragraph fill and arguments
Date: Sat, 21 Apr 2007 13:03:10 +0200	[thread overview]
Message-ID: <4629EF6E.7040301@gmail.com> (raw)
In-Reply-To: <jwvy7km9aky.fsf-monnier+emacs@gnu.org>

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

  reply	other threads:[~2007-04-21 11:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2007-04-22  8:10 ` Johan Bockgård

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=4629EF6E.7040301@gmail.com \
    --to=ypitrey@gmail.com \
    --cc=Emacs-devel@gnu.org \
    /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 public inbox

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

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