From: Mathias Dahl <brakjoller@gmail.com>
Subject: Re: Newbie: Unable to write a custom function
Date: Mon, 04 Dec 2006 10:03:35 +0100 [thread overview]
Message-ID: <uk618av88.fsf@gmail.com> (raw)
In-Reply-To: 1165094606.836594.304590@j72g2000cwa.googlegroups.com
"deech" <aditya.siram@gmail.com> writes:
> ;;Search backwards from a point for a string. If found delete
> ;;all characters from that string to the point.
> ;;Eg Given the argument 't', 'alligator' becomes 'alliga'
> (defun isearch-backward-tophrase ()
> (set-mark-command ())
> (isearch-backward )
> (kill-region ()())
> )
Maybe this is what you want:
(defun del-back-to-string (str)
(interactive "sString: ")
(let ((start (point)))
(if (search-backward str nil t)
(kill-region (point) start))))
Also, you don't have to restart Emacs to test your new command; just
place point after the last parenthesis and type C-x C-e
(`eval-last-sexp') and it will be evaluated and ready to be used.
next prev parent reply other threads:[~2006-12-04 9:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-02 21:23 Newbie: Unable to write a custom function deech
2006-12-02 21:52 ` Andre Kuehne
2006-12-03 0:06 ` Dieter Wilhelm
2006-12-04 9:03 ` Mathias Dahl [this message]
2006-12-06 17:49 ` Uber_Micro
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=uk618av88.fsf@gmail.com \
--to=brakjoller@gmail.com \
/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.
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).