emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: blank-mode.el


From: Vinicius Jose Latorre
Subject: Re: blank-mode.el
Date: Sun, 28 Oct 2007 20:04:19 -0300
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8) Gecko/20071009 SeaMonkey/1.1.5

Drew Adams wrote:
User option `blank-chars' specifies which blank characters to
highlight, but it would be good to also have commands to toggle
each highlighting type. For example, `M-x blank-toggle-trailing'
and `M-x blank-toggle-tabs'. And it would be good to have this
for both local and global use: `blank-toggle-tabs-global', in
addition to `blank-toggle-tabs'.
Hummm, maybe a better approach could be to pass a list to blank-mode or
blank-global-mode like:

; turn on local blank-mode but only highlight trailing spaces and spaces
before tab
(blank-mode '(trailing space-before-tab))

So, the command above is the same as the following sequence:

(blank-mode nil)
(setq blank-chars '(trailing space-before-tab))
(blank-mode t)

What would that mean interactively?

Indeed, I was thinking only in terms of an ELisp code.


                                    Would the user need to decide which
chars to highlight each time s?he used the mode command?

Well, the user always have to decide which blank to highlight via a toggle
command interactively or via a list in an ELisp code.


                                                         How would s?he
specify those chars - input their names with completion?

Interactively, well, it could pass an ELisp expression, if the command uses
(interactive "X").  Hummm, this doesn't seem to be a good thing to do.


                                                         What if s?he just
wants the default (current) `blank-chars' - does s?he still need to specify
all the chars to highlight when turning on the mode?

Interactively, it could pass an ELisp expression, so it could pass blank-chars
var as an argument.


I don't think the choice of what to highlight should be connected with the
mode command. That should remain a simple toggle, just turning on/off
highlighting as specified by the current value of `blank-chars'. Much of the
time, that will be all a user needs.

I'd prefer to have a separate toggle command for each kind of blank
highlighting - those commands would only change the value of `blank-chars'.
That, to me, is the most convenient for the user - more convenient than
`set-variable' or `customize-option', and more convenient that coupling
highlighting changes with the mode command.

Second best is just using `set-variable' (but that requires you to specify
each of the chars to highlight). IIUC, least convenient of all, IMO, is
coupling the minor-mode command with the chars choice.

My suggestion lets users change the highlighting by expressing only the
delta - not all of the chars to highlight, but just what to change.

Ok, instead of modifying blank-mode behavior passing a list,
we could have the following commands:

   blank-toggle

   blank-global-toggle

When activated interactively, it asks to user which feature to highlight
(it could be via a menu, in a similar way that C-h behaves).  The menu
options could be something like:

   t - tabs
   s - spaces and hard spaces
   r - trailing blanks
   b - spaces before tab
   l - lines
   ? - display the menu

So, if blank-toggle is binded to a key, for example, C-c b, then the user could
type:

   C-c b t      toggle tabs
   C-c b s      toggle spaces and hard spaces
   C-c b r      toggle trailing blanks
   C-c b b      toggle spaces before tab
   C-c b l      toggle lines

Or the user could type:

   M-x blank-toggle RET t
   M-x blank-toggle RET s
   etc.

And via ELisp code, it could pass a symbol like:

   (blank-toggle 'trailing)
   (blank-toggle 'space-before-tab)
   etc.

Also, via ELisp code, it could pass a list like:

   (blank-toggle '(trailing space-before-tab))


Just one opinion.

Thanks for your opinion.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]