Thanks to this post, I was able to remove some of the ugly underlining semantic utilizes with it's inline parsing, but I still have a hyphen appearing at each of my function calls (and sometimes else where) that I would really like to remove. How can I do this? I have also looked through http://www.gnu.org/software/emacs/manual/html_mono/semantic.html#Tag-Decoration-Mode.
Reference image:
I'd suggest looking at your CEDET config instead.
You're probably calling semantic-load-enable-excessive-code-helpers.
And this function got its name for a reason.
So instead of enabling a function that has excessive it its name,
and then trying to remove the excessive features, why not just stick with the basics?
Just to show you my CEDET setup:
(load "~/git/cedet/cedet-devel-load")
(add-to-list 'semantic-lex-c-preprocessor-symbol-file
"~/Software/deal.II/include/deal.II/base/config.h")
(semantic-add-system-include "~/Software/deal.II/include/" 'c++-mode)
(set-default 'semantic-case-fold t)
(semantic-mode 1)
But if there some extra cool functionality that
only semantic-load-enable-excessive-code-helpers provides, please let me know.
It turns out that the hyphen was part of the semantic tag folding mode, which functions to collapse and expand code blocks in the gui version of emacs. I am not sure the same functionality is achieved in the terminal interface; but regardless, to remove these hyphens from my code, all I had to do was turn off
(global-semantic-tag-folding-mode)
Related
I have a bunch of elisp and other code with some notes i wanted to reformat to be more organized, and i found that having to type
#+BEGIN_SRC emacs-lisp ... #+END_SRC
all the time around what i want, is taking a bit longer than expected...
So what i wanted to do instead is to wrap/or put the selected content (with C-space) and put it in a template source code block for org-mode (in my case it's mostly elisp code, but i plan to use it for other things maybe)
How could i do this in emacs or in elisp?
There is a new templating mechanism in recent Org mode (>= 9.0 IIRC) that allows you tor wrap a region in a block: after selecting the region in the usual manner, you say C-c C-, s. You still have to type the emacs-lisp part though. That's the disadvantage. The advantage is that it is general enough to allow you to wrap a region in any kind of block. In your case, I think the disadvantage outweighs the advantage, so I would go with the wrap-region method in the other answer, but this one is good to know as well.
You can try wrap-region. It will allow you to define what type of string you want to wrap around a selection.
Put this in your init.el and evaluate it.
(wrap-region-global-mode t)
(wrap-region-add-wrapper "#+BEGIN_SRC emacs-lisp\n" "#+END_SRC" "#" 'org-mode)
Then, while you are editing your org files, you can select a block of text and type #, which will wrap it with your string. You can change the # to another character that will do the wrapping.
There is a feature in org-mode to do exactly that. It's like a snippet of some sort where you enter <eland hit TAB, the < char is here to say we're gonna use a template and the el part tells which template to use. But of course, you have to configure it first.
For that, you can just add this to an org-mode file or to your init.el file :
#+begin_src emacs-lisp
;; This is needed as of Org 9.2
(require 'org-tempo)
(add-to-list `org-structure-template-alist `("sh" . "src shell"))
(add-to-list `org-structure-template-alist `("el" . "src emacs-lisp"))
(add-to-list `org-structure-template-alist `("py" . "src python"))
#+end_src
There a bunch of way to use this, it's actually more useful than just use it as a template, you can go check the documentation here.
I use a custom mode for a certain type of files just for syntax highlighting. But c-style indentation does not work when I load that mode. I don't want to write the rules for indentation for this mode.
Here is the link for the mode I'm using
How can I use the Emacs default c-style indentation in this custom mode?
Thanks.
c-mode installs its own parser to calculate indentation. Therefore, switching on c-indentation is not as simple as it seems to be (you cannot simply set indent-line-function and indent-region-function).
You can try the following:
(add-hook 'ned-mode-hook (lambda ()
(c-init-language-vars c-mode)
(c-basic-common-init 'c-mode "user")))
I noticed regular expressions for comments and strings in ned-font-lock-keywords. As far as I understand font-lock, this is wrong. Comments and strings are handled by the Parse-Partial-Sexp parser (see syntax-ppss) and not via regular expressions.
Furthermore, ned-mode should be derived from prog-mode and not from text-mode.
I'm trying to get doremi working in emacs. Specifically, at this stage, to allow me to quickly scroll through a condensed list of color-themes and see each theme as I go through it. For this I would use the 'M-x doremi-color-themes+' command.
What I've done:
Installed color-themes (successfull)
Installed doremi.el, doremi-cmd.el, ring+.el and added
(add-to-list 'loadpath "~/elisp/themes")
(add-to-list 'loadpath "~/elisp/doremi/")
(require 'color-theme)
(color-theme-initialize)
(color-theme-classic)
;; create a list of color themes to scroll through using 'doremi-cmd
(setq my-color-themes (list 'color-theme-classic
'color-theme-retro-green
'color-theme-gray30
'color-theme-subtle-hacker
'color-theme-jonadabian-slate))
(require 'doremi)
(require 'doremi-cmd)
(require 'ring+)
to the .emacs file.
What emacs does:
When I type the comand 'M-x doremi-color-themes+' into the mini-buffer it seems to accept that I've given it a valid command and tells me to use the and arrow keys to move through the list. But when I do that all that happens is the cursor moves up and down in the active window. No changing of color-themes.
Being somewhat new to emacs (and especially customising it) I'm sure I have missed a step or put something in the wrong place. Perhaps there's some sort of (setq 'bla-bla-bla (...)) I need to do?
Sorry for your trouble. Please state your Emacs version (M-x emacs-version), and your version of color-theme.el.
You do not need to require library ring+.el if you use Emacs 23 or later (its code was included in GnuEmacs 23.)
You do not need to use (color-theme-initialize) or (color-theme-classic). The former is done automatically by doremi-color-themes+.
Try starting from emacs -Q (i.e., no init file, ~/.emacs), to be sure there is no interference from stuff in your init file.
Your variable my-color-themes is not referenced anywhere. Instead of defining that variable, just customize user option doremi-color-themes. (Or leave its value nil, which means that all color themes will be cycled through.)
Feel free to contact me by email if you continue to have a problem. Or continue here, if you prefer.
[Just to be sure: you are using color-theme.el, right? There is a lot of confusion out there between Emacs "custom themes" and color themes. Do Re Mi supports both, but they are different critters.]
After a bit for back and forth with #Drew we found a solution to the problem.
It turned out the major problem was that I was using emacs in 'terminal mode' rather than as a GUI application. Bare in mind I'm using a mac.
In the context of Terminal, my arrow keys send escape sequences and so doremi cannot read the event as intended. So it just escapes and applies the message to the active buffer.
There is an answer.
By adding the following lines to my .emacs file (or whatever your init file for emacs is) I was able to redirect doremi to use two other keys. ie. not the up and down arrows.
(setq doremi-down-keys '(?n))
(setq doremi-up-keys '(?p))
Doing this tells doremi to use 'n' as the down key and 'p' as the up key. And all works just fine.
Because I am only new to the world of programming and computing I may often use incorrect terminology. If this is the case please let me know and I will edit accordingly for clarity and consistency.
Hi I work on a very large and complex C code base (complex not in a good way). The codebase dwarfs the linux kernel to give you an idea. I have set up emacs to do most of what I want. I get autocompletion on functions and variables but there are certain things which do not work (omni-completion).
I use cedet v2, xgtags, auto-complete, yastnippet, cscope and a few other tools all of which are installed via el-get on emacs-24. When I work on a smaller project, omni-completion in C works so I would get a list of the members of a struct when I access the object. However, in the very large "project", omni-completion does not work when accessing a struct. As I said, I get completion on functions and variables but not on structures.
My explanation is that auto-completion is using its parser which cannot handle the size and complexity of the codebase. However, gtags or etags can handle it.
Is there a way to make auto-complete look into the gtags (xgtags) database? My gtags are working very well indeed.
EDIT:
I am not an admin on my system and I cannot install packages easily. At the moment, I do not have clang. Having said that, I am quite capable of compiling from source and can get many packages this way.
Using clang+automplete is also an option:
http://truongtx.me/2013/03/06/emacs-ccpp-autocomplete-with-clang/
Edit: I see you've edited the question indicating you have no clang. I leave this answer here regardless, in case someone else finds it useful.
Have you tried ac-source-gtags that is comes together with auto-complete package? You can also combine several sources, like described in documentation...
I have found that cedet is really underwhelming.
I would recommend using just one tool which does everything
https://github.com/Andersbakken/rtags
It underlines errors as you type as well as using smart completions. Just add this to your init file after obtaining the required emacs packages
(require 'rtags)
(require 'popup)
(require 'rtags-ac)
(setq rtags-completions-enabled t)
(rtags-enable-standard-keybindings c-mode-base-map)
(add-hook 'c++-mode-hook
(lambda ()
(setq ac-sources '(ac-source-rtags)
)))
the guys of the plain tex-mode have added a very nice feature with emacs 24.1, a minor mode called latex-electric-env-pair-mode which keeps existing \begin{...} [...] \end{...} pairs matched. I.e. when changing the environment name in the \begin{...} tag, its corresponding \end{...} is changed automatically (very nice when changing from starred to non-starred version of an environment and vice-versa).
However, when comparing with AUCTeX, the tex-mode still sucks... but I really like the new minor mode. I have tried to make a stand-alone minor mode by copying everything that looked like it was used from tex-mode.el to a new file and changed all the descriptors (so they won't conflict with AUCTeX or any remainders for tex-mode). Unfortunately this won't work, the minor mode can be turned on but it is broke: nothing is happening.
I'm not a (e)lisp programmer, that is to say I don't really understand the code. But maybe someone likes the feature of this minor mode and can port it to a stand-alone version?
Also there might be some package out there which provides similar/equal functionality?
I'd appreciate any help!
You probably missed tex-env-mark (which sets marks that are used later by latex-electric-env-pair-mode to find environment starters/enders) or latex-syntax-propertize-rules (which runs tex-env-marks on relevant parts of the buffer) or the setting of syntax-propertize-function (which uses latex-syntax-propertize-rules so that these rules are actually used).
BTW, rather than copying those things, I recommend you try something like the untested code below:
(defconst my-latex-syntax-propertize-function
(with-temp-buffer (latex-mode) syntax-propertize-function))
(add-hook 'LaTeX-mode-hook
(lambda ()
(set (make-local-variable 'syntax-propertize-function)
my-latex-syntax-propertize-function)
(latex-electric-env-pair-mode 1)))