elisp

How to automatically do org-mobile-push org-mobile pull in emacs

点点圈 提交于 2019-12-02 19:21:07
Since I am using org-mode to track my todo list in emacs, I like the iPhone app: MobileOrg, with it, I can access my todo list all day. But here's the problem: I have to manually org-mobile-push my changes from local file to mobile phone through dropbox, and org-mobile-pull the changes made by phone back. How to make that automatically? Like adding some recipes in dotemacs file. Chris Zheng Add these two lines to dot emacs file: (add-hook 'after-init-hook 'org-mobile-pull) (add-hook 'kill-emacs-hook 'org-mobile-push) With them, it automatically pulls the changes on emacs startup, and pushes

Writing “Hello World” in Emacs?

拜拜、爱过 提交于 2019-12-02 19:16:43
I would like to write a few Unix scripts in Emacs Lisp. However, there doesn't seem to be a clean way to write to STDOUT so I can redirect the results to a file or pipe the output to another command. The print function places double quotes around the output strings so I get "Hello world!" instead of Hello world! . Here's the emacs script. #!/usr/bin/emacs --script ;; ;; Run me from a Unix shell: ./hello.el > x.txt ;; (message "Hello world! I'm writing to STDERR.") (print "Hello world! I'm writing to STDOUT but I'm in quotes") (insert "Hello world! I'm writing to an Emacs buffer") (write-file

What are the major differences between Emacs Lisp and Common Lisp? [closed]

岁酱吖の 提交于 2019-12-02 19:01:55
I want to learn the lisp language, since my editor is emacs, I prefer emacs lisp. Can anyone give me some suggestions to learn lisp, emacs lisp, or common lisp? What are the major differences between those two? ataylor There's quite a bit of crossover, especially at the beginner level, so whichever you start with will mostly transfer to the other. Some of the major differences: elisp has traditionally used dynamic scoping rules; Common Lisp uses lexical scoping rules. With dynamic scoping, a function can access local variables declared in calling functions and has generally fallen out of favor

What is the purpose of off-loading definitions with autoload in emacs? Why not autoloading is slow?

喜欢而已 提交于 2019-12-02 18:26:29
问题 In ELisp, you can skip the evaluation of a definition with the autoload cookie. The definition is evaluated only once it's used. ;; File foo.el ;;;###autoload (defun foo () "Doc" 42) (defun bar () "Doc" 43) So, if I understand correctly the autoload functionnality is a hack to load file faster. But when I load foo.el , in order to skip the definition of foo the interpreter still has to read the whole form. I don't understand why it's faster. 回答1: The simplest way to load the content of the

How to convert list to string in Emacs Lisp

情到浓时终转凉″ 提交于 2019-12-02 18:02:38
How can I convert a list to string so I can call insert or message with it? I need to display c-offsets-alist but I got Wrong type argument: char-or-string-p for insert or Wrong type argument: stringp for message. I am not sure of what you are trying to achieve, but format converts "stuff" to strings. For instance: (format "%s" your-list) will return a representation of your list. message uses format internally, so (message "%s" your-list) will print it (format) will embed parentheses in the string, e.g.: ELISP> (format "%s" '("foo" "bar")) "(foo bar)" Thus if you need an analogue to Ruby

Setting byte-compile-dest-file-function

岁酱吖の 提交于 2019-12-02 17:26:40
问题 I want to set the destination directory for emacs lisp byte compilation using relative path such as ../foo . I figured out I should use byte-compile-dest-file-function , but do not know how to set it. How can I set it? 回答1: To set the byte-compile-dest-function variable, you can use either customize-variable interactively, or setq in your init file. Since you'll have to write a function doing the job either way, I would recommand the latter, so that everything is in the same place in your

let and flet in emacs lisp

∥☆過路亽.° 提交于 2019-12-02 17:17:15
I don't know if you would call it the canonical formulation, but to bind a local function I am advised by the GNU manual to use 'flet': (defun adder-with-flet (x) (flet ( (f (x) (+ x 3)) ) (f x)) ) However, by accident I tried (after having played in Scheme for a bit) the following expression, where I bind a lambda expression to a variable using 'let', and it also works if I pass the function to mapcar*: (defun adder-with-let (x) (let ( (f (lambda (x) (+ x 3))) ) (car (mapcar* f (list x)) )) ) And both functions work: (adder-with-flet 3) ==> 6 (adder-with-let 3) ==> 6 Why does the second one

Emacs mode for Go? [closed]

落花浮王杯 提交于 2019-12-02 16:55:43
Is there a suitable Emacs mode for Go? C mode doesn't work without semicolons. The best I have found is the JavaScript mode by Karl Landstrom , since JavaScript also doesn't require semicolons. Try misc/emacs/go-mode.el ( web link ) in the Go distribution. If you are using Emacs 24 and marmalade repo , use M-x package-install <RET> go-mode to install it directly. Spyplane If your Go installs to /usr/local/go then add the following to your .emacs file. ;; go mode (setq load-path (cons "/usr/local/go/misc/emacs" load-path)) (require 'go-mode-load) julienc Update from 2014 for Linux users You can

Render Markdown in Emacs buffer

谁都会走 提交于 2019-12-02 16:43:07
Is it possible to present Markdown rendered in an Emacs buffer using Emacs' own buffer text formatting capabilities? Emacs in graphical environments has rich text presentation capabilities (font styles, colors, links and even images) so it should be quite possible. Are there any existing implementations? Note that the idea is to have the rendered Markdown be native Emacs formatted text that can be navigated and operated on as any other text in Emacs. Therefore solutions that render to an image that is embedded in an Emacs buffer are not desirable here. Also note that this is not about a mode

How to determine operating system in elisp?

元气小坏坏 提交于 2019-12-02 16:03:15
How do I programmatically determine which OS Emacs is running under in ELisp? I would like to run different code in .emacs depending on the OS. The system-type variable: system-type is a variable defined in `C source code'. Its value is darwin Documentation: Value is symbol indicating type of operating system you are using. Special values: `gnu' compiled for a GNU Hurd system. `gnu/linux' compiled for a GNU/Linux system. `darwin' compiled for Darwin (GNU-Darwin, Mac OS X, ...). `ms-dos' compiled as an MS-DOS application. `windows-nt' compiled as a native W32 application. `cygwin' compiled