From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: beginning-of-defun-comments bug [was: Re: 26.0.90: mark-defun problem in c-mode] Date: Sat, 30 Dec 2017 23:26:24 -0500 Message-ID: References: <834lo8fqyi.fsf@gnu.org> <20171230103432.GB10623@ACM> <20171230120136.GD10623@ACM> <83shbse5rs.fsf@gnu.org> <20171230154305.GF10623@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1514694330 32741 195.159.176.226 (31 Dec 2017 04:25:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 31 Dec 2017 04:25:30 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Eli Zaretskii , ccsmile2008@outlook.com, npostavs@gmail.com, emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Dec 31 05:25:25 2017 Return-path: Envelope-to: ged-emacs-devel@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 1eVVBZ-00080U-I4 for ged-emacs-devel@m.gmane.org; Sun, 31 Dec 2017 05:25:21 +0100 Original-Received: from localhost ([::1]:52812 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eVVDY-0000mL-LF for ged-emacs-devel@m.gmane.org; Sat, 30 Dec 2017 23:27:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47748) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eVVCs-0000m2-Lc for emacs-devel@gnu.org; Sat, 30 Dec 2017 23:26:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eVVCq-0003VJ-2b for emacs-devel@gnu.org; Sat, 30 Dec 2017 23:26:42 -0500 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:57105) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eVVCp-0003ON-UD; Sat, 30 Dec 2017 23:26:39 -0500 Original-Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id vBV4QRaO012617; Sat, 30 Dec 2017 23:26:30 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id 5E7796638C; Sat, 30 Dec 2017 23:26:24 -0500 (EST) In-Reply-To: <20171230154305.GF10623@ACM> (Alan Mackenzie's message of "Sat, 30 Dec 2017 15:43:05 +0000") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6190=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6190> : inlines <6292> : streams <1774663> : uri <2560341> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221481 Archived-At: > + (if (nth 3 ppss) ; in a string > + start > + (when (nth 4 ppss) ; in a comment > + (setq ppss > + (parse-partial-sexp (point) eol nil nil ppss 'syntax-table))) > + (catch 'got-it > + (while (< (point) eol) > + (setq start (point)) > + (setq ppss (parse-partial-sexp (point) eol nil nil ppss t)) > + (setq end (if (nth 4 ppss) (nth 8 ppss) eol)) > + (goto-char start) > + (skip-syntax-forward "-" end) > + (when (< (point) end) > + (throw 'got-it (point))) > + (unless (forward-comment 1) ; comment straddles line break. > + (throw 'got-it nil)) > + (setq ppss (syntax-ppss)))))))) Why not use something like (>= (forward-comment (point-max)) (line-end-position)) ? Stefan