How do I find a tab character in emacs?
+14
A:
C-s C-q <TAB>
C-s starts an incremental search, and then C-q runs quoted-insert, which inserts the next character you type literally. Then, pressing the TAB key will insert a tab character. Continue hitting C-s to go to the next tab character.
Nathaniel Flath
2009-06-01 17:01:28
Thanks. Emacs newbies asking this question will want to know that <TAB> means "hit the tab key".
chernevik
2009-06-01 17:35:46
+1
A:
Hit C-s
to start an incremental search, then type C-q C-i
to search for a literal tab character.
If you want to visualize tab characters, you can add the following to your ~/.emacs
file to colorize tabs:
; Draw tabs with the same color as trailing whitespace
(add-hook 'font-lock-mode-hook
'(lambda ()
(font-lock-add-keywords
nil
'(("\t" 0 'trailing-whitespace prepend))
)
)
)
Adam Rosenfield
2009-06-01 17:02:36
Why the downvote? I just tested this in various modes in Windows emacs v22.3.1 and linux v 23.0.92.1You don't need the C-q
justinhj
2009-06-01 17:18:58
I'm speculating (and didn't downvote), but maybe because people didn't think it would work, or that they figured that if chernevik were having problems, then the unquoted TAB wasn't working for him?
Blair Conrad
2009-06-01 17:38:48
All of C-s TAB, C-s C-q TAB, and C-s C-q C-i work for me. Maybe somebody could explain when/why C-s TAB doesn't work?
Chris Conway
2009-06-01 18:42:15
A:
I use whitespace mode to highlight all tabs with the following in my .emacs file:
;whitespace http://www.emacswiki.org/emacs/WhiteSpace
(require 'whitespace)
(setq whitespace-style '(tabs tab-mark)) ;turns on white space mode only for tabs
(global-whitespace-mode 1)
Alex B
2009-06-03 03:51:43