all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Displaying TABS vs SPACES
@ 2004-06-03  3:08 exits funnel
  2004-06-03 11:22 ` Micha Feigin
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: exits funnel @ 2004-06-03  3:08 UTC (permalink / raw)


Hello,

I'm trying to find a way to distinguish tabs from
consecutive spaces in some source code I've inherited
so I can get the formatting straightened out, but I
can't figure out how.  I'm sure there must be a mode
which allows me to distinguish the two.  If anyone
could point me in the right direction I'd really
appreciate it.

-exits


	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

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

* Re: Displaying TABS vs SPACES
  2004-06-03  3:08 Displaying TABS vs SPACES exits funnel
@ 2004-06-03 11:22 ` Micha Feigin
  2004-06-03 11:25 ` Micha Feigin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Micha Feigin @ 2004-06-03 11:22 UTC (permalink / raw)


On Wed, Jun 02, 2004 at 08:08:00PM -0700, exits funnel wrote:
> Hello,
> 
> I'm trying to find a way to distinguish tabs from
> consecutive spaces in some source code I've inherited
> so I can get the formatting straightened out, but I
> can't figure out how.  I'm sure there must be a mode
> which allows me to distinguish the two.  If anyone
> could point me in the right direction I'd really
> appreciate it.
> 

I am not sure if it depends on the themes package I'm using (I don't
think so) but the following entry displays tabs and trailing spaces for
me in a different color (same one in my case but you can change that).

(custom-set-faces
 '(my-tab-face            ((((class color)) (:background "gray5"))) t)
 '(my-trailing-space-face ((((class color)) (:background "gray5"))) t))

> -exits
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> Friends.  Fun.  Try the all-new Yahoo! Messenger.
> http://messenger.yahoo.com/ 
> 
> 
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>  
>  +++++++++++++++++++++++++++++++++++++++++++
>  This Mail Was Scanned By Mail-seCure System
>  at the Tel-Aviv University CC.
> 

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

* Re: Displaying TABS vs SPACES
  2004-06-03  3:08 Displaying TABS vs SPACES exits funnel
  2004-06-03 11:22 ` Micha Feigin
@ 2004-06-03 11:25 ` Micha Feigin
  2004-06-10  0:11   ` exits funnel
  2004-06-03 12:10 ` Kevin Dziulko
  2004-06-03 16:03 ` Kai Grossjohann
  3 siblings, 1 reply; 11+ messages in thread
From: Micha Feigin @ 2004-06-03 11:25 UTC (permalink / raw)


On Wed, Jun 02, 2004 at 08:08:00PM -0700, exits funnel wrote:
> Hello,
> 
> I'm trying to find a way to distinguish tabs from
> consecutive spaces in some source code I've inherited
> so I can get the formatting straightened out, but I
> can't figure out how.  I'm sure there must be a mode
> which allows me to distinguish the two.  If anyone
> could point me in the right direction I'd really
> appreciate it.
> 

I forgot the fontlock entry, this is the full entry:

