unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* syntax highlighting
@ 2002-11-20 22:26 Michael Mossey
  2002-11-20 23:30 ` Michael Slass
  0 siblings, 1 reply; 28+ messages in thread
From: Michael Mossey @ 2002-11-20 22:26 UTC (permalink / raw)


How do I change the colors that Emacs uses for syntax highlighting?
In particular, while editing Python, my string literals are in a 
very faint orange that isn't quite legible to me--I'd like to change
it to a darker color.

thanks,
Mike

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

* Re: syntax highlighting
  2002-11-20 22:26 Michael Mossey
@ 2002-11-20 23:30 ` Michael Slass
  2002-11-21  6:06   ` Eli Zaretskii
  0 siblings, 1 reply; 28+ messages in thread
From: Michael Slass @ 2002-11-20 23:30 UTC (permalink / raw)


michaelmossey@yahoo.com (Michael Mossey) writes:

>How do I change the colors that Emacs uses for syntax highlighting?
>In particular, while editing Python, my string literals are in a 
>very faint orange that isn't quite legible to me--I'd like to change
>it to a darker color.
>
>thanks,
>Mike

M-x customize-face RET font-lock-string-face RET

In the foreground:color field, edit to the name of a color you like.
Remember to hit the "Save for Future Sessions" button before exiting.

Anticipating your next question --- M-x list-colors-display will show
you the names of all the colors emacs can display written in that color.

-- 
Mike Slass

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

* Re: syntax highlighting
  2002-11-20 23:30 ` Michael Slass
@ 2002-11-21  6:06   ` Eli Zaretskii
  0 siblings, 0 replies; 28+ messages in thread
From: Eli Zaretskii @ 2002-11-21  6:06 UTC (permalink / raw)



On Wed, 20 Nov 2002, Michael Slass wrote:

> M-x customize-face RET font-lock-string-face RET

And "M-x list-faces-display RET" will show all the faces known to Emacs 
as of the time you invoke that command.  You can then customize each face 
by clicking on it.

> Anticipating your next question --- M-x list-colors-display will show
> you the names of all the colors emacs can display written in that color.

Actually, this is not true.  Emacs typically supports a much larger set 
of colors, it just shows some subset of it (the only exception being a 
character-mode terminal, where it shows the exact full set of colors it 
supports).  You can have more colors by using the X "#RGB" or similar 
notation.

To see where do the colors shown by list-colors-display come from, look 
into term/x-win.el (or term/w32-win.el for Windows).

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

* syntax highlighting
@ 2003-01-28 12:42 Paul O'Donnell
  2003-01-28 13:06 ` Christopher J. White
                   ` (3 more replies)
  0 siblings, 4 replies; 28+ messages in thread
From: Paul O'Donnell @ 2003-01-28 12:42 UTC (permalink / raw)


Hi All,

I am a little confused about syntax highlighting in emacs. When I open a file
with *.c or *.html extensions and syntax highlighting is turned on I get the
appropriate syntax highlighting.

But what about bash script files? I managed to get the syntax highlighting to
work when the file extension is *.sh, which is nice, but what if it does not
have an *.sh extension? Not all scipt files have this extension.

For example, when I opened the file /home/paul/.bash_profile I got syntax
highlighting. It does not have an *.sh extension, so how does emacs know which
syntax highlighting to use? When I try to create my own scipts without naming
the file *.sh I don't get highlighting. How can I get this highlighting for such
a file?

I am a complete beginner with emacs so don't be afraid to insult me by pointing
out the obvious. Nothing is obvious to me.

Paul

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

* Re: syntax highlighting
  2003-01-28 12:42 Paul O'Donnell
@ 2003-01-28 13:06 ` Christopher J. White
  2003-01-28 13:07 ` David Kastrup
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 28+ messages in thread
From: Christopher J. White @ 2003-01-28 13:06 UTC (permalink / raw)


>>>>> "paul" == Paul O'Donnell <odonnellp@rogers.com> writes:

paul> I am a little confused about syntax highlighting in emacs. When
paul> I open a file with *.c or *.html extensions and syntax
paul> highlighting is turned on I get the appropriate syntax
paul> highlighting.

paul> But what about bash script files? 

Highlighting is font-lock-mode, using keywords appropriate for the
type of file you are editing.  This depends on emacs properly
detecting the major-mode of the files you are editing.  To my
knowledge, emacs has the following methods of doing this automatically:

  1) Filename name matching via auto-mode-alist...when you
     open "blah.sh", emacs matches this against a pattern in
     auto-mode-alist and decides it's sh-mode.  sh-mode is
     activated and turns on font-lock-mode

  2) Interpreter name matching via interpreter-mode-alist...
     If first line of file is "#!", it looks for an interperter and
     assigns the mode that way.

  3) Presence of a line of the format:

     -*- mode: MODENAME -*-

     which must be present as the first nonblank line of the file.  See
     the info pages for Major Modes and Choosing Major modes for more info.

...cj

-- 
------------------------------------------------------------------------------
 Christopher J. White                                    chris@grierwhite.com
------------------------------------------------------------------------------ 

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

* Re: syntax highlighting
  2003-01-28 12:42 Paul O'Donnell
  2003-01-28 13:06 ` Christopher J. White
