From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.help Subject: Re: Problem using search-forward Date: Mon, 08 Oct 2012 12:10:21 +0800 Message-ID: <87a9vxmwnm.fsf@ericabrahamsen.net> References: <9aed3b85-f743-4bd0-994f-c44304d8078a@googlegroups.com> <874nm6rveg.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1349669438 6839 80.91.229.3 (8 Oct 2012 04:10:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Oct 2012 04:10:38 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Oct 08 06:10:45 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TL4g0-0005NS-Sd for geh-help-gnu-emacs@m.gmane.org; Mon, 08 Oct 2012 06:10:44 +0200 Original-Received: from localhost ([::1]:47775 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TL4fu-0008As-Oz for geh-help-gnu-emacs@m.gmane.org; Mon, 08 Oct 2012 00:10:38 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:52026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TL4fp-0008Am-EF for help-gnu-emacs@gnu.org; Mon, 08 Oct 2012 00:10:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TL4fo-0004Au-FE for help-gnu-emacs@gnu.org; Mon, 08 Oct 2012 00:10:33 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:37370) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TL4fo-00049j-88 for help-gnu-emacs@gnu.org; Mon, 08 Oct 2012 00:10:32 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1TL4fr-0005KX-Bt for help-gnu-emacs@gnu.org; Mon, 08 Oct 2012 06:10:35 +0200 Original-Received: from 50-56-99-223.static.cloud-ips.com ([50.56.99.223]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 08 Oct 2012 06:10:35 +0200 Original-Received: from eric by 50-56-99-223.static.cloud-ips.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 08 Oct 2012 06:10:35 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 53 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 50-56-99-223.static.cloud-ips.com X-Pgp-Key: http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=0xC98BAE7B99D0D373 X-Pgp-Fingerprint: 8E19 28A9 2B51 0C67 565D DB34 C98B AE7B 99D0 D373 User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (gnu/linux) Cancel-Lock: sha1:Ney4W2evkUTt7iZ+qj7dVuiMdAs= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:87131 Archived-At: On Mon, Oct 08 2012, Tassilo Horn wrote: > Bob Shanley writes: > > Hi Bob, > >> ; These do not: >> ; (defun eol ( ) (end-of-line) (point)) >> ; (search-forward ");" (eol)) >> ; (let ( (n (eol)) ) (message "this is the value %d" n) (search-forward ");" n)) >> ; They result in a Search failed: ");" and point moves to end of line >> ; What am I missing? > > The `end-of-line' call already moves point to the end of line, thus you > bound the search to the same position where it starts. Try this > definition of `eol'. > > (defun eol () > (save-excursion > (end-of-line) > (point))) I may be missing something here, but isn't this what (point-at-eol) does? > ,----[ C-h f save-excursion RET ] > | save-excursion is a special form in `C source code'. > | > | (save-excursion &rest BODY) > | > | Save point, mark, and current buffer; execute BODY; restore those things. > | Executes BODY just like `progn'. > | The values of point, mark and the current buffer are restored > | even in case of abnormal exit (throw or error). > | The state of activation of the mark is also restored. > | > | This construct does not save `deactivate-mark', and therefore > | functions that change the buffer will still cause deactivation > | of the mark at the end of the command. To prevent that, bind > | `deactivate-mark' with `let'. > | > | If you only want to save the current buffer but not point nor mark, > | then just use `save-current-buffer', or even `with-current-buffer'. > `---- > > Bye, > Tassilo > > > -- GNU Emacs 24.2.50.1 (i686-pc-linux-gnu, GTK+ Version 3.4.4) of 2012-10-03 on pellet