* RE: Making a non-ASCII space character visible [not found] ` <<fole90F986vU1@mid.individual.net> @ 2018-06-17 0:20 ` Drew Adams 0 siblings, 0 replies; 24+ messages in thread From: Drew Adams @ 2018-06-17 0:20 UTC (permalink / raw) To: gyliamos, help-gnu-emacs If you want, you can use library `highlight-chars.el' to do that. You can use it to highlight any chars, any way you want. You can do that globally or for specific buffers. https://www.emacswiki.org/emacs/download/highlight-chars.el https://www.emacswiki.org/emacs/ShowWhiteSpace#HighlightChars ^ permalink raw reply [flat|nested] 24+ messages in thread
* Making a non-ASCII space character visible @ 2018-06-16 20:15 Will Parsons 2018-06-16 21:37 ` Will Parsons ` (4 more replies) 0 siblings, 5 replies; 24+ messages in thread From: Will Parsons @ 2018-06-16 20:15 UTC (permalink / raw) To: help-gnu-emacs I have a desire to use the Unicode character A007 (FIGURE SPACE) in a document and to be able to distinguish it visually from a regular ASCII space. This seems to be already done in the case of 00A0 (NO-BREAK SPACE) which appears as an underscore with a distinctive face. It *looks* like I should be able to do this via the customization option "Whitespace Display Mappings", but no matter what I do, attempting to "Apply" the changes results in an error message, "This field should contain a single character". (This message occurs even if I try to change one of the display characters of an existing entry in the list and apply.) Feeling desperate, I copied the existing value of whitespace-display-mappings directly into my custom.el file, and manually added a new entry for A007 (8199) on the model of the existing entry for 00A0 (160), but this seems to have no effect on the display. (This is using Emacs 25, in case it should make a difference.) -- Will ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Making a non-ASCII space character visible 2018-06-16 20:15 Will Parsons @ 2018-06-16 21:37 ` Will Parsons 2018-06-17 4:31 ` Marcin Borkowski 2018-06-17 5:07 ` Michael Heerdegen ` (3 subsequent siblings) 4 siblings, 1 reply; 24+ messages in thread From: Will Parsons @ 2018-06-16 21:37 UTC (permalink / raw) To: help-gnu-emacs On Saturday, 16 Jun 2018 4:15 PM -0400, Will Parsons wrote: > I have a desire to use the Unicode character A007 (FIGURE SPACE) in a > document and to be able to distinguish it visually from a regular ASCII > space. This seems to be already done in the case of 00A0 (NO-BREAK > SPACE) which appears as an underscore with a distinctive face. > > It *looks* like I should be able to do this via the customization > option "Whitespace Display Mappings", but no matter what I do, > attempting to "Apply" the changes results in an error message, "This > field should contain a single character". (This message occurs even > if I try to change one of the display characters of an existing entry > in the list and apply.) > > Feeling desperate, I copied the existing value of > whitespace-display-mappings directly into my custom.el file, and > manually added a new entry for A007 (8199) on the model of the > existing entry for 00A0 (160), but this seems to have no effect on the > display. > > (This is using Emacs 25, in case it should make a difference.) Correction: FIGURE SPACE is actually 0x2007, not 0xA007, but that's simply a mistake in my post, not the actual code. (Sorry for not being more careful.) -- Will ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Making a non-ASCII space character visible 2018-06-16 21:37 ` Will Parsons @ 2018-06-17 4:31 ` Marcin Borkowski 0 siblings, 0 replies; 24+ messages in thread From: Marcin Borkowski @ 2018-06-17 4:31 UTC (permalink / raw) To: gyliamos; +Cc: help-gnu-emacs On 2018-06-16, at 23:37, Will Parsons <varro@nodomain.invalid> wrote: > On Saturday, 16 Jun 2018 4:15 PM -0400, Will Parsons wrote: >> I have a desire to use the Unicode character A007 (FIGURE SPACE) in a >> document and to be able to distinguish it visually from a regular ASCII >> space. This seems to be already done in the case of 00A0 (NO-BREAK >> SPACE) which appears as an underscore with a distinctive face. >> >> It *looks* like I should be able to do this via the customization >> option "Whitespace Display Mappings", but no matter what I do, >> attempting to "Apply" the changes results in an error message, "This >> field should contain a single character". (This message occurs even >> if I try to change one of the display characters of an existing entry >> in the list and apply.) >> >> Feeling desperate, I copied the existing value of >> whitespace-display-mappings directly into my custom.el file, and >> manually added a new entry for A007 (8199) on the model of the >> existing entry for 00A0 (160), but this seems to have no effect on the >> display. >> >> (This is using Emacs 25, in case it should make a difference.) > > Correction: FIGURE SPACE is actually 0x2007, not 0xA007, but that's > simply a mistake in my post, not the actual code. (Sorry for not > being more careful.) How about good old M-s h r (highlight-regexp)? Hth, -- Marcin Borkowski http://mbork.pl ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Making a non-ASCII space character visible 2018-06-16 20:15 Will Parsons 2018-06-16 21:37 ` Will Parsons @ 2018-06-17 5:07 ` Michael Heerdegen 2018-06-17 5:55 ` Eli Zaretskii [not found] ` <mailman.2110.1529214934.1292.help-gnu-emacs@gnu.org> 2018-06-17 6:00 ` Eli Zaretskii ` (2 subsequent siblings) 4 siblings, 2 replies; 24+ messages in thread From: Michael Heerdegen @ 2018-06-17 5:07 UTC (permalink / raw) To: gyliamos; +Cc: help-gnu-emacs Will Parsons <varro@nodomain.invalid> writes: > I have a desire to use the Unicode character A007 (FIGURE SPACE) in a > document and to be able to distinguish it visually from a regular ASCII > space. This seems to be already done in the case of 00A0 (NO-BREAK > SPACE) which appears as an underscore with a distinctive face. > > It *looks* like I should be able to do this via the customization > option "Whitespace Display Mappings", but no matter what I do, > attempting to "Apply" the changes results in an error message, "This > field should contain a single character". Seems you tried to insert a printed representation of the character? AFAIK you must insert the character. You can achieve this with M-: (insert ?\x2007) for example. Yes, that's not so nice. > Feeling desperate, I copied the existing value of > whitespace-display-mappings directly into my custom.el file, and > manually added a new entry for A007 (8199) on the model of the > existing entry for 00A0 (160), but this seems to have no effect on the > display. If you did it right, note that you must re-enable `whitespace-mode' to give it a chance to update the `buffer-display-table'. That doesn't happen automatically. Michael. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Making a non-ASCII space character visible 2018-06-17 5:07 ` Michael Heerdegen @ 2018-06-17 5:55 ` Eli Zaretskii 2018-06-17 6:24 ` Michael Heerdegen [not found] ` <mailman.2110.1529214934.1292.help-gnu-emacs@gnu.org> 1 sibling, 1 reply; 24+ messages in thread From: Eli Zaretskii @ 2018-06-17 5:55 UTC (permalink / raw) To: help-gnu-emacs > From: Michael Heerdegen <michael_heerdegen@web.de> > Date: Sun, 17 Jun 2018 07:07:30 +0200 > Cc: help-gnu-emacs@gnu.org > > Will Parsons <varro@nodomain.invalid> writes: > > > I have a desire to use the Unicode character A007 (FIGURE SPACE) in a > > document and to be able to distinguish it visually from a regular ASCII > > space. This seems to be already done in the case of 00A0 (NO-BREAK > > SPACE) which appears as an underscore with a distinctive face. > > > > It *looks* like I should be able to do this via the customization > > option "Whitespace Display Mappings", but no matter what I do, > > attempting to "Apply" the changes results in an error message, "This > > field should contain a single character". > > Seems you tried to insert a printed representation of the character? > AFAIK you must insert the character. You can achieve this with M-: > (insert ?\x2007) for example. Yes, that's not so nice. ??? How does that differ from "C-x 8 RET 2007 RET"? The latter is the standard way of inserting characters in Emacs. If you did succeed to customize that variable, can you show a step by step recipe? ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Making a non-ASCII space character visible 2018-06-17 5:55 ` Eli Zaretskii @ 2018-06-17 6:24 ` Michael Heerdegen 2018-06-17 6:41 ` Eli Zaretskii ` (2 more replies) 0 siblings, 3 replies; 24+ messages in thread From: Michael Heerdegen @ 2018-06-17 6:24 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs Eli Zaretskii <eliz@gnu.org> writes: > > Seems you tried to insert a printed representation of the character? > > AFAIK you must insert the character. You can achieve this with M-: > > (insert ?\x2007) for example. Yes, that's not so nice. > > ??? How does that differ from "C-x 8 RET 2007 RET"? The latter is the > standard way of inserting characters in Emacs. Sure. With "not so nice" I meant "not so nice that it doesn't just accept read syntaxes of characters. > If you did succeed to customize that variable, can you show a step by > step recipe? I was wrong, we have a bug here. The custom interface doesn't even accept the unmodified default value (just make a change, undo, and try to "Set for current session"). It seems it has a problem with the value field containing the newline character - that seems to be read as empty string, and that later fails the validation test. Michael. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Making a non-ASCII space character visible 2018-06-17 6:24 ` Michael Heerdegen @ 2018-06-17 6:41 ` Eli Zaretskii 2018-06-17 6:41 ` Michael Heerdegen [not found] ` <mailman.2115.1529217694.1292.help-gnu-emacs@gnu.org> 2 siblings, 0 replies; 24+ messages in thread From: Eli Zaretskii @ 2018-06-17 6:41 UTC (permalink / raw) To: help-gnu-emacs > From: Michael Heerdegen <michael_heerdegen@web.de> > Cc: help-gnu-emacs@gnu.org > Date: Sun, 17 Jun 2018 08:24:57 +0200 > > > If you did succeed to customize that variable, can you show a step by > > step recipe? > > I was wrong, we have a bug here. > > The custom interface doesn't even accept the unmodified default value > (just make a change, undo, and try to "Set for current session"). It > seems it has a problem with the value field containing the newline > character - that seems to be read as empty string, and that later fails > the validation test. That was also my conclusion, so please file a bug report about this. Thanks. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Making a non-ASCII space character visible 2018-06-17 6:24 ` Michael Heerdegen 2018-06-17 6:41 ` Eli Zaretskii @ 2018-06-17 6:41 ` Michael Heerdegen [not found] ` <mailman.2115.1529217694.1292.help-gnu-emacs@gnu.org> 2 siblings, 0 replies; 24+ messages in thread From: Michael Heerdegen @ 2018-06-17 6:41 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs Michael Heerdegen <michael_heerdegen@web.de> writes: > I was wrong, we have a bug here. > > The custom interface doesn't even accept the unmodified default value > (just make a change, undo, and try to "Set for current session"). It > seems it has a problem with the value field containing the newline > character - that seems to be read as empty string, and that later fails > the validation test. Reported as bug#31869. Michael. ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <mailman.2115.1529217694.1292.help-gnu-emacs@gnu.org>]
* Re: Making a non-ASCII space character visible [not found] ` <mailman.2115.1529217694.1292.help-gnu-emacs@gnu.org> @ 2018-06-19 0:45 ` Will Parsons 2018-06-19 1:01 ` Noam Postavsky [not found] ` <mailman.2220.1529370113.1292.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 24+ messages in thread From: Will Parsons @ 2018-06-19 0:45 UTC (permalink / raw) To: help-gnu-emacs On Sunday, 17 Jun 2018 2:41 AM -0400, Michael Heerdegen wrote: > Michael Heerdegen <michael_heerdegen@web.de> writes: > >> I was wrong, we have a bug here. >> >> The custom interface doesn't even accept the unmodified default value >> (just make a change, undo, and try to "Set for current session"). It >> seems it has a problem with the value field containing the newline >> character - that seems to be read as empty string, and that later fails >> the validation test. > > Reported as bug#31869. While I'm glad that I've helped to identify a bug in Emacs, I'm curious on how I should be able to track the progress of the bug report. Doing a search on (e.g.) "emacs bug 31869" seems to result in no useful results. -- Will ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Making a non-ASCII space character visible 2018-06-19 0:45 ` Will Parsons @ 2018-06-19 1:01 ` Noam Postavsky [not found] ` <mailman.2220.1529370113.1292.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 24+ messages in thread From: Noam Postavsky @ 2018-06-19 1:01 UTC (permalink / raw) To: gyliamos; +Cc: Help Gnu Emacs mailing list On 18 June 2018 at 20:45, Will Parsons <varro@nodomain.invalid> wrote: >> Reported as bug#31869. > > While I'm glad that I've helped to identify a bug in Emacs, I'm > curious on how I should be able to track the progress of the bug > report. Doing a search on (e.g.) "emacs bug 31869" seems to result in > no useful results. You can find the report at https://debbugs.gnu.org/31869 There's unfortunately no great way of tracking it (that is, receiving notifications about changes) at the moment apart from subscribing to the bug list as a whole. https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <mailman.2220.1529370113.1292.help-gnu-emacs@gnu.org>]
* Re: Making a non-ASCII space character visible [not found] ` <mailman.2220.1529370113.1292.help-gnu-emacs@gnu.org> @ 2018-06-19 1:26 ` Will Parsons 0 siblings, 0 replies; 24+ messages in thread From: Will Parsons @ 2018-06-19 1:26 UTC (permalink / raw) To: help-gnu-emacs On Monday, 18 Jun 2018 9:01 PM -0400, Noam Postavsky wrote: > On 18 June 2018 at 20:45, Will Parsons <varro@nodomain.invalid> wrote: > >>> Reported as bug#31869. >> >> While I'm glad that I've helped to identify a bug in Emacs, I'm >> curious on how I should be able to track the progress of the bug >> report. Doing a search on (e.g.) "emacs bug 31869" seems to result in >> no useful results. > > You can find the report at https://debbugs.gnu.org/31869 > > There's unfortunately no great way of tracking it (that is, receiving > notifications about changes) at the moment apart from subscribing to > the bug list as a whole. > > https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs Thank you for that information. -- Will ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <mailman.2110.1529214934.1292.help-gnu-emacs@gnu.org>]
* Re: Making a non-ASCII space character visible [not found] ` <mailman.2110.1529214934.1292.help-gnu-emacs@gnu.org> @ 2018-06-17 18:54 ` Will Parsons 0 siblings, 0 replies; 24+ messages in thread From: Will Parsons @ 2018-06-17 18:54 UTC (permalink / raw) To: help-gnu-emacs On Sunday, 17 Jun 2018 1:55 AM -0400, Eli Zaretskii wrote: >> From: Michael Heerdegen <michael_heerdegen@web.de> >> Date: Sun, 17 Jun 2018 07:07:30 +0200 >> Cc: help-gnu-emacs@gnu.org >> >> Will Parsons <varro@nodomain.invalid> writes: >> >> > I have a desire to use the Unicode character A007 (FIGURE SPACE) in a >> > document and to be able to distinguish it visually from a regular ASCII >> > space. This seems to be already done in the case of 00A0 (NO-BREAK >> > SPACE) which appears as an underscore with a distinctive face. >> > >> > It *looks* like I should be able to do this via the customization >> > option "Whitespace Display Mappings", but no matter what I do, >> > attempting to "Apply" the changes results in an error message, "This >> > field should contain a single character". >> >> Seems you tried to insert a printed representation of the character? >> AFAIK you must insert the character. You can achieve this with M-: >> (insert ?\x2007) for example. Yes, that's not so nice. > > ??? How does that differ from "C-x 8 RET 2007 RET"? The latter is the > standard way of inserting characters in Emacs. > > If you did succeed to customize that variable, can you show a step by > step recipe? As I stated in my original post, I manually edited my custom.el file. That seems to have succeeded, because if I display the variable whitespace-display-mappings, I see: Value: ((space-mark 32 [183] [46]) (space-mark 160 [164] [95]) (space-mark 8199 [164] [95]) (newline-mark 10 [36 10]) (tab-mark 9 [187 9] [92 9])) Original value was ((space-mark 32 [183] [46]) (space-mark 160 [164] [95]) (newline-mark 10 [36 10]) (tab-mark 9 [187 9] [92 9])) -- Will ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Making a non-ASCII space character visible 2018-06-16 20:15 Will Parsons 2018-06-16 21:37 ` Will Parsons 2018-06-17 5:07 ` Michael Heerdegen @ 2018-06-17 6:00 ` Eli Zaretskii [not found] ` <mailman.2111.1529215267.1292.help-gnu-emacs@gnu.org> [not found] ` <mailman.2107.1529212061.1292.help-gnu-emacs@gnu.org> 4 siblings, 0 replies; 24+ messages in thread From: Eli Zaretskii @ 2018-06-17 6:00 UTC (permalink / raw) To: help-gnu-emacs > From: Will Parsons <varro@nodomain.invalid> > Date: Sat, 16 Jun 2018 16:15:59 -0400 > > I have a desire to use the Unicode character A007 (FIGURE SPACE) in a > document and to be able to distinguish it visually from a regular ASCII > space. This seems to be already done in the case of 00A0 (NO-BREAK > SPACE) which appears as an underscore with a distinctive face. > > It *looks* like I should be able to do this via the customization > option "Whitespace Display Mappings", but no matter what I do, > attempting to "Apply" the changes results in an error message, "This > field should contain a single character". (This message occurs even > if I try to change one of the display characters of an existing entry > in the list and apply.) Whitespace Display Mappings only has effect if you turn on whitespace-mode. The special display of u+00A0 does not require whitespace-mode, it is implemented directly in the display engine. Maybe we should extend that built-in treatment to the other "space-like" characters. > Feeling desperate, I copied the existing value of > whitespace-display-mappings directly into my custom.el file, and > manually added a new entry for A007 (8199) on the model of the > existing entry for 00A0 (160), but this seems to have no effect on the > display. Did you also turn on whitespace-mode? ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <mailman.2111.1529215267.1292.help-gnu-emacs@gnu.org>]
* Re: Making a non-ASCII space character visible [not found] ` <mailman.2111.1529215267.1292.help-gnu-emacs@gnu.org> @ 2018-06-17 18:38 ` Will Parsons 2018-06-17 18:51 ` Eli Zaretskii [not found] ` <mailman.2145.1529261474.1292.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 24+ messages in thread From: Will Parsons @ 2018-06-17 18:38 UTC (permalink / raw) To: help-gnu-emacs On Sunday, 17 Jun 2018 2:00 AM -0400, Eli Zaretskii wrote: >> From: Will Parsons <varro@nodomain.invalid> >> Date: Sat, 16 Jun 2018 16:15:59 -0400 >> >> I have a desire to use the Unicode character A007 (FIGURE SPACE) in a >> document and to be able to distinguish it visually from a regular ASCII >> space. This seems to be already done in the case of 00A0 (NO-BREAK >> SPACE) which appears as an underscore with a distinctive face. >> >> It *looks* like I should be able to do this via the customization >> option "Whitespace Display Mappings", but no matter what I do, >> attempting to "Apply" the changes results in an error message, "This >> field should contain a single character". (This message occurs even >> if I try to change one of the display characters of an existing entry >> in the list and apply.) > > Whitespace Display Mappings only has effect if you turn on > whitespace-mode. The special display of u+00A0 does not require > whitespace-mode, it is implemented directly in the display engine. > Maybe we should extend that built-in treatment to the other > "space-like" characters. OK - that explains the difference I see between the display of u+00A0 and u+2007, but now I'm even more confused about activating whitespace-mode: What I have had in my .emacs file for years is the following: (global-whitespace-mode 1) (setq-default whitespace-style '(face lines-tail tabs trailing)) Examining the value of whitespace-mode shows nil, however. Adding (whitespace-mode 1) to my .emacs file apparently has no effect; the value of whitespace-mode is still nil. Now if I interactively run the command "whitespace-mode", the value of the variable whitespace-mode turns to t, but the display of u+2007 remains unchanged. >> Feeling desperate, I copied the existing value of >> whitespace-display-mappings directly into my custom.el file, and >> manually added a new entry for A007 (8199) on the model of the >> existing entry for 00A0 (160), but this seems to have no effect on the >> display. > > Did you also turn on whitespace-mode? See above. -- Will ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Making a non-ASCII space character visible 2018-06-17 18:38 ` Will Parsons @ 2018-06-17 18:51 ` Eli Zaretskii [not found] ` <mailman.2145.1529261474.1292.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 24+ messages in thread From: Eli Zaretskii @ 2018-06-17 18:51 UTC (permalink / raw) To: help-gnu-emacs > From: Will Parsons <varro@nodomain.invalid> > Date: Sun, 17 Jun 2018 14:38:01 -0400 > > What I have had in my .emacs file for years is the following: > > (global-whitespace-mode 1) > (setq-default whitespace-style '(face lines-tail tabs trailing)) > > Examining the value of whitespace-mode shows nil, however. global-whitespace-mode (the function) sets global-whitespace-mode (the variable), not whitespace-mode. > Adding (whitespace-mode 1) to my .emacs file apparently has no effect; > the value of whitespace-mode is still nil. In what buffer? > Now if I interactively run the command "whitespace-mode", the value of > the variable whitespace-mode turns to t, but the display of u+2007 > remains unchanged. How did you change the mappings for this character to be part of the display mappings? ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <mailman.2145.1529261474.1292.help-gnu-emacs@gnu.org>]
* Re: Making a non-ASCII space character visible [not found] ` <mailman.2145.1529261474.1292.help-gnu-emacs@gnu.org> @ 2018-06-17 19:09 ` Will Parsons 2018-06-17 19:31 ` Eli Zaretskii [not found] ` <mailman.2147.1529263896.1292.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 24+ messages in thread From: Will Parsons @ 2018-06-17 19:09 UTC (permalink / raw) To: help-gnu-emacs On Sunday, 17 Jun 2018 2:51 PM -0400, Eli Zaretskii wrote: >> From: Will Parsons <varro@nodomain.invalid> >> Date: Sun, 17 Jun 2018 14:38:01 -0400 >> >> What I have had in my .emacs file for years is the following: >> >> (global-whitespace-mode 1) >> (setq-default whitespace-style '(face lines-tail tabs trailing)) >> >> Examining the value of whitespace-mode shows nil, however. > > global-whitespace-mode (the function) sets global-whitespace-mode (the > variable), not whitespace-mode. So, using the function global-whitespace-mode is *not* the way to enable whitespace mode? I find that confusing; where would use one vs the other? >> Adding (whitespace-mode 1) to my .emacs file apparently has no effect; >> the value of whitespace-mode is still nil. > > In what buffer? In any buffer. >> Now if I interactively run the command "whitespace-mode", the value of >> the variable whitespace-mode turns to t, but the display of u+2007 >> remains unchanged. > > How did you change the mappings for this character to be part of the > display mappings? As I stated elsewhere, by manually editing my customization file. (And I can see the change via the regular Customization interface under Whitespace Display Mappings - the added character is displayed like a space, but I can run describe-char on it and see the 2007.) -- Will ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Making a non-ASCII space character visible 2018-06-17 19:09 ` Will Parsons @ 2018-06-17 19:31 ` Eli Zaretskii [not found] ` <mailman.2147.1529263896.1292.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 24+ messages in thread From: Eli Zaretskii @ 2018-06-17 19:31 UTC (permalink / raw) To: help-gnu-emacs > From: Will Parsons <varro@nodomain.invalid> > Date: Sun, 17 Jun 2018 15:09:00 -0400 > > > global-whitespace-mode (the function) sets global-whitespace-mode (the > > variable), not whitespace-mode. > > So, using the function global-whitespace-mode is *not* the way to > enable whitespace mode? It enables global-whitespace-mode. > I find that confusing; where would use one vs the other? One is global, the other is local to the buffer in which you turn it on. > >> Adding (whitespace-mode 1) to my .emacs file apparently has no effect; > >> the value of whitespace-mode is still nil. > > > > In what buffer? > > In any buffer. We are mis-communicating. My point was that the above only turns the mode on in the buffer that happened to be current when the expression was evaluated. And that is not what you want, so whitespace-mode should normally be turned on from some major-mode hook. > As I stated elsewhere, by manually editing my customization file. > (And I can see the change via the regular Customization interface > under Whitespace Display Mappings - the added character is displayed > like a space, but I can run describe-char on it and see the 2007.) If I copy the into *scratch* value of the defcustom converted to a setq expression, add to it the customization for u+2007, evaluate the expression, and then re-enable whitespace-mode, I do see it take effect: the u+2007 character is displayed as the NBSP is. So I'm unsure why it isn't working for you. ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <mailman.2147.1529263896.1292.help-gnu-emacs@gnu.org>]
* Re: Making a non-ASCII space character visible [not found] ` <mailman.2147.1529263896.1292.help-gnu-emacs@gnu.org> @ 2018-06-17 20:28 ` Will Parsons 2018-06-18 1:40 ` Nick Helm [not found] ` <mailman.2154.1529286048.1292.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 24+ messages in thread From: Will Parsons @ 2018-06-17 20:28 UTC (permalink / raw) To: help-gnu-emacs On Sunday, 17 Jun 2018 3:31 PM -0400, Eli Zaretskii wrote: >> From: Will Parsons <varro@nodomain.invalid> >> Date: Sun, 17 Jun 2018 15:09:00 -0400 >> >> > global-whitespace-mode (the function) sets global-whitespace-mode (the >> > variable), not whitespace-mode. >> >> So, using the function global-whitespace-mode is *not* the way to >> enable whitespace mode? > > It enables global-whitespace-mode. > >> I find that confusing; where would use one vs the other? > > One is global, the other is local to the buffer in which you turn it > on. I sorry if I seem to be a bit dense here, but if global-whitespace-mode doesn't enable whitespace-mode globally, what is it good for? >> >> Adding (whitespace-mode 1) to my .emacs file apparently has no effect; >> >> the value of whitespace-mode is still nil. >> > >> > In what buffer? >> >> In any buffer. > > We are mis-communicating. My point was that the above only turns the > mode on in the buffer that happened to be current when the expression > was evaluated. And that is not what you want, so whitespace-mode > should normally be turned on from some major-mode hook. So, adding (whitespace-mode 1) to my ~/.emacs file is useless unless I add it to a major-mode hook, and that I have to do that for every major-mode I use? I can't just say "enable whitespace-mode for all buffers unless I say otherwise" then? >> As I stated elsewhere, by manually editing my customization file. >> (And I can see the change via the regular Customization interface >> under Whitespace Display Mappings - the added character is displayed >> like a space, but I can run describe-char on it and see the 2007.) > > If I copy the into *scratch* value of the defcustom converted to a > setq expression, add to it the customization for u+2007, evaluate the > expression, and then re-enable whitespace-mode, I do see it take > effect: the u+2007 character is displayed as the NBSP is. I'm afraid I'm completely lost here. > So I'm unsure why it isn't working for you. Apart from how to enable whitespace-mode automatically, I'd like to understand how that: 1) The character u+2007 (8199) has been verified to have been added to whitespace-display-mappings. 2) Even after running manually M-x whitespace-mode and verifying that the variable whitespace-mode is now set to t, the display of u+2007 doesn't change in the current buffer. -- Will ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Making a non-ASCII space character visible 2018-06-17 20:28 ` Will Parsons @ 2018-06-18 1:40 ` Nick Helm [not found] ` <mailman.2154.1529286048.1292.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 24+ messages in thread From: Nick Helm @ 2018-06-18 1:40 UTC (permalink / raw) To: gyliamos; +Cc: help-gnu-emacs On Mon, 18 Jun 2018 at 08:28:18 +1200, Will Parsons wrote: > I sorry if I seem to be a bit dense here, but if > global-whitespace-mode doesn't enable whitespace-mode globally, what > is it good for? > So, adding (whitespace-mode 1) to my ~/.emacs file is useless unless I > add it to a major-mode hook, and that I have to do that for every > major-mode I use? I can't just say "enable whitespace-mode for all > buffers unless I say otherwise" then? > I'm afraid I'm completely lost here. > Apart from how to enable whitespace-mode automatically, I'd like to > understand how that: > > 1) The character u+2007 (8199) has been verified to have been added to > whitespace-display-mappings. > > 2) Even after running manually M-x whitespace-mode and verifying that > the variable whitespace-mode is now set to t, the display of u+2007 > doesn't change in the current buffer. Think of whitespace-mode and global-whitespace-mode as two different modes. Doing M-x whitespace-mode will show whitespace chars only within the buffer that was current when when you called the command. Doing the same command a second time will toggle whitespace-mode off again. When a window shows a buffer that has whitespace-mode active, "ws" (lower case) will appear in the mode-line. Doing M-x global-whitespace-mode will show whitespace chars in all buffers (with a few exceptions). Doing the same command a second time will toggle global-whitespace-mode off again in all buffers. When global-whitespace-mode is active, "WS" (upper case) shows in all mode-lines as it is active in all buffers. The two modes work cooperatively, so you can, for example, turn on global-whitespace-mode everywhere, then toggle whitespace-mode off to hide whitespace chars in a particular buffer. There are also two variables with (confusingly) the same names as the functions that control the modes, i.e. whitespace-mode and global-whitespace-mode. Ignore these variables for now, they cannot control the modes, only tell you what state each mode is in. When enabling the modes from lisp, it works slightly differently. You need to call the functions `whitespace-mode' and `global-whitespace-mode' with an argument to turn the modes on and off. For instance, if global-whitespace-mode is off and you evaluate this (using C-x C-e): (global-whitespace-mode 1) Emacs will turn the mode on in all buffers. Evaling it again will have no effect as the mode is already active. To turn it off, you would eval: (global-whitespace-mode -1) Similarly, if you want to turn on whitespace-mode in a particular buffer, you need to eval the function within the buffer you're interested in. For example, evaling this in *scratch* will only turn it on in *scratch*: (whitespace-mode 1) This is why adding (whitespace-mode 1) to your ~/.emacs file by itself doesn't work. Emacs has activated the mode in whatever buffer happened to be current when it started up, which is unlikely to be a buffer you're interested in. So to active it automatically everywhere all the time, you would add: (global-whitespace-mode 1) to your ~/.emacs file. Or, if you want to activate it only for specific modes, you would use a mode hook to turn on whitespace-mode just for buffers that use that specific mode. However, because you want to visualise some non-standard characters, before you turn on either of the whitespace modes, you need to tell Emacs what you want it to display. That's what the variable whitespace-display-mappings is for. This is a global variable, it's value is the same regardless of whether you're using whitespace-mode or global-whitespace-mode. As you've already worked out, you would change this variable to remap the char you're interested in, but you need to make sure you set the variable before you turn the mode on. So you would have something like the following in your ~/.emacs: (setq whitespace-display-mappings '((space-mark 32 [183] [46]) (space-mark 160 [164] [95]) (space-mark 8199 [164] [95]) (newline-mark 10 [36 10]) (tab-mark 9 [187 9] [92 9]))) (global-whitespace-mode 1) In addition to the defaults, this tells Emacs to map FIGURE SPACE (8199) to CURRENCY SIGN (164) when either whitespace-mode or global-whitespace-mode is active. BTW, if you want to visualise the FIGURE SPACEs differently you can change the 164 in (space-mark 8199 [164] [95]) to the codepoint for whatever char you like. That should be all you need to get this working. Normally, you could do all this through customize, but as pointed out up-thread, this isn't working as expected. Fortunately, you can do this entirely in your ~/.emacs file with the lines above, but it might pay to temporarily disable any other settings related to whitespace in your custom.el and ~/.emacs while you get things working. ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <mailman.2154.1529286048.1292.help-gnu-emacs@gnu.org>]
* Re: Making a non-ASCII space character visible [not found] ` <mailman.2154.1529286048.1292.help-gnu-emacs@gnu.org> @ 2018-06-19 0:12 ` Will Parsons 2018-06-19 2:30 ` Nick Helm [not found] ` <mailman.2227.1529375463.1292.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 24+ messages in thread From: Will Parsons @ 2018-06-19 0:12 UTC (permalink / raw) To: help-gnu-emacs On Sunday, 17 Jun 2018 9:40 PM -0400, Nick Helm wrote: > On Mon, 18 Jun 2018 at 08:28:18 +1200, Will Parsons wrote: > >> I sorry if I seem to be a bit dense here, but if >> global-whitespace-mode doesn't enable whitespace-mode globally, what >> is it good for? > >> So, adding (whitespace-mode 1) to my ~/.emacs file is useless unless I >> add it to a major-mode hook, and that I have to do that for every >> major-mode I use? I can't just say "enable whitespace-mode for all >> buffers unless I say otherwise" then? > >> I'm afraid I'm completely lost here. > >> Apart from how to enable whitespace-mode automatically, I'd like to >> understand how that: >> >> 1) The character u+2007 (8199) has been verified to have been added to >> whitespace-display-mappings. >> >> 2) Even after running manually M-x whitespace-mode and verifying that >> the variable whitespace-mode is now set to t, the display of u+2007 >> doesn't change in the current buffer. > > Think of whitespace-mode and global-whitespace-mode as two different modes. > > Doing M-x whitespace-mode will show whitespace chars only within the buffer that > was current when when you called the command. Doing the same command a second > time will toggle whitespace-mode off again. When a window shows a buffer that has > whitespace-mode active, "ws" (lower case) will appear in the mode-line. > > Doing M-x global-whitespace-mode will show whitespace chars in all buffers (with > a few exceptions). Doing the same command a second time will toggle > global-whitespace-mode off again in all buffers. When global-whitespace-mode is > active, "WS" (upper case) shows in all mode-lines as it is active in all > buffers. > > The two modes work cooperatively, so you can, for example, turn on > global-whitespace-mode everywhere, then toggle whitespace-mode off to hide > whitespace chars in a particular buffer. That makes sense, and is kind of like what I would have expected. > There are also two variables with (confusingly) the same names as the functions > that control the modes, i.e. whitespace-mode and global-whitespace-mode. Ignore > these variables for now, they cannot control the modes, only tell you what state > each mode is in. Yes - I had managed to figure that out. > When enabling the modes from lisp, it works slightly differently. You need to > call the functions `whitespace-mode' and `global-whitespace-mode' with an > argument to turn the modes on and off. For instance, if global-whitespace-mode > is off and you evaluate this (using C-x C-e): > > (global-whitespace-mode 1) > > Emacs will turn the mode on in all buffers. Evaling it again will have no effect > as the mode is already active. To turn it off, you would eval: > > (global-whitespace-mode -1) > > Similarly, if you want to turn on whitespace-mode in a particular buffer, you > need to eval the function within the buffer you're interested in. For example, > evaling this in *scratch* will only turn it on in *scratch*: > > (whitespace-mode 1) > > This is why adding (whitespace-mode 1) to your ~/.emacs file by itself doesn't > work. Emacs has activated the mode in whatever buffer happened to be current > when it started up, which is unlikely to be a buffer you're interested in. So to > active it automatically everywhere all the time, you would add: > > (global-whitespace-mode 1) > > to your ~/.emacs file. Or, if you want to activate it only for specific modes, > you would use a mode hook to turn on whitespace-mode just for buffers that use > that specific mode. > > However, because you want to visualise some non-standard characters, before you > turn on either of the whitespace modes, you need to tell Emacs what you want it > to display. That's what the variable whitespace-display-mappings is for. This is > a global variable, it's value is the same regardless of whether you're using > whitespace-mode or global-whitespace-mode. > > As you've already worked out, you would change this variable to remap the char > you're interested in, but you need to make sure you set the variable before you > turn the mode on. So you would have something like the following in your > ~/.emacs: > > (setq whitespace-display-mappings '((space-mark 32 [183] [46]) > (space-mark 160 [164] [95]) > (space-mark 8199 [164] [95]) > (newline-mark 10 [36 10]) > (tab-mark 9 [187 9] [92 9]))) > (global-whitespace-mode 1) This is valuable information. I see that I got that wrong in that I had: (global-whitespace-mode 1) (setq-default whitespace-style '(face lines-tail tabs trailing)) in the body of my ~/.emacs file, but that I had: (setq custom-file "~/.emacs.d/custom.el") (if (file-exists-p custom-file) (load-file custom-file)) at the very end, and that I had put the setting of whitespace-display-mappings in ~/.emacs.d/custom.el. > In addition to the defaults, this tells Emacs to map FIGURE SPACE (8199) to > CURRENCY SIGN (164) when either whitespace-mode or global-whitespace-mode is > active. BTW, if you want to visualise the FIGURE SPACEs differently you can > change the 164 in (space-mark 8199 [164] [95]) to the codepoint for whatever > char you like. > > That should be all you need to get this working. Normally, you could do all this > through customize, but as pointed out up-thread, this isn't working as expected. > Fortunately, you can do this entirely in your ~/.emacs file with the lines > above, but it might pay to temporarily disable any other settings related to > whitespace in your custom.el and ~/.emacs while you get things working. OK - I have now modified my .emacs file to have the following lines: ------- (setq whitespace-display-mappings '((space-mark 32 [183] [46]) (space-mark 160 [164] [95]) (space-mark 8199 [164] [95]) (newline-mark 10 [36 10]) (tab-mark 9 [187 9] [92 9]))) (global-whitespace-mode 1) (setq-default whitespace-style '(face lines-tail tabs trailing)) ------- I have removed the setting of whitespace-display-mappings that I had previously manually introduced to custom.el, and the only other setting that appears to reference whitespace is the setting (whitespace-tab ((t (:background "#081820" :foreground "darkgray"))) in my custom.el file, which I have now removed. Unfortunately, after making these changes, and having restarted Emacs, there is still no change to the display of u+2007. Despite my frustration about not achieving my aim, I thank you for your very detailed explanation of the relationship between whitespace-mode and global-whitespace-mode, which, although it hasn't actually led me to a solution to my problem, has been very helpful for my understanding of how whitespace-mode works. -- Will ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Making a non-ASCII space character visible 2018-06-19 0:12 ` Will Parsons @ 2018-06-19 2:30 ` Nick Helm [not found] ` <mailman.2227.1529375463.1292.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 24+ messages in thread From: Nick Helm @ 2018-06-19 2:30 UTC (permalink / raw) To: gyliamos; +Cc: help-gnu-emacs On Tue, 19 Jun 2018 at 12:12:29 +1200, Will Parsons wrote: > OK - I have now modified my .emacs file to have the following lines: > > ------- > (setq whitespace-display-mappings '((space-mark 32 [183] [46]) > (space-mark 160 [164] [95]) > (space-mark 8199 [164] [95]) > (newline-mark 10 [36 10]) > (tab-mark 9 [187 9] [92 9]))) > (global-whitespace-mode 1) > (setq-default whitespace-style '(face lines-tail tabs trailing)) > ------- > > I have removed the setting of whitespace-display-mappings that I had > previously manually introduced to custom.el, and the only other > setting that appears to reference whitespace is the setting > > (whitespace-tab ((t (:background "#081820" :foreground "darkgray"))) > > in my custom.el file, which I have now removed. > > Unfortunately, after making these changes, and having restarted Emacs, > there is still no change to the display of u+2007. This looks good, just a couple more things to tweak. You need to turn on visualising of space characters by adding "space-mark" to whitespace-style: (setq-default whitespace-style '(face lines-tail space-mark tabs trailing)) This variable tells whitespace-mode and global-whitespace-mode which classes of chars you want to visualise when one of the modes is active. The space-mark entry tells Emacs to visualise the various space-mark chars you set up with whitespace-display-mappings, in partiuclar your new entry for FIGURE SPACEs. The only other thing is don't forget to put the expressions that set the configuration variables (the setqs) before you active the mode, something like this: (setq whitespace-display-mappings '((space-mark 32 [183] [46]) (space-mark 160 [164] [95]) (space-mark 8199 [164] [95]) (newline-mark 10 [36 10]) (tab-mark 9 [187 9] [92 9]))) (setq-default whitespace-style '(face lines-tail space-mark tabs trailing)) (global-whitespace-mode 1) Try this in your ~/.emacs, cross fingers and restart Emacs. ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <mailman.2227.1529375463.1292.help-gnu-emacs@gnu.org>]
* Re: Making a non-ASCII space character visible [not found] ` <mailman.2227.1529375463.1292.help-gnu-emacs@gnu.org> @ 2018-06-20 21:05 ` Will Parsons 0 siblings, 0 replies; 24+ messages in thread From: Will Parsons @ 2018-06-20 21:05 UTC (permalink / raw) To: help-gnu-emacs On Monday, 18 Jun 2018 10:30 PM -0400, Nick Helm wrote: > On Tue, 19 Jun 2018 at 12:12:29 +1200, Will Parsons wrote: > >> OK - I have now modified my .emacs file to have the following lines: >> >> ------- >> (setq whitespace-display-mappings '((space-mark 32 [183] [46]) >> (space-mark 160 [164] [95]) >> (space-mark 8199 [164] [95]) >> (newline-mark 10 [36 10]) >> (tab-mark 9 [187 9] [92 9]))) >> (global-whitespace-mode 1) >> (setq-default whitespace-style '(face lines-tail tabs trailing)) >> ------- >> >> I have removed the setting of whitespace-display-mappings that I had >> previously manually introduced to custom.el, and the only other >> setting that appears to reference whitespace is the setting >> >> (whitespace-tab ((t (:background "#081820" :foreground "darkgray"))) >> >> in my custom.el file, which I have now removed. >> >> Unfortunately, after making these changes, and having restarted Emacs, >> there is still no change to the display of u+2007. > > This looks good, just a couple more things to tweak. You need to turn on > visualising of space characters by adding "space-mark" to > whitespace-style: > > (setq-default whitespace-style '(face lines-tail space-mark tabs trailing)) > > This variable tells whitespace-mode and global-whitespace-mode which > classes of chars you want to visualise when one of the modes is active. > The space-mark entry tells Emacs to visualise the various space-mark > chars you set up with whitespace-display-mappings, in partiuclar your > new entry for FIGURE SPACEs. > > The only other thing is don't forget to put the expressions that set the > configuration variables (the setqs) before you active the mode, > something like this: > > (setq whitespace-display-mappings '((space-mark 32 [183] [46]) > (space-mark 160 [164] [95]) > (space-mark 8199 [164] [95]) > (newline-mark 10 [36 10]) > (tab-mark 9 [187 9] [92 9]))) > (setq-default whitespace-style '(face lines-tail space-mark tabs trailing)) > (global-whitespace-mode 1) > > Try this in your ~/.emacs, cross fingers and restart Emacs. Thank you very much! The code above didn't *quite* meet my needs, since regular spaces were indicated by an unwanted middle-dot character, but that was easily remedied by deleting the mappling for 0020 from whitespace-display-mappings. With that change, everything seems good. So, once again, thanks to you, Eli, and the others who have helped me solve my original problem, and given me a better understanding how whitespace-mode fits together in the process. -- Will ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <mailman.2107.1529212061.1292.help-gnu-emacs@gnu.org>]
* Re: Making a non-ASCII space character visible [not found] ` <mailman.2107.1529212061.1292.help-gnu-emacs@gnu.org> @ 2018-06-17 18:45 ` Will Parsons 0 siblings, 0 replies; 24+ messages in thread From: Will Parsons @ 2018-06-17 18:45 UTC (permalink / raw) To: help-gnu-emacs On Sunday, 17 Jun 2018 1:07 AM -0400, Michael Heerdegen wrote: > Will Parsons <varro@nodomain.invalid> writes: > >> I have a desire to use the Unicode character A007 (FIGURE SPACE) in a >> document and to be able to distinguish it visually from a regular ASCII >> space. This seems to be already done in the case of 00A0 (NO-BREAK >> SPACE) which appears as an underscore with a distinctive face. >> >> It *looks* like I should be able to do this via the customization >> option "Whitespace Display Mappings", but no matter what I do, >> attempting to "Apply" the changes results in an error message, "This >> field should contain a single character". > > Seems you tried to insert a printed representation of the character? > AFAIK you must insert the character. You can achieve this with M-: > (insert ?\x2007) for example. Yes, that's not so nice. No, I inserted the character. I have occasion to insert miscellaneous Unicode character sufficiently enough that I have re-bound M-u to insert-char to make this easier. >> Feeling desperate, I copied the existing value of >> whitespace-display-mappings directly into my custom.el file, and >> manually added a new entry for A007 (8199) on the model of the >> existing entry for 00A0 (160), but this seems to have no effect on the >> display. > > If you did it right, note that you must re-enable `whitespace-mode' to > give it a chance to update the `buffer-display-table'. That doesn't > happen automatically. I completely restarted Emacs after doing it. Also, see my reply to Eli. -- Will ^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2018-06-20 21:05 UTC | newest] Thread overview: 24+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <<fol9fvF7uauU1@mid.individual.net> [not found] ` <<fole90F986vU1@mid.individual.net> 2018-06-17 0:20 ` Making a non-ASCII space character visible Drew Adams 2018-06-16 20:15 Will Parsons 2018-06-16 21:37 ` Will Parsons 2018-06-17 4:31 ` Marcin Borkowski 2018-06-17 5:07 ` Michael Heerdegen 2018-06-17 5:55 ` Eli Zaretskii 2018-06-17 6:24 ` Michael Heerdegen 2018-06-17 6:41 ` Eli Zaretskii 2018-06-17 6:41 ` Michael Heerdegen [not found] ` <mailman.2115.1529217694.1292.help-gnu-emacs@gnu.org> 2018-06-19 0:45 ` Will Parsons 2018-06-19 1:01 ` Noam Postavsky [not found] ` <mailman.2220.1529370113.1292.help-gnu-emacs@gnu.org> 2018-06-19 1:26 ` Will Parsons [not found] ` <mailman.2110.1529214934.1292.help-gnu-emacs@gnu.org> 2018-06-17 18:54 ` Will Parsons 2018-06-17 6:00 ` Eli Zaretskii [not found] ` <mailman.2111.1529215267.1292.help-gnu-emacs@gnu.org> 2018-06-17 18:38 ` Will Parsons 2018-06-17 18:51 ` Eli Zaretskii [not found] ` <mailman.2145.1529261474.1292.help-gnu-emacs@gnu.org> 2018-06-17 19:09 ` Will Parsons 2018-06-17 19:31 ` Eli Zaretskii [not found] ` <mailman.2147.1529263896.1292.help-gnu-emacs@gnu.org> 2018-06-17 20:28 ` Will Parsons 2018-06-18 1:40 ` Nick Helm [not found] ` <mailman.2154.1529286048.1292.help-gnu-emacs@gnu.org> 2018-06-19 0:12 ` Will Parsons 2018-06-19 2:30 ` Nick Helm [not found] ` <mailman.2227.1529375463.1292.help-gnu-emacs@gnu.org> 2018-06-20 21:05 ` Will Parsons [not found] ` <mailman.2107.1529212061.1292.help-gnu-emacs@gnu.org> 2018-06-17 18:45 ` Will Parsons
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).