|
From: | Emanuel Berg |
Subject: | Re: bounds for strings with - between subwords |
Date: | Fri, 07 May 2021 00:49:45 +0200 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
steve-humphreys wrote: > I am using the following function that gets me the bounds > for each word. > > But I have strings like > > bibl-bellerive-etal-2016 > > which I want to get the bounds for strings with - > between subwords. I'm not following 100% but you can add digits and a dash to your below work if that helps? (skip-chars-forward "[:alnum:]-") > (defun alpha-bounds () > "Gets bounds of a subword unit defined by regular expression [a-zA-Z]." > (let ( ($bounds nil) $ma $mb ) > (skip-chars-backward "[:alpha:]") > (setq $ma (point)) > (skip-chars-forward "[:alpha:]") > (setq $mb (point)) > (setq $bounds (bounds-of-thing-at-point 'word)) > (cons $ma $mb) )) You can put all that in the `let' to avoid the use of `setq'. Also $bounds doesn't seem to do anything? And what's the purpose of the $? -- underground experts united https://dataswamp.org/~incal
[Prev in Thread] | Current Thread | [Next in Thread] |