[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [emacs-wiki-discuss] Help with my elisp
From: |
Chris Parsons |
Subject: |
Re: [emacs-wiki-discuss] Help with my elisp |
Date: |
Wed, 30 Mar 2005 11:28:30 +0100 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (windows-nt) |
On the 30th of March 2005 at 10:38, Chris Lowis <gmane#chrislowis.co.uk> wrote:
> The idea is to replace the selected text with [[bbdb://some.*text][some
> text]] , I am not sure about the (yank)s is that the correct way to do
> things ?
Hi Chris,
I wrote a similar thing for bbdb links, using the skeleton framework. It's
not perfect lisp (I'm a newbie myself) but hopefully you might get some
pointers from it, as a different way to do the same thing...
,____________
|(defun chrismdp/skeleton-read-or-use-region (prompt &optional initial-input)
| "If we have an active region, use that, else prompt for input. This is
| to allow quick input to skeleton functions, and easy minibuffer use."
|(if mark-active
| (save-excursion
| (delete-and-extract-region (region-beginning)
(region-end)))
| (skeleton-read prompt initial-input)))
|
|(define-skeleton chrismdp/planner-skeleton-bbdb-link
| "Insert a link to the BBDB"
| ""
| '(setq str (chrismdp/skeleton-read-or-use-region "Name: "))
| "[[bbdb://"
| (if (featurep 'xemacsp)
| (replace-in-string " " "." str)
| (replace-regexp-in-string " " "." str))
| "][" str "]]")
`-------------
Chris
PS: How does one quote the lisp code above automatically? I put the
formatting in manually...
--
Chris Parsons
address@hidden