I want to construct a ecb layout that has two special buffers. one is the output
of semantic-symref-symbol and the other is semantic-ia-fast-jump. How do I do this ?
I have cedet working and I have the ecb from Alex Ott's git repository.
The suggestions from here:
How to remove directory window and add a cscope window in Emacs ECB?
provide some input, but doesn't talk about how to hook up a function.
Related
When using tools like Org-mode and Magit the mode will sometimes show help menus. For instance, org-mode export will show a nice menu that accept single keys and then executes some command. In Magit, when looking at the status view it will accept tabs to expand the staged and commit areas.
These areas, for both Git and Org, are nicely placed to take up some portion of the emacs frame that is mostly convenient. How does emacs do choose this?
Additionally, these views are read-only, up until the user presses tab in the case of Magit and the status view. Is there a best practice when creating these views which control editing, but allows the mode to edit the file and present alternative text?
Perhaps the answer is take a look at these function A, B, and C. Which is fine, I'm just learning and experimenting on my own.
Magit in particular is not the simplest introduction to popup buffers in Emacs, but it certainly is sophisticated and a good read. Find magit-popup.el on your machine, for example M-x find-function RET magit-popup-mode-setup. To me, that function looks like a good candidate to start reading that file. You can see the macro magit-define-popup in use for example in magit-push-popup in the file magit-remote.el
In the end, it boils down to opening a new buffer in a new window and give it a dedicated major mode which has all the key-bindings.
Another good candidate is the family of temp-buffer-* functions.
Hope, that gives some pointers to start reading.
An easy way to show menus/help screens à la Magit and org-mode is with Hydras:
http://wikemacs.org/wiki/Discoverability#Hydra
https://github.com/abo-abo/hydra/
https://github.com/abo-abo/hydra/wiki
It's a short elisp method to write and it will give you a menu like org-mode. For example:
(defhydra hydra-zoom (global-map "<f2>")
"zoom"
("g" text-scale-increase "in")
("l" text-scale-decrease "out"))
ps: it's not what org-mode and magit use. Magit's system wasn't re-usable until recently and I don't know how it compares with Hydra. A nice feature of Hydras is that you can tell it to not disappear after a keypress, so than you can press many keys in a row.
Looking a the different methods for completion in CEDET semantic (fresh version from the Bazaar repository), I see I have the following options (keyboard bindings as suggested by Alex Ott in his config file)
C-c ? (semantic-ia-complete-symbol)
C-return (semantic-ia-complete-symbol-menu)
C-c , l (semantic-analyze-possible-completions)
However, none of them seem to give me the option to choose between the possible completions conveniently using the keyboard.
For example, (semantic-ia-complete-symbol-menu) opens a menu where I can choose between the different options, but as far as I can tell it requires me to use the mouse (I tried C-n, C-p, M-n, M-p to navigate the menu with no success).
On the other hand (semantic-ia-complete-symbol) opens another buffer with the options. I can also use the mouse to choose the desired autocompletion, but I would like to use the keyboard instead.
Also, in previous versions of CEDET, there was a variable (semantic-complete-inline-analyzer-displayor-class) that allowed me to choose between several options for autocompletion (e.g. (semantic-displayor-ghost), or a more elegant overlay as a tooltip), but this variable does not seem to exist anymore.
In case it matters, I work mostly with C++ files.
Update:
The only method that seems to allow me to cycle through autocompletions is C-c , space (semantic-complete-analyze-inline), where I can use TAB to autocomplete, but it doesn't show a menu of possible autocompletions that I can choose from.
In new versions of CEDET it's recommended to use auto-complete or similar packages. You can add ac-semantic to ac-sources, and then auto-complete will use Semantic as source of data for completions. The new version of Emacs/CEDET articles, mentions this setup & shows necessary code. Please try it
I cannot understand why I only see a few methods in ECB method window and if I click on half of shown methods, I get:
ECB 2.40 - Warning: The tag-visit-function `ecb-tag-visit-smart-tag-start' moves point outside of tag - ignored!
and cursor jump to this function:
void MyClass::writeLine(const char buf[]) {
send(sk,buf,strlen(buf),MSG_NOSIGNAL);
}
Emacs is: GNU Emacs 23.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.4)
Any help?
If you are using ECB using imenu to derive your methods, then behavior will be erratic at best. If you are using ECB with CEDET/Semantic for symbol tags, then there are many possible reasons for the missing methods. It could be related to pre-processor symbols, or just some syntax that Semantic doesn't support yet.
Your best bet is to try the development version of CEDET to see if it fixes the issue, and if it doesn't, post an example to the mailing list and perhaps we can figure out what is broken. The CEDET dev version is at http://cedet.sf.net.
I'm an Eclipse addict trying to get more comfortable with Emacs for C code. Is there a way to get an outline view of a C file, similar to the view on the right of the image below, in Emacs in CC mode?
(source: eclipse.org)
Check out ECB, the Emacs Code Browser.
Definitely check out Speedbar. That will make a new Emacs frame that can be used as an outline. If you want something in the same frame, check out Sr Speedbar.
ECB is an integration tool that uses Speedbar anyways. It offers a lot more functionality though - the file browser with VC integration is particularly nice IMO. All in all I think that if one needs to make Emacs look more like Eclipse he needs ECB.
Take a look at Speedbar, which will provide this kind of functionality in any mode that has imenu support (including C).
I would like to use the dired mode of emacs as my file browser. I am very much addicted to see an icon for file/folder rather that to see the extension and color. The icons give me a very quick visual feedback. I have searched the web for display of icons in dired but found none. So I wonder whether it is even possible to do this and if yes how?
To put my question clearly
How can I display icons for files and folders in dired mode of Emacs?
all-the-icons-dired is a more current solution. Another option that looks quite nice is to use treemacs-icons-dired
I just switched to treemacs-icons-dired and recommend it. Simply install the package and add a mode hook like:
(add-hook 'dired-mode-hook 'treemacs-icons-dired-mode)
If you are using Windows, you can try dired-dispicon.el.
Get the relevant files from here.
See http://wiki.gohome.org/teranisi/?EmacsOnWindows for what it looks like. Note that you will probably need a version of emacs that supports images (e.g. for Windows you could try EmacsW32).
Use the dired-icon extension, which works for GTK (on Linux).
Disclaimer: I'm the author of the extension.