@ 2003-01-28 13:07 ` David Kastrup
  2003-01-28 15:11 ` Kester Clegg
  2003-01-29  8:07 ` Lee Sau Dan
  3 siblings, 0 replies; 28+ messages in thread
From: David Kastrup @ 2003-01-28 13:07 UTC (permalink / raw)


"Paul O'Donnell" <odonnellp@rogers.com> writes:

> I am a little confused about syntax highlighting in emacs. When I open a file
> with *.c or *.html extensions and syntax highlighting is turned on I get the
> appropriate syntax highlighting.
> 
> But what about bash script files? I managed to get the syntax highlighting to
> work when the file extension is *.sh, which is nice, but what if it does not
> have an *.sh extension? Not all scipt files have this extension.
> 
> For example, when I opened the file /home/paul/.bash_profile I got
> syntax highlighting. It does not have an *.sh extension, so how does
> emacs know which syntax highlighting to use?

auto-mode-alist contains
 ("\\.[ck]?sh\\'\\|\\.shar\\'\\|/\\.z?profile\\'" . sh-mode)
 ("\\.bash\\'" . sh-mode)
 ("\\(/\\|\\`\\)\\.\\(bash_profile\\|z?login\\|bash_login\\|z?logout\\)\\'" . sh-mode)
 ("\\(/\\|\\`\\)\\.\\(bash_logout\\|shrc\\|[kz]shrc\\|bashrc\\|t?cshrc\\|esrc\\)\\'" . sh-mode)
 ("\\(/\\|\\`\\)\\.\\([kz]shenv\\|xinitrc\\|startxrc\\|xsession\\)\\'" . sh-mode)
 ("\\.m?spec\\'" . sh-mode)

> When I try to create my own scipts without naming the file *.sh I
> don't get highlighting. How can I get this highlighting for such a
> file?

It should probably be sufficient to start it with
#!/bin/bash

or so and then do revert-buffer or another means to reload the file.

The pattern matched is defined in interpreter-mode-alist.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: syntax highlighting
  2003-01-28 12:42 Paul O'Donnell
  2003-01-28 13:06 ` Christopher J. White
  2003-01-28 13:07 ` David Kastrup
@ 2003-01-28 15:11 ` Kester Clegg
  2003-01-29  8:07 ` Lee Sau Dan
  3 siblings, 0 replies; 28+ messages in thread
From: Kester Clegg @ 2003-01-28 15:11 UTC (permalink / raw)


"Paul O'Donnell" <odonnellp@rogers.com> writes:

> the file *.sh I don't get highlighting. How can I get this
> highlighting for such a file?

Do you start with the file with

#!/bin/bash

I do and highlighting works fine here.

-- 
************************************************************************
Kester Clegg				Dept. of Computer Science,
Research Assistant (UTC)		University of York, 
Tel (01904) 43 27 49			email: kester at cs.york.ac.uk
************************************************************************

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

* RE: syntax highlighting
@ 2003-01-28 16:02 Bingham, Jay
  0 siblings, 0 replies; 28+ messages in thread
