Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
July 31, 2014 Emacs d-mode cannot handle backquoted backslashe | ||||
---|---|---|---|---|
| ||||
Currently Emacs d-mode cannot correctly highlight `\` because it doesn't understand that single backslashes are self-contained in back-quoted strings. I believe this extract from d-mode.el (defvar d-mode-syntax-table nil "Syntax table used in d-mode buffers.") (or d-mode-syntax-table (setq d-mode-syntax-table (let ((table (funcall (c-lang-const c-make-mode-syntax-table d)))) ;; Make it recognize D `backquote strings` (modify-syntax-entry ?` "\"" table) ;; Make it recognize D's nested /+ +/ comments (modify-syntax-entry ?+ ". 23n" table) table))) is highly related to this problem but I don't understand the comment ;; Make it recognize D `backquote strings` Ideas on how to fix this anyone? |
July 31, 2014 Re: Emacs d-mode cannot handle backquoted backslashe | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw Attachments:
| On Thu, 2014-07-31 at 08:40 +0000, "Nordlöw" via Digitalmars-d-learn wrote: > Currently Emacs d-mode cannot correctly highlight > > `\` > > because it doesn't understand that single backslashes are self-contained in back-quoted strings. > > I believe this extract from d-mode.el > > (defvar d-mode-syntax-table nil > "Syntax table used in d-mode buffers.") > (or d-mode-syntax-table > (setq d-mode-syntax-table > (let ((table (funcall (c-lang-const c-make-mode-syntax-table > d)))) > ;; Make it recognize D `backquote strings` > (modify-syntax-entry ?` "\"" table) > > ;; Make it recognize D's nested /+ +/ comments > (modify-syntax-entry ?+ ". 23n" table) > table))) > > is highly related to this problem but I don't understand the comment > > ;; Make it recognize D `backquote strings` I think it is trying to convert ` to " internally since "…" is the string form for font-lock. Just at first sight I don't fully understand what is going on… :-( > Ideas on how to fix this anyone? Not just at the moment I'm afraid. I'll try and take a look at it tomorrow. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder |
July 31, 2014 Re: Emacs d-mode cannot handle backquoted backslashe | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russel Winder | On Thursday, 31 July 2014 at 09:20:28 UTC, Russel Winder via Digitalmars-d-learn wrote:
> Not just at the moment I'm afraid. I'll try and take a look at it
> tomorrow.
Great!
|
August 01, 2014 Re: Emacs d-mode cannot handle backquoted backslashe | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On Thursday, 31 July 2014 at 10:04:57 UTC, Nordlöw wrote: > Great! See also: https://stackoverflow.com/questions/25089090/emacs-d-mode-cannot-handle-backquoted-backslashes |
August 04, 2014 Re: Emacs d-mode cannot handle backquoted backslashe | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | I took a look and I don't really know if it's possible without using the Emacs > 24 only suggestion in the Stack Overflow comment to your question.
As far as I can see, before that Emacs syntax tables have a notion of what a string is and what an escape character is. The d-mode code adds the backtick as an alternative to double and single quotes but can't do anything about the backslash. Unless it disables backslash as an escape character everywhere.
I tried setting backtick to a function that returns "\"" instead of the value to see if I could then tailor the function to depend on whether not the point was in a backtick string but that didn't work since `modify-syntax-entry` checks to see if the argument is a string.
BTW, python-mode has the same problem, I checked with r"\".
Atila
On Thursday, 31 July 2014 at 08:40:12 UTC, Nordlöw wrote:
> Currently Emacs d-mode cannot correctly highlight
>
> `\`
>
> because it doesn't understand that single backslashes are self-contained in back-quoted strings.
>
> I believe this extract from d-mode.el
>
> (defvar d-mode-syntax-table nil
> "Syntax table used in d-mode buffers.")
> (or d-mode-syntax-table
> (setq d-mode-syntax-table
> (let ((table (funcall (c-lang-const c-make-mode-syntax-table d))))
> ;; Make it recognize D `backquote strings`
> (modify-syntax-entry ?` "\"" table)
>
> ;; Make it recognize D's nested /+ +/ comments
> (modify-syntax-entry ?+ ". 23n" table)
> table)))
>
> is highly related to this problem but I don't understand the comment
>
> ;; Make it recognize D `backquote strings`
>
> Ideas on how to fix this anyone?
|
August 12, 2014 Re: Emacs d-mode cannot handle backquoted backslashe | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On Friday, 1 August 2014 at 21:42:02 UTC, Nordlöw wrote: I just posted a d-mode.el fix to Russel Winder. See the recent posts at https://stackoverflow.com/questions/25089090/emacs-d-mode-cannot-handle-backquoted-backslashes If you can't wait ;) |
August 12, 2014 Re: Emacs d-mode cannot handle backquoted backslashe | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On Tuesday, 12 August 2014 at 17:28:25 UTC, Nordlöw wrote: And a PR: https://github.com/Emacs-D-Mode-Maintainers/Emacs-D-Mode/pull/22 |
August 12, 2014 Re: Emacs d-mode cannot handle backquoted backslashe | ||||
---|---|---|---|---|
| ||||
Posted in reply to Atila Neves Attachments:
| On Mon, 2014-08-04 at 12:25 +0000, Atila Neves via Digitalmars-d-learn wrote: > I took a look and I don't really know if it's possible without using the Emacs > 24 only suggestion in the Stack Overflow comment to your question. > > As far as I can see, before that Emacs syntax tables have a notion of what a string is and what an escape character is. The d-mode code adds the backtick as an alternative to double and single quotes but can't do anything about the backslash. Unless it disables backslash as an escape character everywhere. > > I tried setting backtick to a function that returns "\"" instead of the value to see if I could then tailor the function to depend on whether not the point was in a backtick string but that didn't work since `modify-syntax-entry` checks to see if the argument is a string. > > BTW, python-mode has the same problem, I checked with r"\". Per Nordlöw has offered a putative fix via a pull request. I'll check out the claim and if it seems to be true (and I fully expect it to be so) I'll accept the pull request. People using MELPA should see the new package quite quickly. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder |
August 13, 2014 Re: Emacs d-mode cannot handle backquoted backslashe | ||||
---|---|---|---|---|
| ||||
Attachments:
| On Tue, 2014-08-12 at 23:53 +0100, Russel Winder wrote: […] > Per Nordlöw has offered a putative fix via a pull request. I'll check out the claim and if it seems to be true (and I fully expect it to be so) I'll accept the pull request. People using MELPA should see the new package quite quickly. Fix committed to the mainline repository. Not sure how long it will take to get into MELPA. Should we release 2.0.7? -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder |
Copyright © 1999-2021 by the D Language Foundation