From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rolando Pereira Newsgroups: gmane.emacs.bugs Subject: bug#11982: 24.1.50; (Contains ERT Test) show-paren-mode doesn't work in C comments if there's a quote between the parenthesis (affects c-mode and modes derived from it) Date: Wed, 18 Jul 2012 21:16:17 +0100 Message-ID: <87d33sn7u6.fsf@sapo.pt> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1342642621 13985 80.91.229.3 (18 Jul 2012 20:17:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 18 Jul 2012 20:17:01 +0000 (UTC) To: 11982@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 18 22:17:01 2012 Return-path: Envelope-to: geb-bug-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 1Srag8-0003ba-LR for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 Jul 2012 22:17:00 +0200 Original-Received: from localhost ([::1]:35935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Srag7-0003oB-Uk for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 Jul 2012 16:16:59 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:59681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Srag4-0003ms-Sf for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2012 16:16:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Srag2-0001mz-Q1 for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2012 16:16:56 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39448) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Srag2-0001mi-Lz for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2012 16:16:54 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Sralx-0007cJ-Oi for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2012 16:23:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Rolando Pereira Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Jul 2012 20:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 11982 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.134264296429252 (code B ref -1); Wed, 18 Jul 2012 20:23:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Jul 2012 20:22:44 +0000 Original-Received: from localhost ([127.0.0.1]:48994 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sralg-0007bl-CL for submit@debbugs.gnu.org; Wed, 18 Jul 2012 16:22:44 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35057) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Srale-0007be-Bm for submit@debbugs.gnu.org; Wed, 18 Jul 2012 16:22:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Srafh-0001ju-F5 for submit@debbugs.gnu.org; Wed, 18 Jul 2012 16:16:34 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:45497) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Srafh-0001jq-C2 for submit@debbugs.gnu.org; Wed, 18 Jul 2012 16:16:33 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:59558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Srafg-0003mG-54 for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2012 16:16:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Srafe-0001jQ-JU for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2012 16:16:32 -0400 Original-Received: from relay2.ptmail.sapo.pt ([212.55.154.22]:34750 helo=sapo.pt) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1Srafe-0001ir-8l for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2012 16:16:30 -0400 Original-Received: (qmail 7503 invoked from network); 18 Jul 2012 20:16:27 -0000 Original-Received: from unknown (HELO sapo.pt) (10.134.37.162) by relay2 with SMTP; 18 Jul 2012 20:16:27 -0000 Original-Received: (qmail 22351 invoked from network); 18 Jul 2012 20:16:25 -0000 Original-Received: from unknown (HELO rolando-desktop) (finalyugi@sapo.pt@[188.37.127.54]) (envelope-sender ) by mta12 (qmail-ptmail-1.0.0) with AES128-SHA encrypted SMTP for ; 18 Jul 2012 20:16:19 -0000 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:62129 Archived-At: In c-mode if you type the following comment with M-x show-paren-mode activated, the closing parenthesis is highlighted correctly: // Lorem ipsum (dolor sit amet) However, if the ' character appears inside the parenthesis, then show-paren-mode won't match them. For example, when typing the following comment, show-paren-mode highlights the closing parenthesis using show-paren-mismatch: // Comments are good (aren't they?) I tried to make an ERT test that would check if the parenthesis was highlighted correctly, but I couldn't get the overlay that show-paren-mode uses. However I found out that forward-sexp also doesn't work when the ' character appears between parenthesis, which makes me think the problem may be somewhere in the syntax-table used by c-mode. Here's the ERT test: (ert-deftest cc-mode-should-forward-sexp-with-quotes-inside () "Check if `forward-sexp' works in c-mode when the cursor is inside a comment and there's a ' character inside the parenthesis" (with-temp-buffer (c-mode) (insert "// Comments are good (aren't they?)") (goto-char (point-min)) (search-forward "(") (backward-char 1) (forward-sexp) (ert-should (= (point) 36)))) Also, the reason I think that the problem only affects c-mode and modes that derive from it is because this problem doesn't show up in emacs-lisp-mode or lisp-mode. Here's how to see the problem when starting emacs with the -Q flag: 1. Create the temporary buffer "temp-buffer" with C-x b temp-buffer RET 2. Activate c-mode with M-x c-mode 3. Activate show-paren-mode with M-x show-paren-mode 4. Write "// Comments are good (aren't they?)" 5. When typing the closing parenthesis, notice that it's highlighted with the face show-paren-mismatch Another test that can be used that doesn't use show-paren-mode but still shows wrong behaviour is the following: 1. Create the temporary buffer as before 2. Activate c-mode as before 2. Write "// Comments are good (aren't they?)" 3. When typing the closing parenthesis, notice that the minibuffer shows the message "No matching parenthesis found". In GNU Emacs 24.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.20.1) of 2012-07-15 on rolando-desktop Bzr revision: 109096 dmantipov@yandex.ru-20120715111709-pa3d1hni2gmjdux0 Windowing system distributor `The X.Org Foundation', version 11.0.10706000 Important settings: value of $LANG: pt_PT.utf8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: M-x r e p o r Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Starting new Ispell process [/usr/bin/aspell::default] ... Checking spelling of PARENTHESIS... byte-code: Window # too small for splitting Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr ispell emacsbug message format-spec rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)