From: Bingham, Jay @ 2003-01-28 16:02 UTC (permalink / raw)


On Tuesday, January 28, 2003 7:08 AM David Kastrup wrote

>It should probably be sufficient to start it with
>#!/bin/bash
>
>or so and then do revert-buffer or another means to reload the file.

Or you can just invoke shell script mode
M-x shell-script-mode<ret>

-_
J_)
C_)ingham
.    HP - NonStop Austin Software & Services - Software Quality
Assurance
.    Austin, TX
. "Language is the apparel in which your thoughts parade in public.
.  Never clothe them in vulgar and shoddy attire."     -Dr. George W.
Crane-

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

* Re: syntax highlighting
  2003-01-28 12:42 Paul O'Donnell
                   ` (2 preceding siblings ...)
  2003-01-28 15:11 ` Kester Clegg
@ 2003-01-29  8:07 ` Lee Sau Dan
  3 siblings, 0 replies; 28+ messages in thread
From: Lee Sau Dan @ 2003-01-29  8:07 UTC (permalink / raw)


>>>>> "Paul" == Paul O'Donnell <odonnellp@rogers.com> writes:

    Paul> But what about bash script files? I managed to get the
    Paul> syntax highlighting to work when the file extension is *.sh,
    Paul> which is nice, but what if it does not have an *.sh
    Paul> extension? Not all scipt files have this extension.

The  auto-mode feature has  been serving  you so  well that  you don't
realize   what   happens  behind   the   scene.    (Homework:  C-h   v
auto-mode-alist RET)

You can do it manually with M-x sh-mode.


-- 
Lee Sau Dan                     李守敦(Big5)                    ~{@nJX6X~}(HZ) 

E-mail: danlee@informatik.uni-freiburg.de
Home page: http://www.informatik.uni-freiburg.de/~danlee

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

* syntax highlighting
@ 2014-11-16  1:40 mzp3769
  2014-11-16  7:56 ` Emanuel Berg
  2014-11-17  2:15 ` Robert Thorpe
  0 siblings, 2 replies; 28+ messages in thread
From: mzp3769 @ 2014-11-16  1:40 UTC (permalink / raw)
  To: help-gnu-emacs

Every time I upgrade to higher emacs I have the same problem - syntax highlighting and the previous command in .emacs does not work. 
How to turn this option off in 24.4.1 ?

Thanks,
Mark


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

* Re: syntax highlighting
  2014-11-16  1:40 mzp3769
@ 2014-11-16  7:56 ` Emanuel Berg
  2014-11-16 15:08   ` M P
  2014-11-17  2:15 ` Robert Thorpe
  1 sibling, 1 reply; 28+ messages in thread
From: Emanuel Berg @ 2014-11-16  7:56 UTC (permalink / raw)
  To: help-gnu-emacs

mzp3769@gmail.com writes:

> Every time I upgrade to higher emacs I have the same
> problem - syntax highlighting and the previous command
> in .emacs does not work. How to turn this option off
> in 24.4.1 ?

Interesting :)

I what way does highlighting not work?

What commands in .emacs does not work?

What option do you want to turn off in 24.4.1?

-- 
underground experts united


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

* Re: syntax highlighting
  2014-11-16  7:56 ` Emanuel Berg
@ 2014-11-16 15:08   ` M P
  2014-11-16 19:31     ` Bob Proulx
                       ` (2 more replies)
  0 siblings, 3 replies; 28+ messages in thread
From: M P @ 2014-11-16 15:08 UTC (permalink / raw)
  To: help-gnu-emacs

I would like to turn of syntax highlighting. The screen glows in all colors of the rainbow - thats is tiring for the eyes,
Mark

On Sunday, November 16, 2014 12:55:21 AM UTC-7, Emanuel Berg wrote:

> 
> > Every time I upgrade to higher emacs I have the same
> > problem - syntax highlighting and the previous command
> > in .emacs does not work. How to turn this option off
> > in 24.4.1 ?
> 
> Interesting :)
> 
> I what way does highlighting not work?
> 
> What commands in .emacs does not work?
> 
> What option do you want to turn off in 24.4.1?
> 
> -- 
> underground experts united



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

