How can I view source code for a builtin Emacs package?
For instance given lisp code (require 'color), I would be interested in which functions are provided by that package. I googled emacs "color.el" and found the source code. But I wonder if this file can be viewed directly from within Emacs itself? By the way, find . -name 'color*' gives
./share/emacs/24.3/lisp/color.el.gz
./share/emacs/24.3/lisp/color.elc
You can get to the source code in a single command with M-x find-library.
You can either open the file directly in Emacs. I think .gz files are by default decompressed. Usually, I pick out one function from the package I'm interested in (e.g. org-mode), look up the documentation for that using C-hf org-mode RET and then click on the file name in the documentation buffer. It will take you the source file.
So ./share/emacs/24.3/lisp/color.el.gz is the gzipped source code, and you can open that in emacs by first doing M-x auto-compression-mode, and then visiting that file.
Related
I use file named Makefile.include as a GNU makefile. I am trying to get emacs use the makefile-mode to use for this file. Alt-X makefile-mode works. Is there a way to tell emacs to use this major mode for this file right after opening automatically?
I tried putting
# _*_ mode: makefile; _*_
in the file but that does not appear to have the right effect. Btw I could not find the list of allowed strings one can use after mode:, so I tried BDSmakefile and some other variations as well.
Thanks.
See this question: Setting auto-mode-alist in emacs, and use the pair ("Makefile\\.include\\'" . makefile-mode).
So, way back in January, I went here:
http://emacsformacosx.com/
I downloaded Emacs and have been using it on my Mac and I like it. I've started trying to get into Elisp programming. To learn more, I'd like to look up some functions. So for instance I do:
C-h f
and then type "scroll-down"
This gives me the following text:
>scroll-down is an interactive built-in function in `window.c'.
>
>It is bound to <kp-prior>, <prior>, C-1, C-x C-1, M-v.
>
>(scroll-down &optional ARG)
>
>Scroll text of selected window down ARG lines.
>If ARG is omitted or nil, scroll down by a near full screen.
>A near full screen is `next-screen-context-lines' less than a full screen.
>Negative ARG means scroll upward.
>If ARG is the atom `-', scroll upward by nearly full screen.
>When calling from a program, supply as argument a number, nil, or `-'.
And the text "window.c" is a link. So I click on the link and I get:
find-function-C-source: The C source file window.c is not available
I'm getting this error a lot while doing a lot of different things. Where do I find the right path, and how do I tell Emacs what that path is?
I did just recently install some ELPA packages, so maybe one of them is causing some chaos?
The variable source-directory will point to the location where the C sources are. If you have a separately downloaded copy, you'll have to point this variable to that directory.
Most packagers don't include the sources, or split them off into a separate package. Install the sources (and maybe tweak an init script to tell Emacs where you put them, if it's not the default location. The pertinent variable is find-function-C-source-directory).
If you didn't manually build Emacs from the source code and patch the C source code, value of source-directory or find-function-C-source-directory would be wrong.
You can manually download Emacs source code, unpack it somewhere and set above two variables accordingly like following
(setq source-directory "/path/to/your-emacs-repo")
;; OR
(setq find-function-C-source-directory "/path/to/your-emacs-repo/src")
GNU Emacs source code and development is hosted on savannah.gnu.org. You can find all the tags here and download the one that matches your M-x emacs-version.
I would like to add a hook, so that each time I open a new file, projectile is enabled. However, I don't know where to add it so that emacs will read it. Any hints?
This must surely be in Prelude's documentation? If not, I suggest you write to the author to suggest that it be added.
I note the following in its init.el file:
(defvar prelude-personal-dir (concat prelude-dir "personal/")
"Users of Emacs Prelude are encouraged to keep their personal configuration
changes in this directory. All Emacs Lisp files there are loaded automatically
by Prelude.")
Therefore you should create a personal sub-directory if it doesn't already exist, and create any *.el filename you like in that directory, for your own customisations.
5here is a command named org-preview-latex-fragment in org-mode. its default binding key is C-c C-x C-l. In the org manual, it says this command could preview a latex fragment inline. but after using it, nothing is produced but blank frames (I can't upload images, sorry).
What happened? I'm using emacs23.1 on Ubuntu10.10, the org-mode version is 6.21b, and I've installed dvipng version 1.13-1.
I tried trace the code, but got lost. How can I fix this?
The easiest way to debug is to try to compile the temporary file created to create the fragment. It is usually located in /tmp and contains orgtex in the filename. You can find the exact name in Emacs's *Messages* buffer.
I resolve the problem by changing the program to convert latex fragment from dvipng to imagemagik.
I guess something is missing on my computer.
\M-x customize-variable RET org-latex-create-formula-image-program \RET
Update:
you can event increase the preview size by doing
\M-x customize-variable RET Org Format Latex Options RET
Update 2
I had some problem with imagemagick Have a look at the and switch back to dvipng after following the instruction in the doc. So both work correclty.
I want to open a file that is somewhere deep in my project tree. I know the name of the file, however I don't want to go searching the tree for it. I would like a way to enter just the file name, and have emacs search for me. I should also be able to enter the base directory I want to start the search from, and emacs should remember that for future searches.
Sounds like you are looking for the equivalent of Textmate's Command-T functionality. The closest I have found for emacs is find-file-in-project. It can be bound to C-t or a similar key for convenience: (global-set-key "\C-t" 'ido-find-file-in-tag-files)
M-x find-name-dired is the built-in solution for this. The default directory changes according to the current buffer, but the minibuffer history contains the previous selections.
I happen to like the ifind.el package which can be downloaded from the emacswiki here.
In Icicles you can find files by matching not just the relative file name but any parts of the path. You can use substring, regexp, and fuzzy matching. You can AND together multiple search patterns (progressive completion). See multi-command icicle-locate-file.
http://www.emacswiki.org/emacs/Icicles_-_File-Name_Input