From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Philip K." Newsgroups: gmane.emacs.bugs Subject: bug#43242: [PATCH] Fix CSS completion bug Date: Sun, 06 Sep 2020 14:51:03 +0200 Message-ID: <87mu239ih4.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13506"; mail-complaints-to="usenet@ciao.gmane.io" To: 43242@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 06 14:52:09 2020 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 1kEu9R-0003OS-Qt for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Sep 2020 14:52:09 +0200 Original-Received: from localhost ([::1]:39546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kEu9Q-0005Ue-Tx for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Sep 2020 08:52:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kEu9K-0005US-9L for bug-gnu-emacs@gnu.org; Sun, 06 Sep 2020 08:52:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33477) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kEu9K-0007ic-0Z for bug-gnu-emacs@gnu.org; Sun, 06 Sep 2020 08:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kEu9J-0002YE-V8 for bug-gnu-emacs@gnu.org; Sun, 06 Sep 2020 08:52:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Philip K." Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Sep 2020 12:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 43242 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15993966729743 (code B ref -1); Sun, 06 Sep 2020 12:52:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Sep 2020 12:51:12 +0000 Original-Received: from localhost ([127.0.0.1]:45023 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kEu8W-0002X4-BI for submit@debbugs.gnu.org; Sun, 06 Sep 2020 08:51:12 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:34208) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kEu8V-0002Wy-Kv for submit@debbugs.gnu.org; Sun, 06 Sep 2020 08:51:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57632) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kEu8V-0005Sf-Cz for bug-gnu-emacs@gnu.org; Sun, 06 Sep 2020 08:51:11 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:55271) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kEu8S-0007g1-1t for bug-gnu-emacs@gnu.org; Sun, 06 Sep 2020 08:51:11 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id B5797240101 for ; Sun, 6 Sep 2020 14:51:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1599396664; bh=qhenUkBpzB+VCOh7DrznmjVYJ83Ot8Ju7ifsNEL+Okg=; h=From:To:Subject:Date:From; b=Ue/0QtrPrycuQwIigw9SN6y5KRTMPVfX5O/4ZJiS+qQwCbvMityi2XFoBzABON4pS EyeBLgjyUsJLsfaC8olmh+wp9bkBK5CzmnIFKVwktE0QtXJScfIAAl+iV7NJUzzfKT D+dOq907oCx4Hl9YralOAdM+WAnf2huIEOCa7QdWrdMFLyxfcuPSooPEk8GTCSXZ7U QR02sbmDhhb7QjJLR6mtr9IH9BRrEaTJ6p6dOJ9b1oQdAsG54W/2wPN5Rx3KtudSde QtgBBxsm2osM744D46+LaxcN35lPXSc9YjkodKK9ZDmrb8YCRxJobqFoi2LbkVpMCR y+EacToL2K0Jg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Bkrr822Tjz9rxD for ; Sun, 6 Sep 2020 14:51:04 +0200 (CEST) Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/06 07:09:38 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:187330 Archived-At: --=-=-= Content-Type: text/plain Hi, I like to write CSS rules on one line, but Emacs completion-at-point system always seems to fail if there is more than one rule per line. It seems the reason was that css--complete-property-value as part of css-completion-at-point falsely reported a match, because it ignored the semi-colon. This means that in situations like these color: red; padd ^ point here the CAPF backend assumed a "color" value should be completed, even though the user probably wants the "padd" string to be completed. The patch below fixes this by making sure css--complete-property-value doesn't ignore the semi-colon. -- Philip K. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Allow-CSS-completion-with-multiple-rules-on-one-line.patch >From d452cd225845000f278e39c02796cf323f931925 Mon Sep 17 00:00:00 2001 From: Philip K Date: Sun, 6 Sep 2020 14:42:03 +0200 Subject: [PATCH] Allow CSS completion with multiple rules on one line * css-mode.el (css--complete-property-value): Check for semi-colon when completing property values --- lisp/textmodes/css-mode.el | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index cc5879880c..d0882c68d0 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1357,13 +1357,11 @@ css--property-values (defun css--complete-property-value () "Complete property value at point." (let ((property - (save-excursion - (re-search-backward ":[^/]" (line-beginning-position) t) - (when (eq (char-after) ?:) - (let ((property-end (point))) - (skip-chars-backward "-[:alnum:]") - (let ((prop (buffer-substring (point) property-end))) - (car (member prop css-property-ids)))))))) + (save-match-data + (and (looking-back "\\([[:alnum:]-]+\\):[^/][^;]*" + (line-beginning-position) t) + (car (member (match-string-no-properties 1) + css-property-ids)))))) (when property (let ((end (point))) (save-excursion -- 2.26.2 --=-=-=--