To use auto-complete option, for writing C syntax, I have written below elisp code in .emacs file.
Here are the files in the directory.
But, amidst the typing of C syntax, I do not see the auto-complete option to select the syntax.
I am expecting the auto-complete option, as shown below, when I type while keyword. In my case, I do not see below behavior.
How do I resolve this?
Related
I am using org-mod to take note of some of my work, I have recently switched from sublime where I was used to writing some mathjax snippet.
What would be the correct and easiest way of having this snippet rendered correctly (either in the buffer or if not possible, via C-c C-c or C-c C-e).
\hat{y} = \hat{\beta}_{0}+\hat{\beta}_{1}x_{1}+\hat{\beta}_{2}x_{2}+...+\hat{\beta}_{p}x_{p}
ps : in my .emacs conf file I don't have anything closely related to mathjax or Latex.
Kr,
Enclose the latex fragment in \( ... \) or \[ ... \]and do C-c C-x C-l (bound to org-toggle-latex-fragment). See the doc string of this function for argument usage.
In recent versions of org, you customize org-preview-latex-default-process to set it to the value of the backend you want. You need either dvipng, dvisvgm or ImageMagick as the backend. See also the doc string of the variable org-preview-latex-process-alist: it might help explain some things, although you don't have to do anything with it.
If these variables don't exist, you might be using an earlier version of org where the setup is different. If that's the case, then please post which version you are using: M-x org-version would tell you.
EDIT: in earlier versions, the function is called org-preview-latex-fragment and it's not bound to a key by default. You can call it with M-x org-preview-latex-fragment and you can get rid of the preview with C-c C-c. The backend setup is different as well: there is support for dvipng and ImageMagick only and the variables are different.
Is it possible to somehow import emacs or vim sytax highlighting specifications in Eclipse? I tried searching but all I can find are questions about vim/emacs and Eclipse integration or other unrelated things.
I don't know about that other editor, but for Vim syntax highlighting, this is definitely not possible. Why?
Vim syntax definitions are written in Vimscript; it would require a complete interpreter.
Most definitions use regular expressions; no other engine implements exactly the same flavor; some atoms are unique to Vim.
If you just want similar colors in Eclipse, you can certainly re-create your Vim colorscheme in another editor. The output of :highlight gives you all defined groups and their color values.
I am working in Emacs 23, editing LaTeX via AUCTeX. I noticed in emacs that when I press C-c }, I receive the minibuffer message
Scan error: "Unbalanced parentheses", 16026, 16440
Question 1. What exactly is this command doing?
Question(s) 2. More generally, how can I determine what I a given macro is doing? Is there, for example, a universal command that request the keyboard shortcut as an input and outputs a description of the command to which that shortcut is bound? Is there a list of all active keyboard shortcuts?
Question 3. How can I find my unmatched parentheses? The post here recommends the command M-x check-parens, but it availed me nothing, not even a minibuffer message.
The answer to 1 and 2 is to do C-h k C-c } and see what the help buffer tells you. This is one of the features that allows us to call Emacs a self-documenting editor. Don't forget that you can follow the links in the help buffer to both the source code where this function is implemented and to other documentation.
You may also want to use C-h m to see all the key bindings added by the major and minor modes that are currently enabled and C-h ? to see what other interesting help functions there are.
I've never used check-parens specifically, but it does work in my current buffer, which is javascript. I see from its documentation (C-h f check-parens) that it relies on the current syntax table, so perhaps for TeX the syntax table doesn't contain enough information for check-syntax to find the error.
I have recently started to learn lisp, and have mainly bin using clisp and vim. I wanted to try sbcl as well, since this is often recommended as one of the best, free lisp compilers. There is one thing, though, which makes sbcl more difficult to use for me: I can not get autocomplete in the REPL, which I do have in clisp. That is, when I start sbcl and type the following (as an example),
* (requi<tab>
where <tab> is the literal tab character, I do not get a list of completions, but rather a verbose tab character. In clisp, <tab> will complete the previous line to * (require.
As I am fairly new to lisp, the autocomplete functionality in clisp is really handy, so it would really be very convenient if anyone could explain how to get it in sbcl as well.
One way of getting an autocompleting repl in SBCL is to use linedit, from http://common-lisp.net/project/linedit/. A second is to use rlwrap, a readline wrapper, with a suitable completions file. (I think it's fair to say that neither of these is as commonly used as emacs, which of course also provides a completing REPL with a number of other useful features.)
I don't know of a way to get an auto-completing REPL in SBCL, but I find that interfacing with my lisp environment from within SLIME is quite handy and at that point, you can use C-c C-i for auto-completion.
Actually it's completely possible. Yes, You want to work with Common Lisp via Emacs and Slime (I prefer SLY). But it's another wall beginners hit.
You want to just play from the REPL?
The following instructions allow autocomplete in SBCL with rlwrap.
https://www.cliki.net/CMUCL%20Hints
1) install rlwrap
2) create shell alias, for example putting text like
alias rs="rlwrap sbcl"
into your ~/.bashrc (or ~/.profile or whatever).
(or you can continue calling sbcl rlwrapped via "rlwrap sbcl")
3)Edi Weitz created a completion list file that is now gone from his website, so i'm linking to the Internet Archive. save this wordlist into a file "sbcl"
https://web.archive.org/web/20031207221537/http://weitz.de/files/cmucl_completions
4)You can try putting the file according to the instructions on Cliki, this will only apply for the user you are logged in under. I wanted it to work for all users, so I put the "sbcl" file into my rlwrap completion directory, which is in
/usr/share/rlwrap/completions/
So now I have a file /usr/share/rlwrap/completions/sbcl
That contains the words.
5)Create / adjust
~/.inputrc file add the line
TAB: complete
5) Done, now in a new terminal (or after reloading .bashrc)
I can launch SBCL via rlwrap with the alias "rs"
start typing (def (or whatever) and hit TAB, and get auto-completion suggestions.
Beginner Bonus - if you want to edit lisp in the terminal, from the REPL, in say, vim with parinfer, try magic-ed, which will allow you to edit files from the repl. Configuring SBCL to use ED is esoteric. This solves that issue for You.
https://github.com/sanel/magic-ed
With tab auto-completion and convenient way to edit lisp from the terminal, one can start learning Common Lisp in the terminal.
If you want to use sbcl, emacs and slime, follow this Modern Common Lisp on Linux tutorial. The tutorial mentions installing quicklisp and especially (ql:quickload "quicklisp-slime-helper"), an elispscript which getting slime to do autocomplete and more.
in gedit it's possible to define so-called "snippets" for simpler input.
For example, there is a snippet while. This means: If you type while -> (-> stands for tab key). And gedit automatically converts it to the following (including correct indentation):
while (condition){
}
In vim (in conjunction with latex-suite) I saw the following: If you type (, vim inserts just a (. If you type ( a second time, vim automatically converts it to \left( \right).
I found abbrev-mode but this mode doesn't place the cursor properly (i.e. between parentheses or inside the while loop).
I managed to create custom emacs keybindings/macros that do just the same (without having to press the tab key), so I know it's possible.
However, is there already and package where you can define such "snippets" without much effort? Or are there even any serious reasons not to use such things?
See yasnippet. It provides snippets for most major languages, and it is easy to add new ones or modify the old ones.
Yes, yasnippet is probably the way to go. But make sure you learn the major mode you're using for your editing - when writing in LaTeX, learn auctex. Major modes can contain functionality that makes some snippets pointless, and do the same thing even better. So instead of using a begin/end-snippet in a LaTeX buffer, try C-c C-e in auctex. Etc :)
Don't forget abbrev-mode.