unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* text-mode tab questions
@ 2002-09-09  0:38 mike hardy
  2002-09-09 17:51 ` Kevin Rodgers
  0 siblings, 1 reply; 4+ messages in thread
From: mike hardy @ 2002-09-09  0:38 UTC (permalink / raw)



Howdy -

I use text-mode where the default binding for tab is indent-relative
(according to Info).  But I only like indent-relative once (following
<cr>) and would like to have tab key thereafter use tab-to-tab-stop to
EOL.  Can this be done such that all I have to do is hit tab key and 'it'
figures out when to go into tab-to-tab-stop mode?

Also, I think I'd like to start using untabify on a text buffer when I
save it.  How can I do this so that C-x C-s invokes that automatically so
that I don't have to remember (or maybe there's already something to do
this)?

Mike
-- 



------------------------
mhardy_mail@NO_SPAM@yahoo.com

  Help Wanted: Psychic.  You know where to apply.

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

* Re: text-mode tab questions
  2002-09-09  0:38 text-mode tab questions mike hardy
@ 2002-09-09 17:51 ` Kevin Rodgers
  2002-09-09 22:34   ` mike hardy
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Rodgers @ 2002-09-09 17:51 UTC (permalink / raw)


mike hardy wrote:

> I use text-mode where the default binding for tab is indent-relative
> (according to Info).  But I only like indent-relative once (following
> <cr>) and would like to have tab key thereafter use tab-to-tab-stop to
> EOL.  Can this be done such that all I have to do is hit tab key and 'it'
> figures out when to go into tab-to-tab-stop mode?

(defadvice indent-relative (around last-command-tab-to-tab-stop activate)
  "If the last command was `indent-relative', run `tab-to-tab-stop' instead."
  (if (eq last-command 'indent-relative)	; this-command
      (call-interactively 'tab-to-tab-stop)
    ad-do-it))


> Also, I think I'd like to start using untabify on a text buffer when I
> save it.  How can I do this so that C-x C-s invokes that automatically so
> that I don't have to remember (or maybe there's already something to do
> this)?


Try setting write-contents-hooks (which see) within a text-mode-hook function.

-- 
Kevin Rodgers <kevinr@ihs.com>

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

* Re: text-mode tab questions
  2002-09-09 17:51 ` Kevin Rodgers
@ 2002-09-09 22:34   ` mike hardy
  2002-09-10 16:18     ` Kevin Rodgers
  0 siblings, 1 reply; 4+ messages in thread
From: mike hardy @ 2002-09-09 22:34 UTC (permalink / raw)



Nostradamus foretold that on Mon Sep 09 2002, Kevin Rodgers would write:

> mike hardy wrote:
> 
> > I use text-mode where the default binding for tab is indent-relative
> > (according to Info).  But I only like indent-relative once (following
> > <cr>) and would like to have tab key thereafter use tab-to-tab-stop to
> > EOL.  Can this be done such that all I have to do is hit tab key and 'it'
> > figures out when to go into tab-to-tab-stop mode?
> 
> (defadvice indent-relative (around last-command-tab-to-tab-stop activate)
>   "If the last command was `indent-relative', run `tab-to-tab-stop' instead."
>   (if (eq last-command 'indent-relative)	; this-command
>       (call-interactively 'tab-to-tab-stop)
>     ad-do-it))
> 

Outstanding (don't know ear-to-ear grin emoticon).  Thx alot...

Mike
-- 



------------------------
mhardy_mail@NO_SPAM@yahoo.com

  Help Wanted: Psychic.  You know where to apply.

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

* Re: text-mode tab questions
  2002-09-09 22:34   ` mike hardy
@ 2002-09-10 16:18     ` Kevin Rodgers
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2002-09-10 16:18 UTC (permalink / raw)


mike hardy wrote:

> Nostradamus foretold that on Mon Sep 09 2002, Kevin Rodgers would write:
>>(defadvice indent-relative (around last-command-tab-to-tab-stop activate)
>>  "If the last command was `indent-relative', run `tab-to-tab-stop' instead."
>>  (if (eq last-command 'indent-relative)	; this-command
>>      (call-interactively 'tab-to-tab-stop)
>>    ad-do-it))
> 
> Outstanding (don't know ear-to-ear grin emoticon).  Thx alot...

You're welcome.  You might want to add a few checks to avoid affecting
indent-relative in other contexts:
(if (and (interactive-p)
	 (equal last-command-char ?\t)
	 (eq last-command 'indent-relative))
    ...)


-- 
Kevin Rodgers <kevinr@ihs.com>

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

end of thread, other threads:[~2002-09-10 16:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-09  0:38 text-mode tab questions mike hardy
2002-09-09 17:51 ` Kevin Rodgers
2002-09-09 22:34   ` mike hardy
2002-09-10 16:18     ` Kevin Rodgers

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