From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Armstrong Newsgroups: gmane.emacs.bugs Subject: bug#9407: GNUmakefile mode thinks comments need a space before them after colon Date: Sat, 6 Feb 2021 14:50:54 -0800 Message-ID: References: <87y5ybdwao.fsf@jidanni.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36142"; mail-complaints-to="usenet@ciao.gmane.io" To: 9407@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 07 09:45:59 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l8fhf-0009KK-PU for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Feb 2021 09:45:59 +0100 Original-Received: from localhost ([::1]:55832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l8fhe-0004Td-SU for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Feb 2021 03:45:58 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l8fgl-00042D-Ql for bug-gnu-emacs@gnu.org; Sun, 07 Feb 2021 03:45:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35305) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l8fgl-0007h5-Jx for bug-gnu-emacs@gnu.org; Sun, 07 Feb 2021 03:45:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l8fgl-0001TK-IB for bug-gnu-emacs@gnu.org; Sun, 07 Feb 2021 03:45:03 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87y5ybdwao.fsf@jidanni.org> Resent-From: Matt Armstrong Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Feb 2021 08:45:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9407 X-GNU-PR-Package: emacs Original-Received: via spool by 9407-submit@debbugs.gnu.org id=B9407.16126874915597 (code B ref 9407); Sun, 07 Feb 2021 08:45:03 +0000 Original-Received: (at 9407) by debbugs.gnu.org; 7 Feb 2021 08:44:51 +0000 Original-Received: from localhost ([127.0.0.1]:46847 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l8fgZ-0001S7-AL for submit@debbugs.gnu.org; Sun, 07 Feb 2021 03:44:51 -0500 Original-Received: from mail-yb1-f173.google.com ([209.85.219.173]:33662) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l8WQ3-0003pP-8J for 9407@debbugs.gnu.org; Sat, 06 Feb 2021 17:51:11 -0500 Original-Received: by mail-yb1-f173.google.com with SMTP id m76so10730829ybf.0 for <9407@debbugs.gnu.org>; Sat, 06 Feb 2021 14:51:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=OSjR0nj16+pjoRE0rEQDk5VGGwxqlkiGGgsm/UmP/mE=; b=YZ+iIdO146EjgjkwvyuctzGs+WcQiljK9hKk4GeUTVWs93wVTuVOO85uc1KS81VrNf iPX5BCQYq2jtk5VMJSWjgGU8TCEtJ2Ng0zoVjrEJabLz6SpGtCMlGetDcyEI6ElUMh2G r2rP52axPf5E9+cdWdTtdPOXCB0HVNHlTJviZlQYt6xvW5Q8rq9XpjA6aJovDosxxmSh 7V8pJnfVb5xkHRGBHIh0Csu+1U7ZYulUIGdWxRn/5USLuv5f77YguagqL/Knts6Za11f XIF9yAdoQ+K3/ubg2a0ovUaV+ljfX6vgdH8ZqQLEe8svGZ2g+h5VWbQfkfTbW23T6ygy BEJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=OSjR0nj16+pjoRE0rEQDk5VGGwxqlkiGGgsm/UmP/mE=; b=OnNUKRW5JnPa0WtV+8FT4jAOnOTJrN45Zg3hq98BGyBN6s7NFJ5Zfbu34PUo+NB1aF Q3FfTV2/RhUeQoun05h8zN1j8UnH0hHFCfG/RYCIAENqQCQYPnVPVQfwnr0eu/TNy1No HjRIadMGVfheSGkkHMe1iVnY62V9I2ygqAG3Sd+lk9EjUVh3Edd83Hyh3bLIxGc+G0/b azxtQ6GAGGUZ8IhjW5m7JPIfhVeC/gYYeIlFE+eY5zIOvW7jCP/fqhSPWV5LiKIEggjg qwQu5EhxJl6wVZv97NcOw55KuigrA8FsEwwafXrtkhWbh47abdmHAZT50RlgcQu+DHGh /BlQ== X-Gm-Message-State: AOAM533sUVuFipPFY+rOtXKJyRvqV9j3DPX2I7yeLW63RHo5FwHOzOLo 5QPGFvL9Nsi1iT22wfHyLT+qeleXaRymb6ChPWYA5vsf4nRQXw== X-Google-Smtp-Source: ABdhPJzuu+/YpLoOcakqinQedgg7TTGQ/iMxDiURPPZzZEOUun7pEVWPyIriJzO3PsG9DsjCMjDv78fHK6dKkoXRkTQ= X-Received: by 2002:a25:f309:: with SMTP id c9mr14957138ybs.379.1612651865472; Sat, 06 Feb 2021 14:51:05 -0800 (PST) X-Mailman-Approved-At: Sun, 07 Feb 2021 03:44:46 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:199473 Archived-At: I looked at this bug a bit over the past few days and found it to be a surprisingly subtle bug. So subtle, in fact, that I am inclined to give up trying to fix it, at least without removing make-mode.el features. I'll explain why. Despite bug#9407 being the main bug, some interesting discussion happened in bug#33247, as well as in some of the other bugs filed by Dan Jacobson for similar issues. In bug#9407 Stefan said that make-mode.el aims to fontify shell comments in make commands, which is why the mode copied some of the shell mode regex code to recognize them. In the same bug, Alan suggested adding the colon `:' to `makefile-syntax-propertize-function' in make-mode.el to fix this bug. First, Alan's suggested fix is insufficient, because it trades one problem for another. In the example below, it will correctly highlight the first comment below, but it will also highlight "not a comment" as a comment, when in fact it isn't. target:#This is a comment echo This is:#not a comment In other words, today Emacs highlights comments only if they're valid Bourne shell comments, despite only the command lines being written in shell. This heuristic seems to be correct for almost everything in a Makefile, but edge cases like this bug arise. Two things send me running for the hills and giving up: - GNU make lets you change the shell used for commands. It need not be a Bourne shell at all. It could be as exotic as Scheme shell! Yet make-mode.el attempts to highlight a rule's commands as if they were shell code (there is logic in there to support perl as well). - GNU make lets you change the leading character used for command lines, so it need not even be a TAB character. The first point is the biggie. Given that the command language, at least in a GNU makefile, is not fixed, I might opt to strip out all highlighting of the underlying command language, and instead focus on parsing command text in the limited way that make itself does, and highlight the rest as, perhaps, a string. This might fix a number of separate issues as reported by Dan, some of which seem to relate to this. Just a thought.