Search Results

Search found 1353 results on 55 pages for 'emacs lisp'.

Page 3/55 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Lisp Style question label local functions or not?

    - by Andrew Myers
    I was wondering if there is a standard practice regarding the use of labels in Lisp. I've been messing around with a Lisp implementation of the algorithm described in the first answer here http://stackoverflow.com/questions/352203/generating-permutations-lazily My current version uses labels to break out portions of functionality. (defun next-permutation (pmute) (declare (vector pmute)) (let ((len (length pmute))) (if (> len 2) (labels ((get-pivot () (do ((pivot (1- len) (1- pivot))) ((or (= pivot 0) (< (aref pmute (1- pivot)) (aref pmute pivot))) pivot))) (get-swap (pivot) (let ((swp (1- len))) (loop for i from (1- len) downto pivot do (if (or (and (> (aref pmute i) (aref pmute (1- pivot))) (< (aref pmute i) (aref pmute swp))) (< (aref pmute swp) (aref pmute (1- pivot)))) (setf swp i))) swp)) (next (swp pivot) (rotatef (aref pmute (1- pivot)) (aref pmute swp)) (reverse-vector pmute pivot (1- len)))) (let ((piv (get-pivot))) (if (> piv 0) (next (get-swap piv) piv) nil)))))) Since each label is only called once I was wondering if this is considered bad practice since the only reason to do it in this case is for aesthetic reasons. I would argue that the current version with labels is clearer but that may go against common wisdom that I'm not aware of, being new to Lisp.

    Read the article

  • After the upgrading to 13.10, I can't input Japanese and Chinese in Emacs

    - by oda
    I have just upgraded Ubuntu from 13.04 to 13.10. It seems iBus have been made big changes.Then I just go to system setting - text entry settings - add "Chinese pinyin" and "Japanese anty" input method. It works well when I input Chinese or Japanese in terminal or .txt file. But when I want to input Chinese and Japanese in Emacs. Even though I have enable ibus-mode in the buffer and change to Chinese pinyin or Japanese anty input method. It just output the English word. Below is the ibus configure in .emacs.By the way, It works well before I upgrade Ubuntu to 13.10 and Emacs to 24.3.1. (add-to-list 'load-path (concat my-emacs-path "/ibus-el-0.3.2")) ;;(setq ibus-python-shell-command-name "python2.7") (require 'ibus) ;; Turn on ibus-mode automatically after loading .emacs (add-hook 'after-init-hook 'ibus-mode-on) (setq ibus-cursor-color '("red" "blue" "limegreen"))

    Read the article

  • Emacs editor copy and deletion

    - by Null pointer
    I am a huge fan of emacs.. But even after 1 year of practising on emacs I am unable to solve these three annoying issues about emacs please help me! 1.Whenever I want to copy the content from emacs into other things such as a website textarea I have to use GUI copy button because ctrl+w doesn't work. Is there any way to do this from emacs-command line. 2.Whenever I delete something using ctrl+shft+SPC or ctrl+k etc I don't want it to be stored in kill ring how do I do it(I know ctrl+D does this but it deletes only one char at a time)? 3.Whenever I select text by mouse and press backspace then text goes into kill ring(Which I want to change as mentioned) but same doesn't happen when I select text with ctrl+SPC(set mark) and then ctrl+f/ctrl+b etc. Please help me! Thanks in Advanced!

    Read the article

  • How do I set up a .emacs initialization file? [migrated]

    - by Harry Weston
    I am using Linux Fedora 13 (Constantine) and emacs 23.1.1. I am trying to set up a .emacs file for initialization, by using emacs itself to edit and save a file .emacs in my home directory. However, although the file is there, emacs does not seem to recognize it. What might I be doing wrong, and is there a simple text for .emacs that will show me if it is being used, one that will display a message on emacs start up?

    Read the article

  • Is there a way to make changes to toggles in my .emacs file apply without re-starting Emacs?

    - by Vivi
    I want to be able to make the changes to my .emacs file without having to reload Emacs. I found three questions which sort of answer what I am asking (you can find them here, here and here), but the problem is that the change I have just made is to a toggle, and as the comments to two of the answers (a1, a2) to those questions explain, the solutions given there (such as M-x reload-file or M-x eval-buffer) don't apply to toggles. I imagine there is a way of toggling the variable again with a command, but if there is a way to reload the whole .emacs and have the all the toggles re-evaluated without having to specify them, I would prefer. In any case, I would also appreciate if someone told me how to toggle the value of a variable so that if I just changed one toggle I can do it with a command rather than re-start Emacs just for that (I am new to Emacs). I don't know how useful this information is, but the change I applied was the following (which I got from this answer to another question): (setq skeleton-pair t) (setq skeleton-pair-on-word t) (global-set-key (kbd "[") 'skeleton-pair-insert-maybe) (global-set-key (kbd "(") 'skeleton-pair-insert-maybe) (global-set-key (kbd "{") 'skeleton-pair-insert-maybe) (global-set-key (kbd "<") 'skeleton-pair-insert-maybe) Edit: I included the above in .emacs and reloaded Emacs, so that the changes took effect. Then I commented all of it out and tried M-x load-file. This doesn't work. The suggestion below (C-x C-e by PP works if I am using it to evaluate the toggle first time, but not when I want to undo it). I would like something that would evaluate the commenting out, if such thing exists... Thanks :)

    Read the article

  • LISP: Keyword parameters, supplied-p

    - by echox
    At the moment I'm working through "Practical Common Lisp" from Peter Seibel. In the chapter "Practical: A Simple Database" (http://www.gigamonkeys.com/book/practical-a-simple-database.html) Seibel explains keyword parameters and the usage of a supplied-parameter with the following example: (defun foo (&key a (b 20) (c 30 c-p)) (list a b c c-p)) Results: (foo :a 1 :b 2 :c 3) ==> (1 2 3 T) (foo :c 3 :b 2 :a 1) ==> (1 2 3 T) (foo :a 1 :c 3) ==> (1 20 3 T) (foo) ==> (NIL 20 30 NIL) So if I use &key at the beginning of my parameter list, I have the possibility to use a list of 3 parameters name, default value and the third if the parameter as been supplied or not. Ok. But looking at the code in the above example: (list a b c c-p) How does the lisp interpreter know that c-p is my "supplied parameter"?

    Read the article

  • Emacs: ac-slime for auto complete

    - by Boris
    I am trying to add auto complete for *.lisp files. My slime setting is: (add-to-list 'load-path "~/.emacs.d/plugins/slime/") (setq slime-lisp-implementations '((sbcl ("/opt/sbcl/bin/sbcl" "--core" "/opt/sbcl/lib/sbcl/sbcl.core") :coding-system utf-8-unix :env ("SBCL_HOME=/opt/sbcl/lib/sbcl")) (ccl ("/opt/ccl/lx86cl64") :coding-system utf-8-unix))) (require 'slime-autoloads) (slime-setup '(slime-fancy)) And ac-slime setting is: (require 'ac-slime) (add-hook 'slime-mode-hook 'set-up-slime-ac) (add-hook 'slime-repl-mode-hook 'set-up-slime-ac) (eval-after-load "auto-complete" '(add-to-list 'ac-modes 'slime-repl-mode)) Each time I type a word in *.lisp file, auto complete popups some candidates but after a second minibuffer outputs error in process filter: Reply to canceled synchronous eval request tag=slime-result-6-19579 sexp=(swank:simple-completions "de" (quote "COMMON-LISP-USER")) and the popup stuck for a while. After that I can continue my selection. My question is how to remove this error and stuck? Any help is appreciated.

    Read the article

  • Help using Lisp debugger

    - by Joel
    I'm trying understand how to interpret the output of, and use, the Lisp debugger. I've got a pretty simple Backtrace for the evaluation of my function, but I cann't seem to work out how to use it to find out in which Lisp 'form' in my function the exception occurred. I'd appreciate any clues as to what I should be doing, to find the source of the error. I've attached a screen shot (if it's too small to read I can re-post it in parts), with the debug output, the function and the repl (please ignore my very wrong function, I'm just interested in learning how to use the debugger properly). In addition, I hit 'v' on the first frame to go to the source, but this resulted in the error at the bottom of the screen.

    Read the article

  • Setting tab size in Emacs

    - by Ryan
    I'm using Emacs as an editor. I want to set the tab size to four spaces. In my .emacs file I have the following: (setq default-tab-width 4) I've also tried: (set-default tab-width 4) Either way, when I open emacs and try to tab, it inserts two spaces. Am I doing something wrong? It almost seems like its not seeing my .emacs file. Any suggestions would be great! Thanks!

    Read the article

  • Git can no longer open emacs as its editor

    - by mwilliams
    I'm running Git version 1.7.3.2 that I built from source, zsh is my shell, and emacs is my editor. Recently I started seeing the following: /usr/local/Cellar/git/1.7.3.2/libexec/git-core/git-sh-setup: line 106: emacs: command not found Could not execute editor My zshrc looks like the following so I can use the Cocoa build and the console binary provided with it. EMACS_HOME="/Applications/Emacs.app/Contents/MacOS" function e() { PATH=$EMACS_HOME/bin:$PATH $EMACS_HOME/Emacs -nw $@ } function ec() { PATH=$EMACS_HOME/bin:$PATH emacsclient -t $@ } function es() { e --daemon=$1 && ec -s $1 } function el() { ps ax|grep Emacs } function ek() { $EMACS_HOME/bin/emacsclient -e '(kill-emacs)' -s $1 } function ecompile() { e -eval "(setq load-path (cons (expand-file-name \".\") load-path))" \ -batch -f batch-byte-compile $@ } alias emacs=e alias emacsclient=ec And I also have export EDITOR="emacs" and have tried adding export GIT_EDITOR="emacs" (and swapping that out with "e") But whatever I try I can't get git to open emacs whenever I need to do a commit or an interactive rebase, etc etc...

    Read the article

  • portable emacs? (emacs server not working)

    - by polyglot
    I have seen a few suggestions on making emacs portable (on Windows). I have this in my site-start.el: (defvar program-dir (substring data-directory 0 -4)) (setq inhibit-startup-message t) (setenv "HOME" program-dir) I changed the HOME variable so that not only my .emacs init files (and other init files) are read, but everything generated by emacs will stay in the program directory, not needing me to specify the path for everything one by one. Well this works well but the emacs server is not working; I get error message "no connection could be made because target machine actively refused it." If I don't change my HOME var then emacs server works. Is there way to fix this?

    Read the article

  • dates and times in emacs lisp

    - by Stephen
    Hi, I understand emacs lisp is great for handling dates and times, but does it have a function to convert strings to internal representation of integers using formats like %Y, %m, %d, %H, %M, %S, and so on? And also, in the emacs reference manual, it says that times are lists of two or three integers, but is there a more formal specification or description? ~ Thanks ~

    Read the article

  • Error while installing emacs23 from Software Center

    - by vrcmr
    Trying to install emacs in Software Center Ubuntu 12.04 got this error. installArchives() failed: Selecting previously unselected package emacs23. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 182385 files and directories currently installed.) Unpacking emacs23 (from .../emacs23_23.3+1-1ubuntu9_i386.deb) ... Processing triggers for desktop-file-utils ... Processing triggers for bamfdaemon ... Rebuilding /usr/share/applications/bamf.index... Processing triggers for gnome-menus ... Processing triggers for man-db ... Setting up emacs23 (23.3+1-1ubuntu9) ... update-alternatives: using /usr/bin/emacs23-x to provide /usr/bin/emacs (emacs) in auto mode. emacs-install emacs23 install/dictionaries-common: Byte-compiling for emacsen flavour emacs23 Warning: Lisp directory `/usr/share/emacs/23.3/site-lisp' does not exist. Warning: Lisp directory `/usr/share/emacs/site-lisp' does not exist. Warning: Lisp directory `/usr/share/emacs/23.3/leim' does not exist. Warning: Lisp directory `/usr/share/emacs/23.3/lisp' does not exist. Warning: Lisp directory `/usr/share/emacs/23.3/leim' does not exist. Error: charsets directory (/usr/share/emacs/23.3/etc/charsets) does not exist. Emacs will not function correctly without the character map files. Please check your installation! Warning: Could not find simple.el nor simple.elc Cannot open load file: bytecomp emacs-install: /usr/lib/emacsen-common/packages/install/dictionaries-common emacs23 failed at /usr/lib/emacsen-common/emacs-install line 28, <TSORT> line 3. dpkg: error processing emacs23 (--configure): subprocess installed post-installation script returned error exit status 255 No apport report written because MaxReports is reached already Errors were encountered while processing: emacs23 Error in function: Setting up emacs23 (23.3+1-1ubuntu9) ... emacs-install emacs23 install/dictionaries-common: Byte-compiling for emacsen flavour emacs23 Warning: Lisp directory `/usr/share/emacs/23.3/site-lisp' does not exist. Warning: Lisp directory `/usr/share/emacs/site-lisp' does not exist. Warning: Lisp directory `/usr/share/emacs/23.3/leim' does not exist. Warning: Lisp directory `/usr/share/emacs/23.3/lisp' does not exist. Warning: Lisp directory `/usr/share/emacs/23.3/leim' does not exist. Error: charsets directory (/usr/share/emacs/23.3/etc/charsets) does not exist. Emacs will not function correctly without the character map files. Please check your installation! Warning: Could not find simple.el nor simple.elc Cannot open load file: bytecomp emacs-install: /usr/lib/emacsen-common/packages/install/dictionaries-common emacs23 failed at /usr/lib/emacsen-common/emacs-install line 28, <TSORT> line 3. dpkg: error processing emacs23 (--configure): subprocess installed post-installation script returned error exit status 255

    Read the article

  • Is there any limit to recursion in lisp?

    - by Isaiah
    I enjoy using recursion whenever I can, it seems like a much more natural way to loop over something then actual loops. I was wondering if there is any limit to recursion in lisp? Like there is in python where it freaks out after like 1000 loops? Could you use it for say, a game loop? Testing it out now, simple counting recursive function. Now at 7000000! Thanks alot

    Read the article

  • extract/slice/reorder lists in (emacs) lisp?

    - by Stephen
    In python, you might do something like i = (0, 3, 2) x = [x+1 for x in range(0,5)] operator.itemgetter(*i)(x) to get (1, 4, 3). In (emacs) lisp, I wrote this function called extract which does something similar, (defun extract (elems seq) (mapcar (lambda (x) (nth x seq)) elems)) (extract '(0 3 2) (number-sequence 1 5)) but I feel like there should be something built in? All I know is first, last, rest, nth, car, cdr... What's the way to go? ~ Thanks in advance ~

    Read the article

  • Emacs 23.2 opens a new window for each compile error/warning navigated to

    - by Grant Limberg
    I've recently upgraded from Carbon Emacs (v22.3) to vanilla Emacs 23.2 (from http://www.emacsformacosx.com). On Carbon Emacs when compiling a project, The frame is split in two with the current source file/SConscript in the top window, and the compile output in the bottom window. I'd hit C-x ` to navigate to the first warning or error in the compile output and it would replace whatever was in the top window with the source file the error or warning is in. In Emacs 23.2, however, a 3rd window is opened causing two windows open in the top half of the frame (split vertically) and the compile output in the window of the bottom half of the frame. How do I tell Emacs to not open a new window and instead open the code in the the existing non-compiler output window in the frame? A little further clarification on the behavior that I just noticed. If I hit C-x ` while the buffer containing the source file or SConscript file is active, no new window is opened. It's only if I'm manually navigating through the *compilation* buffer and hitting enter on an error or warning, or mouse clicking on a warning when a third buffer window appears.

    Read the article

  • Add Keyboard Binding To Existing Emacs Mode

    - by Sean M
    I'm attempting my first modification of emacs. I recorded a little keyboard macro and had emacs spit it out as elisp, resulting in: (setq add-docstring "\C-rdef\C-n\C-a\C-m\C-p\C-i\C-u6\"\C-u3\C-b") (global-set-key "\C-c\C-d" 'add-docstring) Searching the emacs reference, though, revealed that C-c C-d is already bound in diff mode. I don't plan on using diff mode, but the future is unknowable and I'd like to not lay a trap for myself. So I'd like this keybinding to only operate in python mode, where it tries to help me add docstrings. In my /usr/share/emacs/23.whatever/list/progmodes, I found python.elc and python.el.gz. I unzipped python.el.gz and got a readable version of the elisp file. Now, though, the documentation becomes opaque to me. How can I add my key binding to the python mode, instead of globally? Is it possible, for bonus points, to apply the changes to python mode without restarting emacs or closing open files? It's the self-modifying editor, I figure there's a good chance that it's possible.

    Read the article

  • Emacs: adding 1 to every number made of 2 digits inside a marked region

    - by WizardOfOdds
    Imagine I've got the following in a text file opened under Emacs: some 34 word 30 another 38 thing 59 to 39 say 10 here 47 and I want to turn into this, adding 1 to every number made of 2 digits: some 35 word 31 another 39 thing 60 to 40 say 11 here 48 (this is a short example, my actual need is on a much bigger list, not my call) How can I do this from Emacs? I don't mind calling some external Perl/sed/whatever magic as long as the call is made directly from Emacs and operates only on the marked region I want. How would you automate this from Emacs? I think the answer I'm thinking of consist in calling shell-command-on-region and replace the region by the output... But I'm not sure as to how to concretely do this.

    Read the article

  • How useful are Lisp macros?

    - by compman
    Common Lisp allows you to write macros that do whatever source transformation you want. Scheme gives you a hygienic pattern-matching system that lets you perform transformations as well. How useful are macros in practice? Paul Graham said in Beating the Averages that: The source code of the Viaweb editor was probably about 20-25% macros. What sorts of things do people actually end up doing with macros?

    Read the article

  • emacs keybindings in ubuntu 12.04

    - by sam
    I am trying to get emacs-like keybindings in gtk, firefox, chrome, etc. I have followed the directions recommended here (and in lots of places) but to no effect: http://kb.mozillazine.org/Emacs_Keybindings_(Firefox) In other words, I added 'gtk-key-theme-name = "Emacs"' to my .gtkrc-2.0, and I also ran gconf-editor and set "/desktop/gnome/interface/gtk_key_theme" to "Emacs". I even rebooted just for good measure. I am using an ordinary Ubuntu 12.04 install, with unity3d as the desktop environment. Thanks! Sam

    Read the article

  • emacs keybindings

    - by Max
    I read a lot about vim and emacs and how they make you much more productive, but I didn't know which one to pick. Finally when I decided to teach myself common lisp, the decision was straight forward: everybody says that there's no better editor for common lisp, than emacs + slime. So I started with emacs tutorial and immediately I ran into something that seems very unproductive to me. I'm talking about key bindings for cursor keys: forward/backward: Ctrl+f, Ctrl+b up/down: Ctrl+p, Ctrl+n I find these bindings very strange. I assume that fingers should be on their home rows (am I wrong here?), so to move cursor forward or backward I should use my left index finger and for up and down right pinky and right index fingers. When working with any of Windows IDEs and text editors to navigate text I usually place my right hand in a position so that my thumb is on the right ctrl and my index, ring and middle fingers are on the cursor keys. From this position it is very easy and comfortable to move cursor: I can do one-character moves with my 3 right fingers, or I can press ctrl with my right thumb and do word-moves instead. Also I can press shift with my left pinky and do single-character or word selections. Also it is a very comfortable position to reach PgUp, PgDn, Home, End, Delete and Backspace keys with my right hand. So I have even more navigation and selection possibilities. I understand that the decision not to use cursor keys is to allow one to use emacs to connect to remote terminal sessions, where these keys are not supported, but I still find the choice of cursor keys very unfortunate. Why not to use j, k, i, l instead? This way I could use my right hand without much finger stretching. So how is emacs more productive? What am I doing wrong?

    Read the article

  • Install GNU Emacs GUI in Fedora

    - by FLW
    I've installed the "emacs" package from yum, but typing emacs at the terminal doesn't launch the GUI version. I was under the impression it installed by default, and emacs -nw would be used for the terminal version. Is there a GUI package available for Fedora 14 (GNOME)? I couldn't find "emacs-gtk" or "emacs-gnome" or any X packages with yum search emacs-. Edit: To clarify, this is about GNU Emacs and not XEmacs.

    Read the article

  • Emacs 22 (GTK) cannot be installed on your computer type (i386)

    - by Aravind
    when i was trying to install emacs on Linux Ubuntu .I used to search emacs in add/Remove search toolbar it shows Emacs 22 ..i have double clicked that emacs it shows the following error. Emacs 22 (GTK) Canonical Ltd. provides technical support and security updates for Emacs 22 (GTK) Emacs 22 (GTK) cannot be installed on your computer type (i386). Either the application requires special hardware features or the vendor decided to not support your computer type.

    Read the article

  • How can I spot subtle Lisp syntax mistakes?

    - by Marius Andersen
    I'm a newbie playing around with Lisp (actually, Emacs Lisp). It's a lot of fun, except when I seem to run into the same syntax mistakes again and again. For instance, here's something I've encountered several times. I have some cond form, like (cond ((foo bar) (qux quux)) ((or corge (grault warg)) (fred) (t xyzzy))) and the default clause, which returns xyzzy, is never carried out, because it's actually nested inside the previous clause: (cond ((foo bar) (qux quux)) ((or corge (grault warg)) (fred)) (t xyzzy)) It's difficult for me to see such errors when the difference in indentation is only one space. Does this get easier with time? I also have problems when there's a large distance between the (mal-)indented line and the line it should be indented against. let forms with a lot of complex bindings, for example, or an unless form with a long conditional: (defun test () (unless (foo bar (qux quux) (or corge (grault warg) (fred)))) xyzzy) It turns out xyzzy was never inside the unless form at all: (defun test () (unless (foo bar (qux quux) (or corge (grault warg) (fred))) xyzzy)) I auto-indent habitually and use parenthesis highlighting to avoid counting parentheses. For the most part it works like a breeze, but occasionally, I discover my syntax mistakes only by debugging. What can I do?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >