unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#44214: 28.0.50; css-mode: no completion in declaration with newline after
@ 2020-10-25 20:41 Dmitry Gutov
  2020-10-26  9:24 ` Simen Heggestøyl
       [not found] ` <87blgp731t.fsf@simenheg@gmail.com>
  0 siblings, 2 replies; 7+ messages in thread
From: Dmitry Gutov @ 2020-10-25 20:41 UTC (permalink / raw)
  To: 44214; +Cc: simen heggestøyl

X-Debbugs-CC: Simen Heggestøyl <simenheg@gmail.com>

1. Create new buffer (or switch to scratch), then M-x css-mode.
2. Replace the contents with the following:

div {
   transform:
     rota

3. Move the point to the end of 'rota' and type C-M-i.

4. See no completions.

If there is no newline after the colon, before the attribute value,
C-M-i does perform completion.

Originally reported in 
https://github.com/company-mode/company-mode/issues/1029

In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
3.24.20, cairo version 1.16.0)
  of 2020-10-11 built on potemkin
Repository revision: c66165b5c08e12c5dcf494fea42e61df693b80b9
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Ubuntu 20.04.1 LTS





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#44214: 28.0.50; css-mode: no completion in declaration with newline after
  2020-10-25 20:41 bug#44214: 28.0.50; css-mode: no completion in declaration with newline after Dmitry Gutov
@ 2020-10-26  9:24 ` Simen Heggestøyl
       [not found] ` <87blgp731t.fsf@simenheg@gmail.com>
  1 sibling, 0 replies; 7+ messages in thread
From: Simen Heggestøyl @ 2020-10-26  9:24 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 44214

This seems sufficient to me. Would you like to test it out?

diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 0d1eeed561..748a561bab 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -1357,7 +1357,9 @@ css--property-values
 (defun css--complete-property-value ()
   "Complete property value at point."
   (let ((property (and (looking-back "\\([[:alnum:]-]+\\):[^/][^;]*"
-                                     (line-beginning-position) t)
+                                     (or (ppss-innermost-start (syntax-ppss))
+                                         (point-min))
+                                     t)
                        (member (match-string-no-properties 1)
                                css-property-ids))))
     (when property





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#44214: 28.0.50; css-mode: no completion in declaration with newline after
       [not found] ` <87blgp731t.fsf@simenheg@gmail.com>
@ 2020-10-26 21:57   ` Dmitry Gutov
  2020-10-27 14:21     ` Simen Heggestøyl
       [not found]     ` <87361zagw5.fsf@simenheg@gmail.com>
  0 siblings, 2 replies; 7+ messages in thread
From: Dmitry Gutov @ 2020-10-26 21:57 UTC (permalink / raw)
  To: Simen Heggestøyl; +Cc: 44214

On 26.10.2020 11:24, Simen Heggestøyl wrote:
> This seems sufficient to me. Would you like to test it out?

Seems to work, yeah!

Thank you.

BTW, is the case when (ppss-innermost-start (syntax-ppss)) is nil, at 
all reachable?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#44214: 28.0.50; css-mode: no completion in declaration with newline after
  2020-10-26 21:57   ` Dmitry Gutov
@ 2020-10-27 14:21     ` Simen Heggestøyl
       [not found]     ` <87361zagw5.fsf@simenheg@gmail.com>
  1 sibling, 0 replies; 7+ messages in thread
From: Simen Heggestøyl @ 2020-10-27 14:21 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 44214-done

Dmitry Gutov <dgutov@yandex.ru> writes:

> On 26.10.2020 11:24, Simen Heggestøyl wrote:
>> This seems sufficient to me. Would you like to test it out?
>
> Seems to work, yeah!

Nice, I've pushed the fix.

> BTW, is the case when (ppss-innermost-start (syntax-ppss)) is nil, at
> all reachable?

Yes, when called from top level.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#44214: 28.0.50; css-mode: no completion in declaration with newline after
       [not found]     ` <87361zagw5.fsf@simenheg@gmail.com>
@ 2020-10-27 21:06       ` Dmitry Gutov
  2020-10-27 21:11         ` Simen Heggestøyl
       [not found]         ` <87k0vb74sa.fsf@simenheg@gmail.com>
  0 siblings, 2 replies; 7+ messages in thread
From: Dmitry Gutov @ 2020-10-27 21:06 UTC (permalink / raw)
  To: 44214, simenheg

On 27.10.2020 16:21, Simen Heggestøyl wrote:
> Dmitry Gutov <dgutov@yandex.ru> writes:
> 
>> On 26.10.2020 11:24, Simen Heggestøyl wrote:
>>> This seems sufficient to me. Would you like to test it out?
>>
>> Seems to work, yeah!
> 
> Nice, I've pushed the fix.

Thanks! Seems to work.

>> BTW, is the case when (ppss-innermost-start (syntax-ppss)) is nil, at
>> all reachable?
> 
> Yes, when called from top level.

Should the search ever succeed in this case, though? I would suggest to 
use (point) instead of (point-min) to auto-fail:

diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 748a561bab..747657b1ed 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -1358,7 +1358,7 @@ css--complete-property-value
    "Complete property value at point."
    (let ((property (and (looking-back "\\([[:alnum:]-]+\\):[^/][^;]*"
                                       (or (ppss-innermost-start 
(syntax-ppss))
-                                         (point-min))
+                                         (point))
                                       t)
                         (member (match-string-no-properties 1)
                                 css-property-ids))))


Otherwise, we both do the costly-ish search from the bob, and even risk 
it succeed in rare cases where the CSS in the previous rule is 
incomplete (or the semicolon is omitted), e.g.:

a {
   animation-delay: inherit
}

cal|





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#44214: 28.0.50; css-mode: no completion in declaration with newline after
  2020-10-27 21:06       ` Dmitry Gutov
@ 2020-10-27 21:11         ` Simen Heggestøyl
       [not found]         ` <87k0vb74sa.fsf@simenheg@gmail.com>
  1 sibling, 0 replies; 7+ messages in thread
From: Simen Heggestøyl @ 2020-10-27 21:11 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 44214

Dmitry Gutov <dgutov@yandex.ru> writes:

>>> BTW, is the case when (ppss-innermost-start (syntax-ppss)) is nil, at
>>> all reachable?
>> Yes, when called from top level.
>
> Should the search ever succeed in this case, though? I would suggest
> to use (point) instead of (point-min) to auto-fail:
>
> [...]
>
> Otherwise, we both do the costly-ish search from the bob, and even
> risk it succeed in rare cases where the CSS in the previous rule is 
> incomplete (or the semicolon is omitted)

Good point, I didn't think about that.

Your proposed fixed looks good to me.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#44214: 28.0.50; css-mode: no completion in declaration with newline after
       [not found]         ` <87k0vb74sa.fsf@simenheg@gmail.com>
@ 2020-10-28  1:44           ` Dmitry Gutov
  0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Gutov @ 2020-10-28  1:44 UTC (permalink / raw)
  To: Simen Heggestøyl; +Cc: 44214

On 27.10.2020 23:11, Simen Heggestøyl wrote:
> Good point, I didn't think about that.
> 
> Your proposed fixed looks good to me.

Thanks, now pushed.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-10-28  1:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-25 20:41 bug#44214: 28.0.50; css-mode: no completion in declaration with newline after Dmitry Gutov
2020-10-26  9:24 ` Simen Heggestøyl
     [not found] ` <87blgp731t.fsf@simenheg@gmail.com>
2020-10-26 21:57   ` Dmitry Gutov
2020-10-27 14:21     ` Simen Heggestøyl
     [not found]     ` <87361zagw5.fsf@simenheg@gmail.com>
2020-10-27 21:06       ` Dmitry Gutov
2020-10-27 21:11         ` Simen Heggestøyl
     [not found]         ` <87k0vb74sa.fsf@simenheg@gmail.com>
2020-10-28  1:44           ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).