* Re: syntax highlighting
  2014-11-16 15:08   ` M P
@ 2014-11-16 19:31     ` Bob Proulx
       [not found]     ` <mailman.13823.1416166289.1147.help-gnu-emacs@gnu.org>
  2014-11-16 21:16     ` Emanuel Berg
  2 siblings, 0 replies; 28+ messages in thread
From: Bob Proulx @ 2014-11-16 19:31 UTC (permalink / raw)
  To: help-gnu-emacs

M P wrote:
> I would like to turn of syntax highlighting. The screen glows in all
> colors of the rainbow - thats is tiring for the eyes,

Set this in your .emacs file to disable font-lock-mode globally.

  (global-font-lock-mode 0)

See the documentation on font lock mode for more information.

  http://www.gnu.org/software/emacs/manual/html_node/emacs/Font-Lock.html#Font-Lock

Bob



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

* Re: syntax highlighting
       [not found]     ` <mailman.13823.1416166289.1147.help-gnu-emacs@gnu.org>
@ 2014-11-16 21:15       ` M P
  2014-11-17  1:26         ` Robert Thorpe
  0 siblings, 1 reply; 28+ messages in thread
From: M P @ 2014-11-16 21:15 UTC (permalink / raw)
  To: help-gnu-emacs

Thanks, I had  (global-font-lock-mode) which worked previously,
Mark


On Sunday, November 16, 2014 12:31:31 PM UTC-7, Bob Proulx wrote:
> M P wrote:
> > I would like to turn of syntax highlighting. The screen glows in all
> > colors of the rainbow - thats is tiring for the eyes,
> 
> Set this in your .emacs file to disable font-lock-mode globally.
> 
>   (global-font-lock-mode 0)
> 
> See the documentation on font lock mode for more information.
> 
>   http://www.gnu.org/software/emacs/manual/html_node/emacs/Font-Lock.html#Font-Lock
> 
> Bob


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

* Re: syntax highlighting
  2014-11-16 15:08   ` M P
  2014-11-16 19:31     ` Bob Proulx
       [not found]     ` <mailman.13823.1416166289.1147.help-gnu-emacs@gnu.org>
@ 2014-11-16 21:16     ` Emanuel Berg
  2 siblings, 0 replies; 28+ messages in thread
From: Emanuel Berg @ 2014-11-16 21:16 UTC (permalink / raw)
  To: help-gnu-emacs

M P <mzp3769@gmail.com> writes:

> I would like to turn of syntax highlighting. The
> screen glows in all colors of the rainbow - thats is
> tiring for the eyes, Mark

That is perhaps tiring for *your* eyes...

I think syntax highlighting is indispensible. It makes
it look more fun and it increases "seeing" as opposed
to reading.

Just think of the how the traffic lights work. Imagine
if they instead of red, yellow and green showed the
letters G, H, and S (for "go", "halt", and "stop").

Colors are emotional, text is intellectual. So colors
are great for expressing what they can express, which
granted is a limited scope, but a very important one
nevertheless.

If your eyes are bad, that sucks. I had that problem
for years.

Here are some tips that might work for you:

* use a bright-text-on-black-background theme (less
  information to enter your eyes/brain)
  
* use a projector; setup a large font

* disable everything superfluous, like shiny scroll
  bars and such
  
* disable all "jitter", as in the blinking cursor

* don't use the mouse as you have to reset your eyes
  and aim to click on icons and letters

* outside of the computer world, don't use shampoo
  (sounds silly to mention, but that really works so I
  have to do it), and don't drink stuff that will make
  you dehydrated, which is basically everything but
  water

Good luck!

-- 
underground experts united


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

* Re: syntax highlighting
  2014-11-16 21:15       ` M P
