Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7519651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:56:20+00:00 2026-05-30T01:56:20+00:00

I’m using MulgaSoft’s fantastic Emacs+ Eclipse Plug-in to make Eclipse usable for my emacs’d

  • 0

I’m using MulgaSoft’s fantastic Emacs+ Eclipse Plug-in to make Eclipse usable for my emacs’d fingers.

However, I am unable to setup a working Alt+q binding for ‘Format Element’. When writing a comment, for example in Java code, I’d like to be able to hit Alt+q from time-to-time to re-flow the current paragraph of text. (Mostly I just want the comment to wrap at ~80 columns.)

So, I went into Preferences -> General -> Keys and bound Format Element to Alt+Q
“when” Editing in Structured Text Editors (category Source).

If I type Alt+x format-element with the cursor in a long Java comment the correct thing happens (the text reflows). But hitting Alt+q does not do anything.

If I ask Eclipse what Alt+q is bound to (by typing Ctrl+h k Alt+q), I get:

Alt+Q runs format-element
    Id -org.eclipse.wst.jsdt.ui.edit.text.java.quick.format
 Key Bindings
    ALT+Q [org.eclipse.ui.contexts.dialogAndWindow]
 Description
    Format enclosing text element

As far as I can tell (by sorting on ‘Binding’) in the Key preferences nothing else is bound to Alt+Q. (Well, I tried binding it in some additional “When” contexts, but that didn’t help …)

screenshot of Alt+Q keybindings

I’m not sure if this is a problem with the Emacs+ plugin or with Eclipse (since “Format Element” is an eclipse primitive?). I’ve restarted Eclipse more than once with these bindings defined.

Update

With @mfeber’s suggestions I’ve tweaked the key bindings, but am still not having success. I’ve reduced to just one binding with a “when” of just Editing Text.

Now when I run Ctrl+h k Alt+q I see:

Alt+Q runs format-element
    Id -org.eclipse.wst.jsdt.ui.edit.text.java.quick.format
 Key Bindings
    ALT+Q [org.eclipse.ui.textEditorScope]
 Description
    Format enclosing text element

The difference is the “[org.eclipse.ui.textEditorScope]” in the Key Bindings section. The new value does better match what other key bindings like “Ctrl+O” show.

Oddly, if I run Ctrl+h w format-element I get:

format-element is unbound

But running Ctrl+h w for other commands like forward-character or insert-line-above-current-line does print the correct list of key bindings for that function. So there is something a bit wacky still.

One other thing I noticed is that there is a ‘Format Element’ entry in the key bindings that has a blank ‘When’ and ‘Binding’ (the above screenshot was sorted on ‘Binding’ so it didn’t show this, but I’m pretty sure it was there before):

screenshot #2 of Alt+Q keybindings

Are there any tools or logs for debugging key bindings in Eclipse that I can turn on?

Update #2

To figure out which underlying id is being bound (as @mfeber’s update suggested), I’ve tried a couple more things.

I’ve setup multiple bindings of Alt-Q to format-element in different contexts:

screenshot #3 of Alt+Q keybindings

(I’ve tried with and without the ‘Editing Text’ binding — I’m not sure if ‘Editing Text’ might apply/conflict when editing .java or .py files, or if its purely for .txt files… Anyway I can’t see much of a difference….)

The only interesting information I’ve been able to gather is that the Ctrl+h k Alt+q shows very slightly different results when run in a .java editor and when run in a .js editor:

Here is what I get from Ctrl+h k Alt+q in a Java source editor:

Alt+Q runs format-element
    Id -org.eclipse.wst.jsdt.ui.edit.text.java.quick.format
 Key Bindings
    ALT+Q [org.eclipse.jdt.ui.javaEditorScope]
 Description
    Format enclosing text element

And here is what I get from Ctrl+h k Alt+q in a Javascript source editor:

Alt+Q runs format-element
    Id -org.eclipse.jdt.ui.edit.text.java.quick.format
 Key Bindings
    ALT+Q [org.eclipse.wst.jsdt.ui.javaEditorScope]
 Description
    Format enclosing text element

The difference is the wst.jsdt vs jdt in the package paths. I don’t really understand this, but I think it means I’m running the java formatter when in a javascript window, and the javascript formatter in a java window?

Oh … that’s it! If I switch the ‘When’ for each of those bindings, now Alt-Q works! So, despite all the key bindings looking identical in the UI, there are several different functions being bound underneath….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:56:21+00:00Added an answer on May 30, 2026 at 1:56 am

    First: you should set the ‘When’ element to ‘Editing Text’ (‘Structured Text’ is the province of things like the XML editors which provide different editing views for their content). You should see something like:

    Alt+Q runs format-element
    Id -org.eclipse.jdt.ui.edit.text.java.quick.format
    Key Bindings
    ALT+Q [org.eclipse.ui.textEditorScope]
    Description
    Format enclosing text element

    Second: you can find out the bindings for a specific key by calling describe-key (C-h k). If there is more than one binding for a given key sequence they are all listed, and the ones in bold are the ones that will be enabled in the corresponding ‘When’ context, assuming that you are not running into…

    Three: there are key bindings in Eclipse that are not exposed in the bindings preference (these are typically bindings siphoned off by the OS, so they are different in different installs). I’ve never found an easy way to disable these in Eclipse.

    Finally: glad to hear you find the Emacs+ plugin useful…

    Hope this helps,
    Mark

    Further info…
    My bad… format-element is one of those eclipse commands that has the same ‘external’ name, but multiple ids. The one you have bound is, I believe, appropriate for javascript, but not other contexts. You can suss out which one you need for java by binding each one in turn and checking the id in C-h k. For java it should be: Id –org.eclipse.jdt.ui.edit.text.java.quick.format. Then set the binding ‘When’ for ‘Editing Java Source’ and it should work in that context. You can set any others appropriately as desired.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have thousands of HTML files to process using Groovy/Java and I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.