unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Andreas Röhler" <andreas.roehler@online.de>
To: emacs-devel@gnu.org
Subject: Re: beginning-of-thing-pos, end-of-thing-pos
Date: Sun, 19 Aug 2007 17:02:46 +0200	[thread overview]
Message-ID: <200708191702.46740.andreas.roehler@online.de> (raw)
In-Reply-To: <200708191646.40265.andreas.roehler@online.de>

Am Sonntag, 19. August 2007 16:46 schrieb Andreas Röhler:
> Hi,
>
> at several occasions I needed the buffer-position of a
> string (thing).
>
> As I wrote my own thingatpt-utils, already have that.
>
> But would prefer to keep every code as much
> as possible conform with distribution.
>
> Therefore my request for a (very) simple addition:
>
> thingatpt.el knows about THING's position:
>
> (defun beginning-of-thing (thing)
>   (let ((bounds (bounds-of-thing-at-point thing)))
>     (or bounds (error "No %s here" thing))
>     (goto-char (car bounds))))
>
> (defun end-of-thing (thing)
>   (let ((bounds (bounds-of-thing-at-point thing)))
>     (or bounds (error "No %s here" thing))
>     (goto-char (cdr bounds))))
>
> As visible, these functions move point rather than
> returning the pos. 

No, sorry. I see "The return value is position".
So question is reduced to avoid the move.

> Simply need some reduction: 
>
> (defun beginning-of-thing-pos (thing)
>   (let ((bounds (bounds-of-thing-at-point thing)))
>     (or bounds (error "No %s here" thing))
>     (car bounds)))
>
> (defun end-of-thing-pos (thing)
>   (let ((bounds (bounds-of-thing-at-point thing)))
>     (or bounds (error "No %s here" thing))
>     (cdr bounds)))
>
> Afterwards things like that are possible:
>
> (defun end-of-word-at-point ()
>   " "
>   (interactive)
>   (message "%s" (end-of-thing-pos 'word)))
>
> May `beginning-of-thing-pos' and `end-of-thing-pos'
> be included?
>
> Thanks
>
> Andreas Roehler
>
>
>
>
>
> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2007-08-19 15:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-19 14:46 beginning-of-thing-pos, end-of-thing-pos Andreas Röhler
2007-08-19 15:02 ` Andreas Röhler [this message]
2007-08-19 21:21 ` Karl Fogel

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=200708191702.46740.andreas.roehler@online.de \
    --to=andreas.roehler@online.de \
    --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).