@ 2014-11-17  1:26         ` Robert Thorpe
  2014-11-17  5:04           ` Bob Proulx
       [not found]           ` <mailman.13854.1416200675.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 28+ messages in thread
From: Robert Thorpe @ 2014-11-17  1:26 UTC (permalink / raw)
  To: M P; +Cc: help-gnu-emacs

M P <mzp3769@gmail.com> writes:

> Thanks, I had  (global-font-lock-mode) which worked previously,
> Mark

Doing just M-x global-font-lock-mode toggles font-lock.  That means that
if it's off it's turned on and vice-versa.  All of the global
minor-modes work like that.  As I understand it, this behaviour was
found to be confusing in lisp programs.  Anyway, now M-x global-xxx-mode
still toggles, but in a lisp program (global-xxx-mode) now always means
"turn function xxx on".

BR,
Robert Thorpe



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

* Re: syntax highlighting
  2014-11-16  1:40 mzp3769
  2014-11-16  7:56 ` Emanuel Berg
@ 2014-11-17  2:15 ` Robert Thorpe
  1 sibling, 0 replies; 28+ messages in thread
From: Robert Thorpe @ 2014-11-17  2:15 UTC (permalink / raw)
  To: mzp3769; +Cc: help-gnu-emacs

mzp3769@gmail.com writes:

> Every time I upgrade to higher emacs I have the same problem - syntax highlighting and the previous command in .emacs does not work. 
> How to turn this option off in 24.4.1 ?

Also, you may want to try using fonts instead of colours for
highlighting.  Some find this easier.  For example, using one colour for
all text you can set comments to italics, types to bold and keywords to
bold-italics.  You can do that by customizing the faces or using the new
themes mechanism.  I expect someone has already written a theme that
provides this.

BR,
Robert Thorpe



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

* Re: syntax highlighting
  2014-11-17  1:26         ` Robert Thorpe
@ 2014-11-17  5:04           ` Bob Proulx
  2014-11-17 14:53             ` Bruno Félix Rezende Ribeiro
       [not found]             ` <mailman.13882.1416236018.1147.help-gnu-emacs@gnu.org>
       [not found]           ` <mailman.13854.1416200675.1147.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 28+ messages in thread
From: Bob Proulx @ 2014-11-17  5:04 UTC (permalink / raw)
  To: help-gnu-emacs

Robert Thorpe wrote:
> M P writes:
> > Thanks, I had  (global-font-lock-mode) which worked previously,
> 
> Doing just M-x global-font-lock-mode toggles font-lock.  That means that
> if it's off it's turned on and vice-versa.  All of the global
> minor-modes work like that.  As I understand it, this behaviour was
> found to be confusing in lisp programs.  Anyway, now M-x global-xxx-mode
> still toggles, but in a lisp program (global-xxx-mode) now always means
> "turn function xxx on".

I rather dislike controls that toggle.  Whether they are programmatic
interfaces or physical buttons.  For programs is always the problem
that you must ensure that they are in a particular state before
toggling.  For physical buttons I always seem to fat-finger them and
hit them multiple times.  I much prefer set buttons such as off or on
that it doesn't matter if you have contact bounce that they will still
do exactly what you want regardless of the number of events or not.

However for font lock mode it takes an optional argument.

  (global-font-lock-mode 0)

The docs say:

  (global-font-lock-mode &optional ARG)

  Toggle Font-Lock mode in all buffers.
  With prefix ARG, enable Global-Font-Lock mode if ARG is positive;
  otherwise, disable it.  If called from Lisp, enable the mode if
  ARG is omitted or nil.

So giving it a 0 argument definitely turns it off and does not toggle
it.

Bob



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

* Re: syntax highlighting
  2014-11-17  5:04           ` Bob Proulx
@ 2014-11-17 14:53             ` Bruno Félix Rezende Ribeiro
  2014-11-17 15:01               ` Stefan Monnier
       [not found]             ` <mailman.13882.1416236018.1147.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 28+ messages in thread
From: Bruno Félix Rezende Ribeiro @ 2014-11-17 14:53 UTC (permalink / raw)
  To: help-gnu-emacs

Em Sun, 16 Nov 2014 22:04:18 -0700
Bob Proulx <bob@proulx.com> escreveu:

> However for font lock mode it takes an optional argument.
> 
>   (global-font-lock-mode 0)
> 
> The docs say:
> 
>   (global-font-lock-mode &optional ARG)
> 
>   Toggle Font-Lock mode in all buffers.
>   With prefix ARG, enable Global-Font-Lock mode if ARG is positive;
>   otherwise, disable it.  If called from Lisp, enable the mode if
>   ARG is omitted or nil.
> 
> So giving it a 0 argument definitely turns it off and does not toggle
> it.

