all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How do i run independent commands on the same defun?
@ 2008-06-22 15:54 Hugo Mezarina
  2008-06-22 17:33 ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 2+ messages in thread
From: Hugo Mezarina @ 2008-06-22 15:54 UTC (permalink / raw)
  To: help-gnu-emacs

See... I want to run independent commads on the same defun...
I want to write a function to do this:

    copy a region of the current buffer
    generete a new buffer
    paste that region in that new buffer
    sort the fields of the new region

I want to do this inside of the body of a function. I'd like to know if 
there is a function like the one a propose on the next lines:  
eval-next-lines

(defun copy-and-sort-in-newbuff (original-buff field-name)
    (eval-next-lines
         (generate-new-buffer (concat original-buff "-" field-name))
        (set-buffer original-buff)
        (copy-region-as-kill  (point-min) (point-max))
        (set-buffer (concat original-buff "-" field_name))
        (yank)
        (sort-fields -1 (point-min)(point-max))
    )
)

If there is another way to do this... plesase let me know...

I know it is rookie problem...but it is my current state on this field...

I appreciate your help on this!

Thank you.

Hugo




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

* Re: How do i run independent commands on the same defun?
  2008-06-22 15:54 How do i run independent commands on the same defun? Hugo Mezarina
@ 2008-06-22 17:33 ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 2+ messages in thread
From: Lennart Borgman (gmail) @ 2008-06-22 17:33 UTC (permalink / raw)
  To: Hugo Mezarina; +Cc: help-gnu-emacs

Hugo Mezarina wrote:
> See... I want to run independent commads on the same defun...
> I want to write a function to do this:
> 
>    copy a region of the current buffer
>    generete a new buffer
>    paste that region in that new buffer
>    sort the fields of the new region
> 
> I want to do this inside of the body of a function. I'd like to know if 
> there is a function like the one a propose on the next lines:  
> eval-next-lines
> 
> (defun copy-and-sort-in-newbuff (original-buff field-name)
>    (eval-next-lines
>         (generate-new-buffer (concat original-buff "-" field-name))
>        (set-buffer original-buff)
>        (copy-region-as-kill  (point-min) (point-max))
>        (set-buffer (concat original-buff "-" field_name))
>        (yank)
>        (sort-fields -1 (point-min)(point-max))
>    )
> )
> 
> If there is another way to do this... plesase let me know...

I might be misunderstanding you, but I think there is no need for 
"eval-next-lines". That is what the defun does by default.

Though there are some other small problems in your code that you have to 
play with a bit :-)

> I know it is rookie problem...but it is my current state on this field...

The interesting thing about a rocket is that it starts somewhere and 
goes somewhere else.

> I appreciate your help on this!
> 
> Thank you.
> 
> Hugo
> 
> 
> 




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

end of thread, other threads:[~2008-06-22 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-22 15:54 How do i run independent commands on the same defun? Hugo Mezarina
2008-06-22 17:33 ` Lennart Borgman (gmail)

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.