Discussion:
Override "emulated tabs" when editing Makefiles?
Offer Kaye
2008-05-20 09:07:40 UTC
Permalink
Hi,
I don't like using tabs in my source files so I've set the NEdit
defaults to use emulated tabs. However, when editing a Makefile I
*have* to use a tab character as the first character of a command
line.

Is there a way to automatically override the "use emulated tabs"
option when in Makefile language-mode? I saw in the language-mode
window that there is a way to change the number of spaces per emulated
tab, but not the actual emulated tab setting. But I was hoping this
could be set someplace else...?

Thanks,
--
Offer Kaye
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Eddy De Greef
2008-05-20 11:13:37 UTC
Permalink
Post by Offer Kaye
Hi,
I don't like using tabs in my source files so I've set the NEdit
defaults to use emulated tabs. However, when editing a Makefile I
*have* to use a tab character as the first character of a command
line.
Is there a way to automatically override the "use emulated tabs"
option when in Makefile language-mode? I saw in the language-mode
window that there is a way to change the number of spaces per emulated
tab, but not the actual emulated tab setting. But I was hoping this
could be set someplace else...?
There's no such setting, I'm afraid, but there is a workaround using a
macro (see Default Settings->Customize Menus->Macro Menu):

- Define a macro called ***@Makefile with the following command:

insert_string("\t")

and assign an arbitrary accelerator key to it (you can't chose
Tab here yet).

- Save your default preferences.

- Open your preferences file (~/.neditrc or ~/.nedit/nedit.rc) and
look for the definition of the macro that you just created.

- Replace the accelerator that you picked by 'Tab' and save the file.

- Restart NEdit.

- If all works well, the Tab key should now always insert a Tab
character in the Makefile language mode, irrespective of the tab
emulation preferences.

Hope it works,

Eddy
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
TOM TANNER, BLOOMBERG/ LONDON OF
2008-05-20 12:04:12 UTC
Permalink
Eddy De Greef wrote:
<cut instructions on how to set up tabs>

I've just tried this, and it is very useful (it was driving me nuts as well). However, I've run across a couple of peculiarites

1) When editing a makefile, every time I press tab, a hard tab is inserted (nice), and you get thrown into the search bar. This is rather confusing.

2) (picky) when you hit return, the next line is indented but using spaces.

Despite the complaints - thanks for the instructions. Life is better now (esp as ctrl-tab doesn't always work for reasons that are beyond me).
Eddy De Greef
2008-05-20 14:30:29 UTC
Permalink
Post by TOM TANNER, BLOOMBERG/ LONDON OF
<cut instructions on how to set up tabs>
I've just tried this, and it is very useful (it was driving me nuts
as well). However, I've run across a couple of peculiarites
1) When editing a makefile, every time I press tab, a hard tab is
inserted (nice), and you get thrown into the search bar. This is rather
confusing.
I didn't notice that because I don't use the search bar. It's indeed a
showstopper. I suppose there is some hidden Motif widget keybinding that
comes into play.
Post by TOM TANNER, BLOOMBERG/ LONDON OF
2) (picky) when you hit return, the next line is indented but using spaces.
There may be a workaround by defining smart indent newline macro
(Default Settings->Indents->Program Smart Indent), but it could get hairy.
Post by TOM TANNER, BLOOMBERG/ LONDON OF
Despite the complaints - thanks for the instructions. Life is better
now (esp as ctrl-tab doesn't always work for reasons that are beyond
me).
I forgot about Ctrl-Tab because I've bound another macro to it. I have
no idea why it sometimes wouldn't work. Possibly it's related to the
search bar widget problem above (my Ctrl-Tab macro also moves the focus
to the search bar when it's turned on, or to the first pane when I have
multiple panes).

