[OS X Emacs] new+question

Marinos Koutsomichalis marinos at agxivatein.com
Fri Dec 17 02:40:03 EST 2010


another thing I just notice

I' m using either emacs (cocoa or carbon, I am not sure) or aquamacs sometimes - 
in aquamacs the messages in the minibuffer disappear automatically after a couple of seconds and I can' t read them if long enough.. 

how can I change this ?? 

thx in advance

m


On 16 Δεκ 2010, at 11:32 μ.μ., Marinos Koutsomichalis wrote:

> thx 
> 
> I' m gonna try this tonight to code a small snippet I need - hopefully with success..
> 
> m
> 
> 
> On 16 Δεκ 2010, at 8:36 μ.μ., Jack Repenning wrote:
> 
>> On Dec 16, 2010, at 12:10 AM, Marinos Koutsomichalis wrote:
>> 
>>> How do I pass a text selection as an argument to a lisp function 
>>> 
>>> (defun test-function (word) "print word to minibuffer" 
>>> 	(interactive)
>>> 	(message "%s"  word)
>>> 	)
>> 
>> What you want is something like this:
>> 
>> (defun test-function (sel-start sel-end) "print word to minibuffer" 
>> 	(interactive "r")
>> 	(message "%s"  (buffer-substring sel-start sel-end))
>> 	)
>> 
>> Some "fishing lessons" on getting to such answers:
>> 
>> "Ctrl-h f" is your friend! Plant your cursor in the word "interactive" and give it a try. You get the help for the function "interactive," which is the key here.
>> 
>> If, as will be true in this case, you don't see quite what you expected, read the rest and ponder how it could. As you see, in this case I used the "region" (region is the name for the end points of what you called the "selection"). Since "region" is a pair of numbers, you need something to turn it into the actual text, and that's "buffer-substring".
>> 
>> If you really want to be strict about it, you don't need to "pass" the region/selection anywhere--everyone knows it, by the names "point" and "mark". But taking the end points as arguments is better, because it allows your function to be used in other ways as well -- I can call
>> 
>> (test-function some-other-spot another-spot-near-that-one)
>> 
>> and get the buffer-substring mentioned printed, even if it's not actually the selection.
>> 
>> Oh ... and, welcome to Emacs!
>> 
>> 
>> 
>> 
>> _____________________________________________________________
>> MacOSX-Emacs mailing list
>> MacOSX-Emacs at email.esm.psu.edu
>> http://email.esm.psu.edu/mailman/listinfo/macosx-emacs
>> List Archives: http://dir.gmane.org/gmane.emacs.macintosh.osx
> 
> _____________________________________________________________
> MacOSX-Emacs mailing list
> MacOSX-Emacs at email.esm.psu.edu
> http://email.esm.psu.edu/mailman/listinfo/macosx-emacs
> List Archives: http://dir.gmane.org/gmane.emacs.macintosh.osx




More information about the MacOSX-Emacs mailing list