* Indenting text bugs.
@ 2010-03-02 10:07 Defacta
2010-03-02 16:05 ` Andrea Crotti
[not found] ` <mailman.2167.1267546021.14305.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 12+ messages in thread
From: Defacta @ 2010-03-02 10:07 UTC (permalink / raw)
To: help-gnu-emacs
Hello,
I have bugs with indentation of php files. I use php-mode and
sometimes instead of proposing to complete a name a of function or of
a variable there is the message: Indenting region... done.
A way of making it bug at all times is to do TAB when I search
something in the page thanks to ctrl+s, if not just having a lot of
php fils opened make emacs indenting fails.
So what can I do to relaunch indenting mode, the only way I have found
to use indenting when it has bugged is to restart emacs, that's
annoying...
I am under Mac OS X 10.6 with Emacs 22.3 and in my ~/emacs/.emacs fil
I have:
---
(set-foreground-color "wheat")
(set-background-color "DarkSlateGray")
(set-cursor-color "white")
(global-set-key [(tab)] 'smart-
tab)
(defun smart-tab ()
"This smart tab is minibuffer compliant: it acts as usual in the
minibuffer. Else, if mark is active, indents region. Else if point is
at the end of a symbol, expands it. Else indents the current
line." (interactive) (if
(minibufferp)
(unless (minibuffer-
complete)
(dabbrev-expand
nil))
(if mark-
active
(indent-region (region-
beginning)
(region-
end))
(if (looking-at "\
\_>")
(dabbrev-expand
nil)
(indent-for-tab-command)))))
---
Thanks,
Vincent.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Indenting text bugs.
2010-03-02 10:07 Indenting text bugs Defacta
@ 2010-03-02 16:05 ` Andrea Crotti
[not found] ` <mailman.2167.1267546021.14305.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 12+ messages in thread
From: Andrea Crotti @ 2010-03-02 16:05 UTC (permalink / raw)
To: help-gnu-emacs
Defacta <boxfly@free.fr> writes:
> Hello,
>
> I have bugs with indentation of php files. I use php-mode and
> sometimes instead of proposing to complete a name a of function or of
> a variable there is the message: Indenting region... done.
>
> A way of making it bug at all times is to do TAB when I search
> something in the page thanks to ctrl+s, if not just having a lot of
> php fils opened make emacs indenting fails.
>
> So what can I do to relaunch indenting mode, the only way I have found
> to use indenting when it has bugged is to restart emacs, that's
> annoying...
I'm not sure I understood, anyway:
- indenting with TAB is I think default in many modes, if you have
selected some text
- why would you press TAB while you search with CTRL-s?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Indenting text bugs.
[not found] ` <mailman.2167.1267546021.14305.help-gnu-emacs@gnu.org>
@ 2010-03-02 18:14 ` Defacta
2010-03-02 18:45 ` Drew Adams
2010-03-02 22:45 ` Andrea Crotti
0 siblings, 2 replies; 12+ messages in thread
From: Defacta @ 2010-03-02 18:14 UTC (permalink / raw)
To: help-gnu-emacs
On 2 mar, 17:05, Andrea Crotti <andrea.crott...@gmail.com> wrote:
> Defacta <box...@free.fr> writes:
> > Hello,
>
> > I have bugs with indentation of php files. I use php-mode and
> > sometimes instead of proposing to complete a name a of function or of
> > a variable there is the message: Indenting region... done.
>
> > A way of making it bug at all times is to do TAB when I search
> > something in the page thanks to ctrl+s, if not just having a lot of
> > php fils opened make emacs indenting fails.
>
> > So what can I do to relaunch indenting mode, the only way I have found
> > to use indenting when it has bugged is to restart emacs, that's
> > annoying...
>
> I'm not sure I understood, anyway:
> - indenting with TAB is I think default in many modes, if you have
> selected some text
> - why would you press TAB while you search with CTRL-s?
ok, sorry but I am not fluent in english and I understood just now
what's not working:
I use tab to expand and to indent the code.
The .emacs file you can see above makes me do both by typing tab but
sometimes there is a bug and it's impossible to use tab to expand,
instead of expanding the name of a function I am writing, it will
write "Indenting region... done".
I looked for many way to use tab to expand, for example I tried to
understand this page:
http://emacsblog.org/2007/03/12/tab-completion-everywhere/
but with no success. :-(
I am under Mac OS X and I don't know how to expand, that's why I am
looking for a way to use tab to increment (by default) and to expand
as well...
How could I set a keyboard short cut to expand instead of trying to
find a way to use tab for doing both ?
Thanks,
Vincent.
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: Indenting text bugs.
2010-03-02 18:14 ` Defacta
@ 2010-03-02 18:45 ` Drew Adams
2010-03-02 22:11 ` Suvayu Ali
[not found] ` <mailman.2189.1267567845.14305.help-gnu-emacs@gnu.org>
2010-03-02 22:45 ` Andrea Crotti
1 sibling, 2 replies; 12+ messages in thread
From: Drew Adams @ 2010-03-02 18:45 UTC (permalink / raw)
To: 'Defacta', help-gnu-emacs
> I looked for many way to use tab to expand, for example I tried to
> understand this page:
> http://emacsblog.org/2007/03/12/tab-completion-everywhere/
> but with no success. :-(
>
> I am under Mac OS X and I don't know how to expand, that's why I am
> looking for a way to use tab to increment (by default) and to expand
> as well...
>
> How could I set a keyboard short cut to expand instead of trying to
> find a way to use tab for doing both ?
Normally, `M-TAB' (hence `ESC TAB') will complete text (e.g. a function name) at
point. It is bound by default to `complete-symbol', `lisp-complete-symbol',
`completion-at-point', or something similar, depending on the current mode and
your Emacs version.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Indenting text bugs.
2010-03-02 18:45 ` Drew Adams
@ 2010-03-02 22:11 ` Suvayu Ali
2010-03-02 23:44 ` Lennart Borgman
[not found] ` <mailman.2189.1267567845.14305.help-gnu-emacs@gnu.org>
1 sibling, 1 reply; 12+ messages in thread
From: Suvayu Ali @ 2010-03-02 22:11 UTC (permalink / raw)
To: help-gnu-emacs
On 02/03/10 07:45 PM, Drew Adams wrote:
>> I looked for many way to use tab to expand, for example I tried to
>> understand this page:
>> http://emacsblog.org/2007/03/12/tab-completion-everywhere/
>> but with no success. :-(
>>
>> I am under Mac OS X and I don't know how to expand, that's why I am
>> looking for a way to use tab to increment (by default) and to expand
>> as well...
>>
>> How could I set a keyboard short cut to expand instead of trying to
>> find a way to use tab for doing both ?
>
> Normally, `M-TAB' (hence `ESC TAB') will complete text (e.g. a function name) at
> point. It is bound by default to `complete-symbol', `lisp-complete-symbol',
> `completion-at-point', or something similar, depending on the current mode and
> your Emacs version.
>
Isn't that a very inconvenient default? Almost every window manager
across platforms intercept that to switch windows...
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Indenting text bugs.
2010-03-02 18:14 ` Defacta
2010-03-02 18:45 ` Drew Adams
@ 2010-03-02 22:45 ` Andrea Crotti
1 sibling, 0 replies; 12+ messages in thread
From: Andrea Crotti @ 2010-03-02 22:45 UTC (permalink / raw)
To: help-gnu-emacs
Defacta <boxfly@free.fr> writes:
> ok, sorry but I am not fluent in english and I understood just now
> what's not working:
> I use tab to expand and to indent the code.
> The .emacs file you can see above makes me do both by typing tab but
> sometimes there is a bug and it's impossible to use tab to expand,
> instead of expanding the name of a function I am writing, it will
> write "Indenting region... done".
>
> I looked for many way to use tab to expand, for example I tried to
> understand this page:
> http://emacsblog.org/2007/03/12/tab-completion-everywhere/
> but with no success. :-(
>
> I am under Mac OS X and I don't know how to expand, that's why I am
> looking for a way to use tab to increment (by default) and to expand
> as well...
>
> How could I set a keyboard short cut to expand instead of trying to
> find a way to use tab for doing both ?
>
> Thanks,
> Vincent.
1. don't talk about a bug, it's just the behaviour you're setting..
2. I suggest you to use auto complete instead, see here
http://www.emacswiki.org/emacs/AutoComplete
3. of course you can disable the indention I guess and only try to
complete, but I think indention with tab is also very nice..
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Indenting text bugs.
2010-03-02 22:11 ` Suvayu Ali
@ 2010-03-02 23:44 ` Lennart Borgman
2010-03-02 23:56 ` Suvayu Ali
2010-03-03 0:19 ` Drew Adams
0 siblings, 2 replies; 12+ messages in thread
From: Lennart Borgman @ 2010-03-02 23:44 UTC (permalink / raw)
To: Suvayu Ali; +Cc: help-gnu-emacs
On Tue, Mar 2, 2010 at 11:11 PM, Suvayu Ali <fatkasuvayu+linux@gmail.com> wrote:
>>
>> Normally, `M-TAB' (hence `ESC TAB') will complete text (e.g. a function
>> name) at
>> point. It is bound by default to `complete-symbol',
>> `lisp-complete-symbol',
>> `completion-at-point', or something similar, depending on the current mode
>> and
>> your Emacs version.
>>
>
> Isn't that a very inconvenient default? Almost every window manager across
> platforms intercept that to switch windows...
Yes, some of us think that it is. Note hoever that it is "Meta-Tab",
not "Alt-Tab".
Personally I use the left window key (instead of Alt) as Emacs' Meta.
On ms windows that requires the patched version of Emacs+EmacsW32
however.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Indenting text bugs.
2010-03-02 23:44 ` Lennart Borgman
@ 2010-03-02 23:56 ` Suvayu Ali
2010-03-03 0:19 ` Drew Adams
1 sibling, 0 replies; 12+ messages in thread
From: Suvayu Ali @ 2010-03-02 23:56 UTC (permalink / raw)
To: Lennart Borgman; +Cc: help-gnu-emacs
On 03/03/10 12:44 AM, Lennart Borgman wrote:
> On Tue, Mar 2, 2010 at 11:11 PM, Suvayu Ali<fatkasuvayu+linux@gmail.com> wrote:
>>>
>>> Normally, `M-TAB' (hence `ESC TAB') will complete text (e.g. a function
>>> name) at
>>> point. It is bound by default to `complete-symbol',
>>> `lisp-complete-symbol',
>>> `completion-at-point', or something similar, depending on the current mode
>>> and
>>> your Emacs version.
>>>
>>
>> Isn't that a very inconvenient default? Almost every window manager across
>> platforms intercept that to switch windows...
>
>
> Yes, some of us think that it is. Note hoever that it is "Meta-Tab",
> not "Alt-Tab".
>
> Personally I use the left window key (instead of Alt) as Emacs' Meta.
> On ms windows that requires the patched version of Emacs+EmacsW32
> however.
Thanks Lennart, this subtlety had escaped me. :-p
However I found the windows key is often not recognized properly when
using emacs in no-window mode, specially in some terminal emulator. A
remapping like that could be very inconvenient. Anyway, thanks to Drew I
heard about the feature, on my own I never would have found it. (I found
most of the "fancier" commands through typos ;) )
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: Indenting text bugs.
2010-03-02 23:44 ` Lennart Borgman
2010-03-02 23:56 ` Suvayu Ali
@ 2010-03-03 0:19 ` Drew Adams
2010-03-03 0:26 ` Lennart Borgman
1 sibling, 1 reply; 12+ messages in thread
From: Drew Adams @ 2010-03-03 0:19 UTC (permalink / raw)
To: 'Lennart Borgman', 'Suvayu Ali'; +Cc: help-gnu-emacs
> >> Normally, `M-TAB' (hence `ESC TAB') will complete text
> >> (e.g. a function name) at point. It is bound by default
> >> to `complete-symbol', `lisp-complete-symbol',
> >> `completion-at-point', or something similar, depending on
> >> the current mode and your Emacs version.
> >
> > Isn't that a very inconvenient default? Almost every window
> > manager across platforms intercept that to switch windows...
No, they do not intercept `ESC TAB'.
Some, such as Windows, do, by default, intercept ALT-TAB, which maps to `M-TAB'
by default (that's two "by default"s ;-)).
But you need only do this to make Windows pass `M-TAB' along to Emacs:
;; (setq w32-alt-is-meta t)
(when (fboundp 'w32-register-hot-key)
(w32-register-hot-key [M-tab]))
The first line is not really needed - t is the default value.
Variable `w32-alt-is-meta' determines whether ALT maps to Meta.
The other lines tell Windows to pass `M-TAB' to Emacs.
If ALT maps to Meta, you can register [M-tab] as a hot key.
If it does not, you can register [A-tab] as the hot key.
> Yes, some of us think that it is. Note hoever that it is "Meta-Tab",
> not "Alt-Tab".
Yes and no. It is `M-TAB' in its incarnation as ALT-TAB.
It is not `M-TAB' in its incarnation as `ESC TAB'. ;-)
Kidding aside, It's useful for users to know that they can use ESC instead of
ALT to realize Meta key sequences. Oldsters know this, because Emacs Meta
predates Meta as ALT key (AFAIK). In older versions of Emacs, Meta key bindings
are even listed as bindings on the ESC keymap.
And it is useful to know that it is the ALT key that Windows grabs by default
(e.g. ALT-TAB); it is not necessarily the Meta key - as you indicate yourself,
Lennart, in what you say next:
> Personally I use the left window key (instead of Alt) as Emacs' Meta.
In sum:
1. You can use ESC instead of the Alt key, even if Windows grabs ALT-TAB.
2. If you want, you can tell Windows not to grab ALT-TAB but to pass it along to
Emacs.
(3. If you want, Emacs will fix you a delicious bouillabaisse for supper...)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Indenting text bugs.
2010-03-03 0:19 ` Drew Adams
@ 2010-03-03 0:26 ` Lennart Borgman
2010-03-03 1:15 ` Drew Adams
0 siblings, 1 reply; 12+ messages in thread
From: Lennart Borgman @ 2010-03-03 0:26 UTC (permalink / raw)
To: Drew Adams; +Cc: help-gnu-emacs
On Wed, Mar 3, 2010 at 1:19 AM, Drew Adams <drew.adams@oracle.com> wrote:
>> >
>> > Isn't that a very inconvenient default? Almost every window
>> > manager across platforms intercept that to switch windows...
>
> No, they do not intercept `ESC TAB'.
But if you use a vi emulator in Emacs like Viper (which many uses)
then you can not use ESC TAB since ESC is caught by the vi emulator.
> Some, such as Windows, do, by default, intercept ALT-TAB, which maps to `M-TAB'
> by default (that's two "by default"s ;-)).
>
> But you need only do this to make Windows pass `M-TAB' along to Emacs:
>
> ;; (setq w32-alt-is-meta t)
> (when (fboundp 'w32-register-hot-key)
> (w32-register-hot-key [M-tab]))
>
> The first line is not really needed - t is the default value.
> Variable `w32-alt-is-meta' determines whether ALT maps to Meta.
>
> The other lines tell Windows to pass `M-TAB' to Emacs.
> If ALT maps to Meta, you can register [M-tab] as a hot key.
> If it does not, you can register [A-tab] as the hot key.
And this does not always work (as I have told many, many times). To
make it work correctly you need the patched version of Emacs+EmacsW32
(and then the recipe is a bit different).
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: Indenting text bugs.
2010-03-03 0:26 ` Lennart Borgman
@ 2010-03-03 1:15 ` Drew Adams
0 siblings, 0 replies; 12+ messages in thread
From: Drew Adams @ 2010-03-03 1:15 UTC (permalink / raw)
To: 'Lennart Borgman'; +Cc: help-gnu-emacs
Hi Lennart,
> >> > Isn't that a very inconvenient default? Almost every window
> >> > manager across platforms intercept that to switch windows...
> >
> > No, they do not intercept `ESC TAB'.
>
> But if you use a vi emulator in Emacs like Viper (which many uses)
> then you can not use ESC TAB since ESC is caught by the vi emulator.
Hey, if something else steals ESC, then sure, it's not available for this. That
goes without saying.
But with the normal ESC map, this is not a problem.
We're not, here, going to list every possible Emacs library that might modify
the ESC map are we?
If you bind `C-h f' to `forward-char', then it won't do `describe-function'
anymore. But that's not a reason not to inform help-gnu-emacs readers that `C-h
f' is normally `describe-function'. Same thing here.
> > But you need only do this to make Windows pass `M-TAB'
> > along to Emacs:
> >
> > (when (fboundp 'w32-register-hot-key)
> > (w32-register-hot-key [M-tab]))
>
> And this does not always work (as I have told many, many times). To
> make it work correctly you need the patched version of Emacs+EmacsW32
> (and then the recipe is a bit different).
Yes, you've said that many, many times. But never (AFAIK) with any explanation
or demonstration. You've hinted that there might be some corner cases that are
problematic, but I've never heard anything more concrete.
What can I say? It's always worked for me. No doubt I just haven't run into
those corner cases.
I don't doubt that you are speaking the truth when you say you've run into a
problem, but if you aren't more specific than that, then saying that is not very
helpful.
Unless you provide some helpful info about it, this is like Chicken Little
screaming "The sky is falling!". That might scare some people away from trying
it, when trying it might actually be useful for them.
I understand that from your perspective this is a problem and Emacs+EmacsW32 is
the solution. But I've never experienced the problem, and AFAIK you have never
explained the problem.
How about a simple recipe starting with `emacs -Q' in unpatched, vanilla Emacs,
to demonstrate the problem? Then users can decide if it's something they need to
worry about.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Indenting text bugs.
[not found] ` <jwvd3zlfk7j.fsf-monnier+gnu.emacs.help@gnu.org>
@ 2010-03-04 10:27 ` Defacta
0 siblings, 0 replies; 12+ messages in thread
From: Defacta @ 2010-03-04 10:27 UTC (permalink / raw)
To: help-gnu-emacs
On 3 mar, 17:32, Stefan Monnier <monn...@iro.umontreal.ca> wrote:
> >> Normally, `M-TAB' (hence `ESC TAB') will complete text
> >> (e.g. a function name) at point. It is bound by default to
> >> `complete-symbol', `lisp-complete-symbol', `completion-at-point', or
> >> something similar, depending on the current mode and your
> >> Emacs version.
> > Isn't that a very inconvenient default? Almost every window manager across
> > platforms intercept that to switch windows...
>
> Yes, that's a problem. Here's the way I see the situation:
> - Emacs used M-TAB for completion long before window managers ;-)
> - TAB is used for completion in the Emacs minibuffer as well as in many
> other applications, so it makes sense to bind in-buffer completion to
> a key similar to TAB.
> - In a buffer, TAB normally does indentation rather than completion.
> - S-TAB would not be a good default because it usually cannot be
> distinguished from TAB when run in a terminal(emulator) or in
> a console.
> - so we're currently stuck with M-TAB which can be used either as ESC
> TAB, or by distinguishing Meta from Alt, or by reconfiguring your
> window-manager to use another key.
>
> In Emacs-23.2, the default TAB command has been changed so that by
> setting tab-always-indent to `complete', you can have it do both
> indentation and completion (it first tries to re-indent and if the line
> was already properly indented, then it tries completion), but it's not
> a perfect solution: it's a bit too DWIM in some cases, it fails when
> tab-indentation cycles among various indentations (as is the case in
> haskell-mode), and it only works for those modes that use the new
> completion-at-point-functions functionality (very few do as of now).
>
> Stefan
Hello there,
Actually I have this problem really often and I have to find a
solution better than by closing a file and reopening it. I have
functions in my code with long names looking like this:
JS_dis_create_Account() so, I do need the completion to work, that's
so much useful...
I use ALT+tab to complete functions names, but after a while instead
of completing it writes "Indenting region...done", and if I go in
another buffer, and try ALT-tab it will complete my function name.
Maybe I should try to set another shortcut for completion. How do I
set for exemple CTRL-f for completion instead of having CTRL-f to go
to the next character.
Thanks,
Vincent.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2010-03-04 10:27 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-02 10:07 Indenting text bugs Defacta
2010-03-02 16:05 ` Andrea Crotti
[not found] ` <mailman.2167.1267546021.14305.help-gnu-emacs@gnu.org>
2010-03-02 18:14 ` Defacta
2010-03-02 18:45 ` Drew Adams
2010-03-02 22:11 ` Suvayu Ali
2010-03-02 23:44 ` Lennart Borgman
2010-03-02 23:56 ` Suvayu Ali
2010-03-03 0:19 ` Drew Adams
2010-03-03 0:26 ` Lennart Borgman
2010-03-03 1:15 ` Drew Adams
[not found] ` <mailman.2189.1267567845.14305.help-gnu-emacs@gnu.org>
[not found] ` <jwvd3zlfk7j.fsf-monnier+gnu.emacs.help@gnu.org>
2010-03-04 10:27 ` Defacta
2010-03-02 22:45 ` Andrea Crotti
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).