That docstring, and all the others describing minor mode
(de)activation commands are somewhat ambiguous to me, because, as in
math literature, "positive" could or not include the number '0',
depending on author's definition.  However, "strictly positive" always
excludes zero, while "non-negative" always includes it.  So, I think
the latter would be a more appropriate term, instead of simply
"positive". 

Ps: Emacs developers, please, take this as a bug report ;-).

-- 
 ,= ,-_-. =.  Bruno Félix Rezende Ribeiro (oitofelix) [0x28D618AF]
((_/)o o(\_)) There is no system but GNU;
 `-'(. .)`-'  GNU Linux-Libre is one of its official kernels;
     \_/      All software must be free as in freedom;



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

* Re: syntax highlighting
  2014-11-17 14:53             ` Bruno Félix Rezende Ribeiro
@ 2014-11-17 15:01               ` Stefan Monnier
  2014-11-18  2:15                 ` Bob Proulx
  0 siblings, 1 reply; 28+ messages in thread
From: Stefan Monnier @ 2014-11-17 15:01 UTC (permalink / raw)
  To: help-gnu-emacs

> That docstring, and all the others describing minor mode
> (de)activation commands are somewhat ambiguous to me, because, as in
> math literature, "positive" could or not include the number '0',
> depending on author's definition.

For that reason, I recommend to use -1 and 1 to mean respectively "off"
and "on".


        Stefan




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

* Re: syntax highlighting
       [not found]           ` <mailman.13854.1416200675.1147.help-gnu-emacs@gnu.org>
@ 2014-11-18  2:00             ` Emanuel Berg
  0 siblings, 0 replies; 28+ messages in thread
From: Emanuel Berg @ 2014-11-18  2:00 UTC (permalink / raw)
  To: help-gnu-emacs

Bob Proulx <bob@proulx.com> writes:

> I rather dislike controls that toggle. Whether they
> are programmatic interfaces or physical buttons.

In programming they shouldn't be because of the state
problem you bring up.

I myself don't have a problem with hitting physical
buttons twice, but I agree an on/off physical switch
is optimal, however with computing you have the
keyboard to do everything - and even if you could have
dedicated, specialized hardware for everything that
would be to slow because you would have to move your
hands between the throttles and switches and then back
to typing position.

But: how about toggling not with a key, but an M-x
command?

An example I can give you straight from the holster is
the mode line. I don't care for the major mode to
show, because I know them by now. So I have it not
shown. But sometimes I don't know for a new mode and
then I want to know. Whenever so, I have a M-x command
("modes") to have it show up in the mode line (only
for that buffer). That's toggling just the same but I
don't do it often enough to bind it to a key.

Check it out:

http://user.it.uu.se/~embe8573/conf/emacs-init/mode-line.el

-- 
underground experts united


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

* Re: syntax highlighting
       [not found]             ` <mailman.13882.1416236018.1147.help-gnu-emacs@gnu.org>
@ 2014-11-18  2:10               ` Emanuel Berg
  0 siblings, 0 replies; 28+ messages in thread
From: Emanuel Berg @ 2014-11-18  2:10 UTC (permalink / raw)
  To: help-gnu-emacs

Bruno Félix Rezende Ribeiro <oitofelix@gnu.org>
writes:

> That docstring, and all the others describing minor
> mode (de)activation commands are somewhat ambiguous
> to me, because, as in math literature, "positive"
> could or not include the number '0', depending on
> author's definition. However, "strictly positive"
> always excludes zero, while "non-negative" always
> includes it. So, I think the latter would be a more
> appropriate term, instead of simply "positive".

Word!

While it is many times an advantage to have
multiple-purpose interfaces, for example

(member 'b '(a b c))  ; (b c)    (1)
(member 'z '(a b c))  ; nil

instead of having (1) evaluate to `t' (for "yes, 'b is
a member"), when there *isn't* any second dimension to
it, I think it is much clearer to just focus on the
obvious usage and say exactly how to do it: "enable it
with `t', disable with `nil', with 1 it works, with -1
it blows up the computer, etc.".