Eddy
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Andrew Hood
2008-05-20 22:03:24 UTC
Permalink
Post by TOM TANNER, BLOOMBERG/ LONDON OF
Despite the complaints - thanks for the instructions. Life is better now (esp as ctrl-tab doesn't always work for reasons that are beyond me).
I've never been able to make Ctrl-tab work on AIX. It works exactly the
same as tab, inserting spaces.
--
There's no point in being grown up if you can't be childish sometimes.
-- Dr. Who
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
AVKuznetsov
2008-05-20 17:23:06 UTC
Permalink
On Tue, 20 May 2008 12:07:40 +0300
Post by Offer Kaye
Hi,
I don't like using tabs in my source files so I've set the NEdit
defaults to use emulated tabs. However, when editing a Makefile I
*have* to use a tab character as the first character of a command
line.
Is there a way to automatically override the "use emulated tabs"
option when in Makefile language-mode? I saw in the language-mode
window that there is a way to change the number of spaces per emulated
tab, but not the actual emulated tab setting. But I was hoping this
could be set someplace else...?
Thanks,
--
Offer Kaye
Hi,

you can try the following.

In the Program Smart Indent menu set for the Makefile mode

set_use_tabs(1)
in the Language Specific Initialization Macro and Definitions field

return -1
in the Newline Macro field

Apply and Save Defaults...

Alexey Kuznetsov
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Offer Kaye
2008-05-22 08:24:56 UTC
Permalink
Post by AVKuznetsov
Hi,
you can try the following.
In the Program Smart Indent menu set for the Makefile mode
... [snip] ...
AV - thanks, this worked! At first I thought it didn't but then I
remembered to actually turn on Smart Indent :) Thanks again!

For those suggesting Ctrl-Tab - on KDE this is bound to switching
between desktops, which I find very nice and I would hate to override
it. And in any case I think AV's solution is better :)

Before I saw AV's solution I used the workaround of having a macro that does:
replace_all("^\\s+", "\\t", "regex")
And I would just run it on the file before saving. But now that I have
AV's solution I can stop doing that :)

Cheers,
--
Offer Kaye
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
AVKuznetsov
2008-05-22 09:37:11 UTC
Permalink
On Thu, 22 May 2008 11:24:56 +0300
Post by Offer Kaye
Post by AVKuznetsov
Hi,
you can try the following.
In the Program Smart Indent menu set for the Makefile mode
... [snip] ...
AV - thanks, this worked! At first I thought it didn't but then I
remembered to actually turn on Smart Indent :) Thanks again!
.....
I am glad.

Hi,

The described method provides "initialization-hook" for any mode except Plain.
You can execute any set of macros when new buffer is created or
after file is loaded. Unfortunately, that is impossible for plain files.
Plain mode is absent in the list of modes in ProgramSmartIndent menu and
it cannot be added via Add/Modify Language Mode dialog.
I consider this restriction as a "bug" while really that is not a bug.
Can I add new message to bug tracker? List of real bugs is long enough.

Alexey
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Chris Pruett
2008-05-20 18:53:17 UTC
Permalink
Is there a way to automatically override the "use emulated tabs" option
when in Makefile language-mode?

I also have emulated tabs as my default. When editing make files, I use
CTRL-TAB to insert a hard TAB character. With backlighting applied it's easy
to see the hard tabs vs. spaces.

CP



Message: 1
Date: Tue, 20 May 2008 12:07:40 +0300
From: "Offer Kaye" <offer.kaye-***@public.gmane.org>
Subject: Override "emulated tabs" when editing Makefiles?
To: "NEdit discussion list" <discuss-***@public.gmane.org>
Message-ID:
<5694250805200207t3becef28vfc99308d63b35aa3-JsoAwUIsXosN+***@public.gmane.org>
Content-Type: text/plain; charset=ISO-8859-1

Hi,
I don't like using tabs in my source files so I've set the NEdit defaults to
use emulated tabs. However, when editing a Makefile I
*have* to use a tab character as the first character of a command line.

Is there a way to automatically override the "use emulated tabs" option when
in Makefile language-mode? I saw in the language-mode window that there is a
way to change the number of spaces per emulated tab, but not the actual
emulated tab setting. But I was hoping this could be set someplace else...?

Thanks,
--
Offer Kaye
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Loading...