From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Steve Purcell Newsgroups: gmane.emacs.bugs Subject: bug#27881: New major mode: Less mode Date: Mon, 31 Jul 2017 18:39:23 +1200 Message-ID: References: <1501437183.13205.0@smtp.gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1501483222 11749 195.159.176.226 (31 Jul 2017 06:40:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 31 Jul 2017 06:40:22 +0000 (UTC) Cc: tom@tromey.com, dgutov@yandex.ru, 27881@debbugs.gnu.org, simenheg@gmail.com To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 31 08:40:17 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1dc4NA-0002b9-49 for geb-bug-gnu-emacs@m.gmane.org; Mon, 31 Jul 2017 08:40:12 +0200 Original-Received: from localhost ([::1]:57724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dc4NG-0003iW-4Q for geb-bug-gnu-emacs@m.gmane.org; Mon, 31 Jul 2017 02:40:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dc4N5-0003fR-Ug for bug-gnu-emacs@gnu.org; Mon, 31 Jul 2017 02:40:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dc4N1-0005m7-1v for bug-gnu-emacs@gnu.org; Mon, 31 Jul 2017 02:40:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60280) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dc4N0-0005m3-V8 for bug-gnu-emacs@gnu.org; Mon, 31 Jul 2017 02:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dc4N0-0007TW-OF for bug-gnu-emacs@gnu.org; Mon, 31 Jul 2017 02:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Steve Purcell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 Jul 2017 06:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27881 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, Tom Tromey , Simen =?UTF-8?Q?Heggest=C3=B8yl?= , Dmitry Gutov Original-Received: via spool by submit@debbugs.gnu.org id=B.150148320128723 (code B ref -1); Mon, 31 Jul 2017 06:40:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 31 Jul 2017 06:40:01 +0000 Original-Received: from localhost ([127.0.0.1]:34724 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dc4Mz-0007TC-5q for submit@debbugs.gnu.org; Mon, 31 Jul 2017 02:40:01 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60618) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dc4Mx-0007Sz-9Q for submit@debbugs.gnu.org; Mon, 31 Jul 2017 02:39:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dc4Mq-0005j9-R1 for submit@debbugs.gnu.org; Mon, 31 Jul 2017 02:39:53 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:35220) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dc4Mq-0005j5-O6 for submit@debbugs.gnu.org; Mon, 31 Jul 2017 02:39:52 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dc4Mp-0003VI-IY for bug-gnu-emacs@gnu.org; Mon, 31 Jul 2017 02:39:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dc4Mk-0005iB-MR for bug-gnu-emacs@gnu.org; Mon, 31 Jul 2017 02:39:51 -0400 Original-Received: from purcellpeople.com ([85.214.32.38]:41682 helo=h1189701.stratoserver.net) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dc4Mk-0005gW-Gy for bug-gnu-emacs@gnu.org; Mon, 31 Jul 2017 02:39:46 -0400 Original-Received: from [192.168.0.4] (210-55-83-202.dialup.xtra.co.nz [210.55.83.202]) by h1189701.stratoserver.net (Postfix) with ESMTPSA id 196BA27AC0AD; Mon, 31 Jul 2017 08:39:29 +0200 (CEST) In-Reply-To: X-Mailer: Apple Mail (2.3273) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:135190 Archived-At: Comments below: >> ;;;###autoload >> -(defcustom less-css-lessc-command "lessc" >=20 > Why autoload all these defcustom. Sounds like a bug. It may well be superfluous, but I found a note that this was added = because non-autoloaded custom vars wouldn=E2=80=99t be considered safe = as dir local variables otherwise. > Since these defcusotm come right after the (defgroup less ..), the >=20 > :group 'less >=20 > is redundant. Agree. >> ;;;###autoload >> +(defun less-compile () >=20 > Why autoload? This operates on the current buffer, so presumably this > buffer is already in less-mode. Probably, yes. >> + (message "Compiling Less to CSS") >=20 > I notice that "Less" is used pretty much everywhere except in the > define-derived-mode where Steve used "LESS". Why not use "Less" in = the > mode name as well? Agree, consistency would be good. Official upstream name is =E2=80=9CLess=E2= =80=9D. >> + (append (list (less--maybe-shell-quote-command = less-lessc-command)) >=20 > I'd recommend to just never quote less-lessc-command rather than only > quote it on non-Windows systems. It's actually more flexible this way > since less-lessc-command can then be set to something fancier (e.g. = the > command with a few flags). This fixed a concrete bug, but yes, it=E2=80=99s probably misguided: it = would have been better to always leave it unquoted. However, I wouldn=E2=80=99t advocate adding arbitrary flags to a command = like this, because it can=E2=80=99t then be passed to one of the = =E2=80=9Cprocess=E2=80=9D functions that expects the first of its args = to be the path of the executable, right? >> +(defconst less-font-lock-keywords >> '(;; Variables >> - ("@[a-z_-][a-z-_0-9]*" . font-lock-constant-face) >> + ("@[a-z_-][a-z-_0-9]*" . font-lock-variable-name-face) >> ("&" . font-lock-preprocessor-face) >> ;; Mixins >> - ("\\(?:[ \t{;]\\|^\\)\\(\\.[a-z_-][a-z-_0-9]*\\)[ \t]*;" . (1 = font-lock-keyword-face))) >> - ) >> + ("\\(?:[ \t{;]\\|^\\)\\(\\.[a-z_-][a-z-_0-9]*\\)[ \t]*;" . >> + (1 font-lock-keyword-face)))) >=20 > Is it important to limit those to ASCII chars? If not, then it's = better > to use [[:alpha:]_-] and [[:alnum:]_-] in the above regexps. Unsure, but it=E2=80=99s likely safe to allow non-ASCII alphanumeric = chars.=20 >> +(define-key less-mode-map "\C-c\C-c" 'less-compile) >=20 > The standard way is to do: >=20 > (defvar less-mode-map > (let ((map (make-sparse-keymap)))) > (define-key map "\C-c\C-c" 'less-compile) > map) >=20 > before the `define-derived-mode=E2=80=99. Is there an advantage to this? My reasoning is that = =E2=80=9Cdefine-derived-mode=E2=80=9D generates the mode map = declaration, so why not fill it afterwards. If consistency is important, = though, this would be a reasonable thing to change. Thanks for the review!