> Ps: Emacs developers, please, take this as a bug
> report ;-)

Yeah, you wish. And me to. But report it the technical
way, it is as fast for you as to write this message.

-- 
underground experts united


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

* Re: syntax highlighting
  2014-11-17 15:01               ` Stefan Monnier
@ 2014-11-18  2:15                 ` Bob Proulx
  2014-11-18  8:59                   ` Bruno Félix Rezende Ribeiro
  0 siblings, 1 reply; 28+ messages in thread
From: Bob Proulx @ 2014-11-18  2:15 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier wrote:
> Bruno Felix Rezende Ribeiro wrote:
> > That docstring, and all the others describing minor mode
> > (de)activation commands are somewhat ambiguous to me, because, as in
> > math literature, "positive" could or not include the number '0',
> > depending on author's definition.
> 
> For that reason, I recommend to use -1 and 1 to mean respectively "off"
> and "on".

When I posted my response I almost posted this:

  (setq font-lock-global-modes nil)

But then I checked the documentation to verify that what I was going to
post was accurate.  I found this in the emacs manual.

     Type ‘M-x global-font-lock-mode’ to toggle Font Lock mode in all
  buffers.  To impose this setting for future Emacs sessions, customize
  the variable ‘global-font-lock-mode’ (*note Easy Customization::), or
  add the following line to your init file:

       (global-font-lock-mode 0)

And so I didn't post (setq font-lock-global-modes nil) which I thought
was most plain and simple and instead posted the documented interface.
That is my reward for having read and followed the documentation.

But you are both completely right that 0 is ambiguous there.  That is
terrible.  It should be t or nil to be more consistent.  Or any of a
number of other possibilities.  Unfortunately it is already the
documented interface.  Hate proposing changing it since it will break
anyone who has followed directions.

Bob



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

* Re: syntax highlighting
  2014-11-18  2:15                 ` Bob Proulx
@ 2014-11-18  8:59                   ` Bruno Félix Rezende Ribeiro
  2014-11-18 18:23                     ` Bob Proulx
  0 siblings, 1 reply; 28+ messages in thread
From: Bruno Félix Rezende Ribeiro @ 2014-11-18  8:59 UTC (permalink / raw)
  To: help-gnu-emacs

Em Mon, 17 Nov 2014 19:15:40 -0700
Bob Proulx <bob@proulx.com> escreveu:

> Hate proposing changing it since it will break anyone who has
> followed directions.

We don't have to change the interface to fix the problem.  Just
changing the dcoumentation's wording ("positive" to "non-negative")
will be enough to make it straight and won't be any breakage.

-- 
 ,= ,-_-. =.  Bruno Félix Rezende Ribeiro (oitofelix) [0x28D618AF]
((_/)o o(\_)) There is no system but GNU;
 `-'(. .)`-'  GNU Linux-Libre is one of its official kernels;
     \_/      All software must be free as in freedom;



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

* Re: syntax highlighting
  2014-11-18  8:59                   ` Bruno Félix Rezende Ribeiro
@ 2014-11-18 18:23                     ` Bob Proulx
  0 siblings, 0 replies; 28+ messages in thread
From: Bob Proulx @ 2014-11-18 18:23 UTC (permalink / raw)
  To: help-gnu-emacs

Bruno Félix Rezende Ribeiro wrote:
> Bob Proulx escreveu:
> > Hate proposing changing it since it will break anyone who has
> > followed directions.
> 
> We don't have to change the interface to fix the problem.  Just
> changing the dcoumentation's wording ("positive" to "non-negative")
> will be enough to make it straight and won't be any breakage.

I like it!  All it needs is someone to push that upstream.

Bob



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

