From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tim Johnson Newsgroups: gmane.emacs.help Subject: Re: Copy whitespace-delimited text to variable Date: Thu, 8 Mar 2018 07:15:48 -0900 Organization: AkWebsoft Message-ID: <20180308161548.GC12710@mail.akwebsoft.com> References: <86zi3jqer1.fsf@zoho.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1520525674 30007 195.159.176.226 (8 Mar 2018 16:14:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 8 Mar 2018 16:14:34 +0000 (UTC) User-Agent: Mutt/1.7.0 (2016-08-17) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 08 17:14:30 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1etyBY-0007ge-OR for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Mar 2018 17:14:28 +0100 Original-Received: from localhost ([::1]:39992 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etyDb-0004YV-IR for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Mar 2018 11:16:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37739) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etyCt-0004Wg-8A for help-gnu-emacs@gnu.org; Thu, 08 Mar 2018 11:15:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etyCp-0008SK-9a for help-gnu-emacs@gnu.org; Thu, 08 Mar 2018 11:15:51 -0500 Original-Received: from tjohnson.mtaonline.net ([64.4.232.191]:45275) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etyCp-0008RQ-0x for help-gnu-emacs@gnu.org; Thu, 08 Mar 2018 11:15:47 -0500 Original-Received: by linus.johnson.com (Postfix, from userid 1000) id 0FB932004BB; Thu, 8 Mar 2018 07:15:48 -0900 (AKST) Mail-Followup-To: help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: <86zi3jqer1.fsf@zoho.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.4.232.191 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116133 Archived-At: * Emanuel Berg [180307 21:27]: > Tim Johnson wrote: > > > Example: in elpy > > g.args (where cursor is at or following 's') > > (current-word) would just return 'args', I need 'g.args' > > and I don't wish to modify the syntax table. > > > > Before I roll my own, I'd rather not > > re-invent the wheel... > > Why not? To quote the barrel racer, just try - > and you will fly :) > > (defun previous-word () > (interactive) > (save-excursion > (let((word-stop (progn (backward-word 1) > (forward-word 1) > (point) )) > (word-start (re-search-backward "[[:space:]]" (point-min) t)) ) > (when word-start > (message > (string-trim > (buffer-substring-no-properties word-start word-stop) )))))) :) I'm ready to fly ... and have already been using subr-x thanks, Emanuel -- Tim http://www.akwebsoft.com, http://www.tj49.com