From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Newsgroups: gmane.emacs.bugs Subject: bug#9148: Make `comment-normalize-vars' more syntax-aware Date: Tue, 02 Aug 2011 21:49:24 +0200 Message-ID: <87bow74mrf.fsf@gmail.com> References: <87ipqu5pwl.fsf@gmail.com> <87oc083xuw.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1312314885 29679 80.91.229.12 (2 Aug 2011 19:54:45 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 2 Aug 2011 19:54:45 +0000 (UTC) Cc: 9148@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 02 21:54:40 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QoL2y-0003xf-GU for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Aug 2011 21:54:36 +0200 Original-Received: from localhost ([::1]:39710 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoL2y-0006OU-6N for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Aug 2011 15:54:36 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:50858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoL2v-0006OD-Ki for bug-gnu-emacs@gnu.org; Tue, 02 Aug 2011 15:54:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QoL2u-0000Zd-Og for bug-gnu-emacs@gnu.org; Tue, 02 Aug 2011 15:54:33 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46635) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoL2u-0000ZW-Ls for bug-gnu-emacs@gnu.org; Tue, 02 Aug 2011 15:54:32 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QoL3N-0002PP-FJ; Tue, 02 Aug 2011 15:55:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Aug 2011 19:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9148 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9148-submit@debbugs.gnu.org id=B9148.13123148749223 (code B ref 9148); Tue, 02 Aug 2011 19:55:01 +0000 Original-Received: (at 9148) by debbugs.gnu.org; 2 Aug 2011 19:54:34 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QoL2w-0002Oi-EB for submit@debbugs.gnu.org; Tue, 02 Aug 2011 15:54:34 -0400 Original-Received: from mail-fx0-f44.google.com ([209.85.161.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QoL2u-0002OZ-DY for 9148@debbugs.gnu.org; Tue, 02 Aug 2011 15:54:33 -0400 Original-Received: by fxe6 with SMTP id 6so169619fxe.3 for <9148@debbugs.gnu.org>; Tue, 02 Aug 2011 12:54:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; bh=SJLdzFIgwKaUVckWf7F501uRkbwBvlnEIqmcyQUJR+g=; b=XNFrUaoKEKRcWa3oMO4+4BEvpkGo5ySMg8JLzmQ5Ju1t47z73LLSt5OugrrvqIdIy2 BkI3SsD0uhMh6bg0AVeVMTzEJjvcZqkTtWgP6Bb7VlFNgNJlCxhYROdlkKCP56ynbg/9 5a2iXoXLFC7w2q7EUCTZE7qeNhyVDndVln8ok= Original-Received: by 10.223.145.22 with SMTP id b22mr9033809fav.95.1312314842057; Tue, 02 Aug 2011 12:54:02 -0700 (PDT) Original-Received: from localhost (176.119.broadband10.iol.cz [90.177.119.176]) by mx.google.com with ESMTPS id o18sm54262fal.47.2011.08.02.12.53.59 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 02 Aug 2011 12:54:01 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Tue, 02 Aug 2011 15:03:54 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 02 Aug 2011 15:55:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) 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:49833 Archived-At: On Tue, 02 Aug 2011 21:03:54 +0200 Stefan Monnier wrote: >> The point is that you can define a major mode with different syntax >> tables in different parts of the text (using the syntax-table text >> property), but instead of using that information to determine >> comment-start and the other variables, `comment-normalize-vars' still >> relies on `comment-start' being hard-coded (which doesn't really make >> sense in a buffer with multiple comment syntaxes), even when >> `comment-use-syntax' is set and the syntax-table information is >> sufficient. > > But this is part of a much larger problem (multiple major modes in the > same buffer). Maybe, but the specific change to `comment-normalize-vars' (gather the appropriate value for `comment-start' from the syntax-table at point instead of prompting the user when `comment-use-syntax' is set) I proposed would seem easy enough and fix this very problem. > Basically you're suggesting to use the syntax-table property as a way to > specify the major mode used in each part and then teach newcomment.el to > never use buffer-local variables but only the syntax-table around > point. More precisely and less ambitiously, I'm suggesting to do what `comment-use-syntax' seems to be claiming already (that's also why I still consider this a bug, not an enhancement request) -- to rely on syntax-table instead of the regexp variables when manipulating comments. > It might be a good idea, but it's a non-trivial change (and still > leaves open the question of how to specify that I want //...\n for the > C chunks and (*...*) for the Pascal chunks). I don't understand. Again: the case I've described, the comment syntax is unambiguously specified for every part of the buffer using the syntax-table (either the buffer-local value, or the text property value). The C chunks have the C syntax table as its value, the Pascal chunks have the Pascal syntax table as its value (if there is such a thing -- I don't use C or Pascal; in my specific case it was JavaScript on one hand and a VimL[1]-like custom syntax with double quote comment start and end-of-line comment end on the other). The only thing that's needed to fix this very use case is make `comment-normalize-vars' set `comment-start' from the syntax-table when `comment-use-syntax' is set, instead of forcing me to advise it and do it myself. It'd still be ugly, but not more ugly than it already is now, and certainly better than using advice. [1] The "language" used for Vim scripting. --=20 =C5=A0t=C4=9Bp=C3=A1n