* syntax highlighting
@ 2015-03-15 21:31 Bostjan Vilfan
  2015-03-16  2:55 ` Stefan Monnier
  0 siblings, 1 reply; 28+ messages in thread
From: Bostjan Vilfan @ 2015-03-15 21:31 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: bjvilfan

[-- Attachment #1: Type: text/plain, Size: 996 bytes --]

Hello,
I am using a derivative of modula2.el
(authors: Michael Schmidt <michael@pbinfo.UUCP>
Tom Perrine <Perrin@LOGICON.ARPA>),
which sets up the
modula2 mode, and I adapted it for the  Oberon2 language. However,
I have a problem with syntax highlighting, and since I do not
know a lot about the font lock mode, I wonder if someone can
give me a quick hint regarding the following problem:

I would like to highlight Oberon2 comments, which start with "(*",
and end with "*)". Comments can also be recursive;
i.e., a comment can look like this:

(* bla bla (* bla bla bla *) bla bla *)

The way modula2.el is written (or, actually, my derived .el file), the
last "bla bla" string is not highlighted. What needs to be done to
fix this? Apparently, as things stand now highlighting is turned off
as soon as "*)" is encountered. Probably one needs to keep a count of
unmatched "(*" strings, and turn highlighting off only when this
count reaches 0. Any help would be appreciated.
Regards,
bostjanv

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

* Re: syntax highlighting
  2015-03-15 21:31 Bostjan Vilfan
@ 2015-03-16  2:55 ` Stefan Monnier
  0 siblings, 0 replies; 28+ messages in thread
From: Stefan Monnier @ 2015-03-16  2:55 UTC (permalink / raw)
  To: help-gnu-emacs

> I am using a derivative of modula2.el

[ Make sure you use a recentish of modula2.el as basis, since they
  come with auto-indentation.  ]

> (* bla bla (* bla bla bla *) bla bla *)
> The way modula2.el is written (or, actually, my derived .el file), the
> last "bla bla" string is not highlighted.

You need to add an "n" to the `modify-syntax-entry' call for one of the
comment markers, in the syntax-table.


        Stefan




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

* Re: syntax highlighting
@ 2015-03-16 17:39 Bostjan Vilfan
  0 siblings, 0 replies; 28+ messages in thread
From: Bostjan Vilfan @ 2015-03-16 17:39 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: bjvilfan

[-- Attachment #1: Type: text/plain, Size: 47 bytes --]

Problem solved. Thanks a lot. Regards, bostjanv

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

end of thread, other threads:[~2015-03-16 17:39 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-16 17:39 syntax highlighting Bostjan Vilfan
  -- strict thread matches above, loose matches on Subject: below --
2015-03-15 21:31 Bostjan Vilfan
2015-03-16  2:55 ` Stefan Monnier
2014-11-16  1:40 mzp3769
2014-11-16  7:56 ` Emanuel Berg
2014-11-16 15:08   ` M P
2014-11-16 19:31     ` Bob Proulx
     [not found]     ` <mailman.13823.1416166289.1147.help-gnu-emacs@gnu.org>
2014-11-16 21:15       ` M P
2014-11-17  1:26         ` Robert Thorpe
2014-11-17  5:04           ` Bob Proulx
2014-11-17 14:53             ` Bruno Félix Rezende Ribeiro
2014-11-17 15:01               ` Stefan Monnier
2014-11-18  2:15                 ` Bob Proulx
2014-11-18  8:59                   ` Bruno Félix Rezende Ribeiro
2014-11-18 18:23                     ` Bob Proulx
     [not found]             ` <mailman.13882.1416236018.1147.help-gnu-emacs@gnu.org>
2014-11-18  2:10               ` Emanuel Berg
     [not found]           ` <mailman.13854.1416200675.1147.help-gnu-emacs@gnu.org>
2014-11-18  2:00             ` Emanuel Berg
2014-11-16 21:16     ` Emanuel Berg
2014-11-17  2:15 ` Robert Thorpe
2003-01-28 16:02 Bingham, Jay
2003-01-28 12:42 Paul O'Donnell
2003-01-28 13:06 ` Christopher J. White
2003-01-28 13:07 ` David Kastrup
2003-01-28 15:11 ` Kester Clegg
2003-01-29  8:07 ` Lee Sau Dan
2002-11-20 22:26 Michael Mossey
2002-11-20 23:30 ` Michael Slass
2002-11-21  6:06   ` Eli Zaretskii

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).