(custom-set-faces
 '(my-tab-face            ((((class color)) (:background "gray10"))) t)
 '(my-trailing-space-face ((((class color)) (:background "gray10"))) t))

(add-hook 'font-lock-mode-hook
  (function
    (lambda ()
      (setq font-lock-keywords
            (append font-lock-keywords
                    '(("\t+" (0 'my-tab-face t))
                      ("[ \t]+$" (0 'my-trailing-space-face t))))))))


> -exits
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> Friends.  Fun.  Try the all-new Yahoo! Messenger.
> http://messenger.yahoo.com/ 
> 
> 
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>  
>  +++++++++++++++++++++++++++++++++++++++++++
>  This Mail Was Scanned By Mail-seCure System
>  at the Tel-Aviv University CC.
> 

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

* Re: Displaying TABS vs SPACES
  2004-06-03  3:08 Displaying TABS vs SPACES exits funnel
  2004-06-03 11:22 ` Micha Feigin
  2004-06-03 11:25 ` Micha Feigin
@ 2004-06-03 12:10 ` Kevin Dziulko
  2004-06-03 16:03 ` Kai Grossjohann
  3 siblings, 0 replies; 11+ messages in thread
From: Kevin Dziulko @ 2004-06-03 12:10 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 1175 bytes --]

I'm not sure if there's a mode, but if your looking to convert tabs to spaces or vice versa, there are a number of methods and tools to help you.  Regular expressions will help, for example to replace tabs with spaces:
M-x replace-regexp <RET>
press TAB key <RET>
press SPACE BAR desired number of times <RET>
 
Also, C-x, h to mark buffer, then M-C-\ to indent all lines according to your style might help.

exits funnel <exitsfunnel@yahoo.com> wrote:
Hello,

I'm trying to find a way to distinguish tabs from
consecutive spaces in some source code I've inherited
so I can get the formatting straightened out, but I
can't figure out how. I'm sure there must be a mode
which allows me to distinguish the two. If anyone
could point me in the right direction I'd really
appreciate it.

-exits




__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 


_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
		
---------------------------------
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger

[-- Attachment #1.2: Type: text/html, Size: 1530 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

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

* Re: Displaying TABS vs SPACES
  2004-06-03  3:08 Displaying TABS vs SPACES exits funnel
                   ` (2 preceding siblings ...)
  2004-06-03 12:10 ` Kevin Dziulko
@ 2004-06-03 16:03 ` Kai Grossjohann
  2004-06-10  0:14   ` exits funnel
  3 siblings, 1 reply; 11+ messages in thread
From: Kai Grossjohann @ 2004-06-03 16:03 UTC (permalink / raw)


exits funnel <exitsfunnel@yahoo.com> writes:

> I'm trying to find a way to distinguish tabs from
> consecutive spaces in some source code I've inherited
> so I can get the formatting straightened out, but I
> can't figure out how.  I'm sure there must be a mode
> which allows me to distinguish the two.  If anyone
> could point me in the right direction I'd really
> appreciate it.

You can do C-x h M-x untabify RET to convert all tabs into the right
number of spaces, or C-x h M-x tabify RET to convert all whitespace
into the shortest tab/space combination.

You can do M-x set-variable RET tab-width RET before that to specify
the width of a tab.

Does this help?

Kai

PS: I thought that M-x whitespace-buffer RET would do useful things,
but it seems it does not do that in this context.  Nevertheless, it's
a cool thing, so perhaps try it.

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

* Re: Displaying TABS vs SPACES
  2004-06-03 11:25 ` Micha Feigin
@ 2004-06-10  0:11   ` exits funnel
  2004-06-10  0:50     ` Jim Marshall
  2004-06-10  7:09     ` Micha Feigin
  0 siblings, 2 replies; 11+ messages in thread
From: exits funnel @ 2004-06-10  0:11 UTC (permalink / raw)



> I forgot the fontlock entry, this is the full entry:
> 
> (custom-set-faces
>  '(my-tab-face            ((((class color))
> (:background "gray10"))) t)
>  '(my-trailing-space-face ((((class color))
> (:background "gray10"))) t))
> 
> (add-hook 'font-lock-mode-hook
>   (function
>     (lambda ()
>       (setq font-lock-keywords
>             (append font-lock-keywords
>                     '(("\t+" (0 'my-tab-face t))
>                       ("[ \t]+$" (0
> 'my-trailing-space-face t))))))))

Hey Micha,

I'm finally back to this problem.  I added your code
and it did something, but not what I'd hoped :) 
Initially both cases showed up as black which didn't
surprise me.  However I then changed 'gray10' in the
tab-face to 'red10' but still both spaces and tabs
were showing up as black squares.  My immediate
problem is solved as I ended up using hexl-mode which
isn't too user friendly but does allow me to
differentiate the two.  A quick question though:  How
could I discover what allowable values I could use
other than 'gray10?'  I'm pretty new to emacs.  I read
the doc for custom-set-faces but it left me confused. 
Thanks for taking the time to respond.

-exits


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

* Re: Displaying TABS vs SPACES
  2004-06-03 16:03 ` Kai Grossjohann
@ 2004-06-10  0:14   ` exits funnel
  2004-06-10 16:44     ` Drew Adams
  0 siblings, 1 reply; 11+ messages in thread
From: exits funnel @ 2004-06-10  0:14 UTC (permalink / raw)



--- Kai Grossjohann <kai@emptydomain.de> wrote:
> exits funnel <exitsfunnel@yahoo.com> writes:
> 
> > I'm trying to find a way to distinguish tabs from
> > consecutive spaces in some source code I've
> inherited
> > so I can get the formatting straightened out, but
> I
> > can't figure out how.  I'm sure there must be a
> mode
> > which allows me to distinguish the two.  If anyone
> > could point me in the right direction I'd really
> > appreciate it.
> 
> You can do C-x h M-x untabify RET to convert all
> tabs into the right
> number of spaces, or C-x h M-x tabify RET to convert
> all whitespace
> into the shortest tab/space combination.
> 
> You can do M-x set-variable RET tab-width RET before
> that to specify
> the width of a tab.
> 
> Does this help?

Not really :)  It's okay though; I ended up using
hexl-mode which satisfied my needs.  I'm surprised
this is so hard in EMACS.  Thanks for taking the time
to reply.

-exits



	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

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

* Re: Displaying TABS vs SPACES
  2004-06-10  0:11   ` exits funnel
@ 2004-06-10  0:50     ` Jim Marshall
  2004-06-10  7:09     ` Micha Feigin
  1 sibling, 0 replies; 11+ messages in thread
From: Jim Marshall @ 2004-06-10  0:50 UTC (permalink / raw)


exits funnel <exitsfunnel@yahoo.com> writes:

>
> Hey Micha,
>
> I'm finally back to this problem.  I added your code
> and it did something, but not what I'd hoped :) 

You might want to try "blank-mode":
http://www.cpqd.com.br/~vinicius/emacs/#blank-mode.el

>  A quick question though: How could I discover what allowable values
> I could use other than 'gray10?'

Try M-x list-colors-display RET

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

* Re: Displaying TABS vs SPACES
  2004-06-10  0:11   ` exits funnel
  2004-06-10  0:50     ` Jim Marshall
@ 2004-06-10  7:09     ` Micha Feigin
  1 sibling, 0 replies; 11+ messages in thread
From: Micha Feigin @ 2004-06-10  7:09 UTC (permalink / raw)


On Wed, Jun 09, 2004 at 05:11:44PM -0700, exits funnel wrote:
> 
> > I forgot the fontlock entry, this is the full entry:
> > 
> > (custom-set-faces
> >  '(my-tab-face            ((((class color))
> > (:background "gray10"))) t)
> >  '(my-trailing-space-face ((((class color))
> > (:background "gray10"))) t))
> > 
> > (add-hook 'font-lock-mode-hook
> >   (function
> >     (lambda ()
> >       (setq font-lock-keywords
> >             (append font-lock-keywords
> >                     '(("\t+" (0 'my-tab-face t))
> >                       ("[ \t]+$" (0
> > 'my-trailing-space-face t))))))))
> 
> Hey Micha,
> 
> I'm finally back to this problem.  I added your code
> and it did something, but not what I'd hoped :) 
> Initially both cases showed up as black which didn't
> surprise me.  However I then changed 'gray10' in the
> tab-face to 'red10' but still both spaces and tabs
> were showing up as black squares.  My immediate
> problem is solved as I ended up using hexl-mode which
> isn't too user friendly but does allow me to
> differentiate the two.  A quick question though:  How
> could I discover what allowable values I could use
> other than 'gray10?'  I'm pretty new to emacs.  I read

See the next email for a probably better reference. but as a guideline
AFAIK the numbers are only available for gray and I think in jumps of 5
(maybe 10 for the middle ones), other colors you can specify by name
some of them have a dark version, so try red and darkred. another
option is to give the numerical representation. Its in hex values and
is of the form #123456 the first two numbers are for red, second two
for green and last two for blue, so dark red will probably be #100000

(custom-set-faces
 '(my-tab-face            ((((class color)) (:background "#100000"))) t)
 '(my-trailing-space-face ((((class color)) (:background "gray5"))) t))

You may need to take the last \t out in the code if you want trailing
tabs to show in red also (just noticed it, didn't have time to check).

> the doc for custom-set-faces but it left me confused. 
> Thanks for taking the time to respond.
> 
> -exits
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
>  
>  +++++++++++++++++++++++++++++++++++++++++++
>  This Mail Was Scanned By Mail-seCure System
>  at the Tel-Aviv University CC.
> 

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

* RE: Displaying TABS vs SPACES
  2004-06-10  0:14   ` exits funnel
@ 2004-06-10 16:44     ` Drew Adams
  2004-06-10 17:01       ` Drew Adams
  0 siblings, 1 reply; 11+ messages in thread
From: Drew Adams @ 2004-06-10 16:44 UTC (permalink / raw)


Here's another you can try:

http://www.emacswiki.org/elisp/show-wspace.el - commands to highlight
whitespace: TABs only, hard spaces only, and all trailing whitespace.

Each uses a different highlight color, so you can highlight, for instance,
both trailing whitespace and TABs, so trailing TABs are distiguished from
trailing spaces.

 - Drew


exits funnel <exitsfunnel@yahoo.com> writes:
> I'm trying to find a way to distinguish tabs from
> consecutive spaces in some source code

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

* RE: Displaying TABS vs SPACES
  2004-06-10 16:44     ` Drew Adams
@ 2004-06-10 17:01       ` Drew Adams
  0 siblings, 0 replies; 11+ messages in thread
From: Drew Adams @ 2004-06-10 17:01 UTC (permalink / raw)


BTW, Here's a tip regarding trailing whitespace:

A simple way to remove all trailing whitespace is this:

 1. Enter picture mode:  M-x picture-mode
 2. Exit picture mode:   C-c C-c

The only side effect of this is that all trailing whitespace is removed.

I discovered this odd (and undocumented?) "feature" by accident about 20
years ago. So, it has been around since about version 18 of GNU Emacs -
perhaps it's even older.

 - Drew

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

end of thread, other threads:[~2004-06-10 17:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-03  3:08 Displaying TABS vs SPACES exits funnel
2004-06-03 11:22 ` Micha Feigin
2004-06-03 11:25 ` Micha Feigin
2004-06-10  0:11   ` exits funnel
2004-06-10  0:50     ` Jim Marshall
2004-06-10  7:09     ` Micha Feigin
2004-06-03 12:10 ` Kevin Dziulko
2004-06-03 16:03 ` Kai Grossjohann
2004-06-10  0:14   ` exits funnel
2004-06-10 16:44     ` Drew Adams
2004-06-10 17:01       ` Drew Adams

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.