Search Results

Search found 103 results on 5 pages for 'elisp'.

Page 3/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • Import CSV into Org-mode properties

    - by lecodesportif
    I would like to import a CSV into Org-mode. Others have already asked about importing CSV to Org-mode tables. That's not what I am trying to do. I need to import CSV to Org-mode properties. For example, a CSV like this: Name,Tel,Mobile,Fax John,11111,22222,33333 should become: :PROPERTIES: :Name: John :Tel: 11111 :Mobile: 22222 :Fax: 33333 :END: Do you happen to know a painless way to do it?

    Read the article

  • Executes a function until it returns a nil, collecting its values into a list

    - by Baldur
    I got this idea from XKCD's Hofstadter comic; what's the best way to create a conditional loop in (any) Lisp dialect that executes a function until it returns NIL at which time it collects the returned values into a list. For those who haven't seen the joke, it's goes that Douglas Hofstadter's “eight-word” autobiography consists of only six words: “I'm So Meta, Even This Acronym” containing continuation of the joke: (some odd meta-paraprosdokian?) “Is Meta” — the joke being that the autobiography is actually “I'm So Meta, Even This Acronym Is Meta”. But why not go deeper? Assume the acronymizing function META that creates an acronym from a string and splits it into words, returns NIL if the string contains but one word: (meta "I'm So Meta, Even This Acronym") ? "Is Meta" (meta (meta "I'm So Meta, Even This Acronym")) ? "Im" (meta (meta (meta "I'm So Meta, Even This Acronym"))) ? NIL (meta "GNU is Not UNIX") ? "GNU" (meta (meta "GNU is Not UNIX")) ? NIL Now I'm looking for how to implement a function so that: (so-function #'meta "I'm So Meta, Even This Acronym") ? ("I'm So Meta, Even This Acronym" "Is Meta" "Im") (so-function #'meta "GNU is Not Unix") ? ("GNU is Not Unix" "GNU") What's the best way of doing this?

    Read the article

  • Emacs key binding fallback

    - by rejeep
    Hey, I have a minor mode. If that mode is active and the user hits DEL, I want to do some action, but only if some condition holds. If the condition holds and the action is executed I want to do nothing more after that. But if the condition fails, I don't want to do anything and let the default DEL action execute. Not sure how I could solve this. But I guess I could do it in two ways: 1) I could rebind the DEL key to a function in the minor mode and then check if the conditions holds ot not. But then how do I know what the default command to DEL is? 2) I could add a pre command hook like this. Execute the command and then break the chain. But how do I break the chain? (add-hook 'pre-command-hook (lambda() (when (equal last-input-event 'backspace) ;; Do something and then stop (do not execute the ;; command that backspace is bound to) ))) In what way would you solve it? Thanks!

    Read the article

  • Emacs Lisp: How to use ad-get-arg and ad-get-args?

    - by RamyenHead
    I'm not sure I am using ad-get-args and ad-get-arg right. For example, the following code doesn't work. (defun my-add (a b) (+ a b)) (defadvice my-add (after my-log-on activate) (message "my-add: %s" (ad-get-args))) (my-add 1 2) The last expression causes an error: Debugger entered--Lisp error: (void-function ad-get-args). The following doesn't work either. (defun my-substract (a b) (- a b)) (defadvice my-substract (around my-log-on activate) (message "my-substract: %s" (ad-get-arg 0)) (ad-do-it)) (my-substract 10 1) The defadvice gives a warning: Warning: `(setq ad-return-value (ad-Orig-my-substract a b))' is a malformed function And the last expression gives an error: Debugger entered--Lisp error: (invalid-function (setq ad-return-value (ad-Orig-my-substract a b))) (setq ad-return-value (ad-Orig-my-substract a b))() I was trying to use defadvice to watch start-process arguments for debugging purposes and I found my way of using ad-get-arg didn't work.

    Read the article

  • How to set a key binding to make Emacs as transparent/opaque as I want?

    - by Vivi
    I want to have a command in Emacs to make it as opaque/transparent as I want (refer to the fabulous question that pointed out that transparency is possible in Emacs, and the EmacsWiki page linked there which has the code I am using below). The EmacsWiki code sets "C-c t" to toggle the previously set transparency on and off: ;;(set-frame-parameter (selected-frame) 'alpha '(<active> [<inactive>])) (set-frame-parameter (selected-frame) 'alpha '(85 50)) (add-to-list 'default-frame-alist '(alpha 85 50)) enter code here(eval-when-compile (require 'cl)) (defun toggle-transparency () (interactive) (if (/= (cadr (find 'alpha (frame-parameters nil) :key #'car)) 100) (set-frame-parameter nil 'alpha '(100 100)) (set-frame-parameter nil 'alpha '(85 60)))) (global-set-key (kbd "C-c t") 'toggle-transparency) What I would like to do is to be able to choose the % transparency when I am in Emacs. If possible, I would like a command where I type for example "C-c t N" (where N is the % opaqueness) for the active frame, and then "M-c t N" for the inactive window. If that can't be done like that, then maybe a command where if I type "C-c t" it asks me for the number which gives the opaqueness of the active window (and the same for the inactive window using "M-c t"). Thanks in advance for your time :) Below are just some comments that are not important to answer the question if you are not interested: I really want this because when I told my supervisor I was learning Emacs he said TexShop is much better and that I am using software from the 80's. I told him about the wonders of Emacs and he said TexShop has all of it and more. I matched everything he showed me except for the transparency (though he couldn't match the preview inside Emacs from preview-latex). I found the transparency thing by chance, and now I want to show him Emacs rules! I imagine this will be a piece of cake for some of you, and even though I could get it done if I spent enough time trying to learn lisp or reading around, I am not a programmer and I have only been using Emacs and a mac for a week. I am lost already as it is! So thanks in advance for your time and help - I will learn lisp eventually!

    Read the article

  • How do I execute a shell-command in background?

    - by Adobe
    Here's a simple defun to run a shell script: (defun bk-konsoles () "Calls: bk-konsoles.bash" (interactive) (shell-command (concat (expand-file-name "~/its/plts/goodies/bk-konsoles.bash ") (if (buffer-file-name) (file-name-directory (buffer-file-name))) " &") nil nil)) If I start a program with no ampersand - it start the script, but blocks emacs until I close the program, if I don't put ampersand it gives error: /home/boris/its/plts/goodies/bk-konsoles.bash /home/boris/scl/geekgeek/: exited abnormally with code 1. Edit: So now I'm using: (defun bk-konsoles () "Calls: bk-konsoles.bash" (interactive) (shell-command (concat (expand-file-name "~/its/plts/goodies/bk-konsoles.bash ") (if (buffer-file-name) (file-name-directory (buffer-file-name))) " & disown") nil nil) (kill-buffer "*Shell Command Output*")) Edit 2: Nope - doesn't work: (defun bk-konsoles () "Calls: bk-konsoles.bash" (interactive) (let ((curDir default-directory)) ;; (shell-command (concat "nohup " (expand-file-name "~/its/plts/goodies/bk-konsoles.bash ") curDir) nil nil) (shell-command (concat (expand-file-name "~/its/plts/goodies/bk-konsoles.bash ") curDir "& disown") nil nil) (kill-buffer "*Shell Command Output*"))) keeps emacs busy - either with disown, or nohup. Here's a script I'm running if it might be of help: bk-konsoles.bash

    Read the article

  • How to make Emacs sql-mode recognize MySQL #-style comments?

    - by Ken
    I'm reading a bunch of MySQL files that use # (to end-of-line) comments, but my sql-mode doesn't support them. I found the syntax-table part of sql.el that defines /**/ and -- comments, but according to this, Emacs syntax tables support only 2 comment styles. Is there a way to add support for # comments in sql.el easily?

    Read the article

  • Clean way to perform commands in the Emacs minibuffer

    - by Christopher Monsanto
    Consider the following example: I want to read a file using ido from the minibuffer, but merge in all of the directories I use often. I can't just execute (ido-find-file) (ido-merge-work-directories) Because the second sexp will only execute after the user is finished selecting the file. The question then is: what is the best/cleanest way to execute commands in the minibuffer's command loop? The only way I know to do this is to bind my desired command to a key sequence, and add that sequence to unread-command-events so the key runs once we enter the minibuffer command loop: (setq unread-command-events (append (listify-key-sequence (kbd "M-s")) unread-command-events)) ; std key-binding for ido-merge-work-directories (ido-find-file) But that is very hacky, and I would like to know if there is a better solution. Thanks!

    Read the article

  • Help writing emacs lisp for emacs etags search

    - by user535707
    I'm looking for some help developing what I think should be an easy program. I want something similar to Emacs tags-search command, but I want to collect all search results into a buffer. (I want to see all results of M-,) I'm thinking this python style pseudo code should work, but I have no idea how to do this in emacs lisp? Any help would be greatly appreciated. def myTagsGrep(searchValue): for aFile in the tag list: result = grep aFile seachValue if len(result) > 0: print aFile # to the buffer print result # to the buffer I would like to be able to browse through the buffer with the same features tags-apropos does. Note that a similar question has been asked before: Is there a way to get emacs tag-search command to output all results to a buffer?

    Read the article

  • How can I generate sql inserts from pipe delimited data?

    - by user568866
    Given a set of delimited data in the following format: 1|Star Wars: Episode IV - A New Hope|1977|Action,Sci-Fi|George Lucas 2|Titanic|1997|Drama,History,Romance|James Cameron How can I generate sql insert statements in this format? insert into table values(1,"Star Wars: Episode IV - A New Hope",1977","Action,Sci-Fi","George Lucas",0); insert into table values(2,"Titanic",1997,"Drama,History,Romance","James Cameron",0); To simplify the problem, let's allow for a parameter to tell which columns are text or numeric. (e.g. 0,1,0,1,1)

    Read the article

  • Hide the Emacs echo area when not in use

    - by Baldur
    The echo area is the line at the bottom of Emacs below the mode line: ~ ~ | | +-----------------------+ |-U:--- mode-line | +-----------------------+ | M-x echo-area | +-----------------------+ Now the mode line is highly customizable while the echo area is more rigid (and unused a lot of the time). The question is pretty simple: is it possible to hide the echo area during inactivity and redisplay it once it needs your attention: ~ ~ ~ ~ | | | | | | +-----------------------+ | | |-U:--- mode-line | +-----------------------+ +-----------------------+ |-U:--- mode-line | | M-x echo-area | +-----------------------+ +-----------------------+ Inactive Active This is similar to the way Google Chrome displays URLs when you hover your mose over a link and the Firefox addon Pentadactyl where the command-line is hidden by default.

    Read the article

  • Creating a new buffer with text using EmacsClient

    - by User1
    I have a program that can send text to any other program for further analysis (eg sed, grep, etc). I would like it to send the data to Emacs and do analysis there. How would I do that? EmacsClient takes a filename by default, this is a data string not a file and I really don't want to create and delete files just to send data to Emacs. EmacsClient has an "eval" command-line option that let's you execute lisp code instead of open files. Is there a simple lisp function that will open a new buffer with the given text?

    Read the article

  • Hidden features of Emacs Lisp?

    - by anon
    What are some features of Emacs Lisp that you use to solve real problems? One feature per answer Give an example and short description of the feature, not just a link to documentation Label the feature using bold title as the first line See also: Hidden features of Python Hidden features of Ruby Hidden features of Perl Hidden features of Java

    Read the article

  • Compiling Wanderlust for Windows and use it for Gmail.

    - by User1
    I'm trying to get Wanderlust working in Windows to connect to Gmail. Compiling the code is much more painful than expected. Here are the barriers so far: Can't download dependent packages: SEMI, APEL, and FLIM. I eventually found newer versions, but I'm not sure they will work. Anyone have the older versions? Needs make and install. I used MSYS and it seems to have compiled okay. SSL support. I was getting a "Cannot open load file: ssl" error. I found an ssl.el that comes with w3. So installed w3. Bash command in ssl.el: ssl-get-command is running something from /bin/sh (not a directory I have in Windows). I really don't want to refactor this code. Is there a better way? Others speak very highly of Wanderlust, so I want to give it a try. I feel like I'm almost there, but am pretty much worn out with all the crazy configuration I have to do. Does anyone have this working on Windows? I'm pretty sure it will work with Gmail, because of this post. But will it work in Windows too? If you have a few pointers, please help.

    Read the article

  • problem in `delete-directory` with enabled `delete-by-removing-to-trash`

    - by Andreo
    There is a strange behavior of delete-directory function with enabled flag delete-by-removing-to-trash. It deletes files one by one instead of applying move-file-to-trash to the directory. As a result emacs deletes big directories slowly and there are many files in the trash after deleting, so it is impossible to restore the directory. Example: Directory structure: ddd/ ccc/ 1.txt There are three files in the trash after deleting ddd: trash/ ddd/ ccc/ 1.txt instead of one: trash/ ddd/ It is very slow, because emacs traverse directory recursively. I can't restore deleted directory. What i need is exactly the same behavior as of move-file-to-trash. But it should be transparent (i.e. 'D x' in dired mode). How to solve the problem? As a temporary solution i see the making advice function for `delete-directory'.

    Read the article

  • How do I bind a key to "the function represented by the following key sequence"?

    - by katrielalex
    I'm just starting to learn emacs (woohoo!) and I've been mucking around in my .emacs quite happily. Unfortunately, I don't know Lisp yet, so I'm having issues with the basics. I've already remapped a few keys until I fix my muscle memory: (global-set-key (kbd "<f9>") 'recompile) That's fine. But how can I tell a key to 'simulate pressing several keys'? For instance, I don't know, make <f1> do the same as C-u 2 C-x } (widen buffer by two chars). One way is to look up that C-x } calls shrink-window-horizontally, and do some sort of lambda thing. This is of course the neat and elegant way (how do you do this?). But surely there's a way to define <f1> to send the keystrokes C-u 2 C-x }?

    Read the article

  • Finding greatest product of two lists, but keep getting #unspecific

    - by user1787030
    (define (greatest-product lst1 lst2) (define (helper lst addtimes total toacc) (cond ((null? lst) '()) ((= (countatoms lst) 1) (display total)) ((= addtimes (cadr lst)) (helper (cdr lst) 1 total total)) (else (helper lst (+ 1 addtimes) (+ toacc total) toacc)))) (cond ((> (helper lst1 0 0 (car lst1)) (helper lst2 0 0 (car lst2))) (helper lst1 0 0 (car lst1))) ((< (helper lst1 0 0 (car lst1)) (helper lst2 0 0 (car lst2))) (helper lst2 0 0 (car lst2))) ((= (helper lst1 0 0 (car lst1)) (helper lst2 0 0 (car lst2))) (display 'equal)))) Scheme keeps returning back that it cannot perform the procedure with #unspecific Im running it with (display (greatest-product '(1 2 3) '(4 5 6))) (display (greatest-product '(1 2 3) '(1 2 3))) (display (greatest-product '(1 2 3) '())) what is wrong with it? the problem seems to be occurring

    Read the article

  • How to define a function which repeats itself when passed an argument

    - by ~unutbu
    Is there an easy way to define a function which repeats itself when passed an argument? For example, I've defined the following function (defun swap-sign () (interactive) (search-forward-regexp "[+-]") (if (equal (match-string 0) "-") (replace-match "+") (replace-match "-")) ) I'd like C-u swap-sign to call swap-sign four times. I've tried (defun swap-sign (&optional num) (interactive) (let ((counter 0) (num (if num (string-to-number num) 0))) (while (<= counter num) (search-forward-regexp "[+-]") (if (equal (match-string 0) "-") (replace-match "+") (replace-match "-")) (setq counter (1+ counter))))) but C-u swap-sign still only runs swap-sign (or perhaps more precisely, the body of the while-loop) once. I'm guessing it is because if num is not the right way to test if num is an empty string. Am I on the right track, or is there a better/easier way to extend swap-sign?

    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

  • Test for `point` within an attachment in `mail-mode`

    - by lawlist
    I'm looking for a better test to determine when point is within a hidden attachment in mail-mode (which is used by wl-draft-mode). The attachments are mostly hidden and look like this: --[[application/xls Content-Disposition: attachment; filename="hello-world.xls"][base64]] The test of invisible-p yields a result of nil. I am current using the following test, but it seems rather poor: (save-excursion (goto-char (point-max)) (goto-char (previous-char-property-change (point))) (goto-char (previous-char-property-change (point))) (re-search-backward "]]" (point-at-bol) t))) Any suggestions would be greatly appreciated. Here is the full snippet: (goto-char (point-max)) (cond ((= (save-excursion (abs (skip-chars-backward "\n\t"))) 0) (insert "\n\n")) ((and (= (save-excursion (abs (skip-chars-backward "\n\t"))) 1) (not (save-excursion (goto-char (previous-char-property-change (point))) (goto-char (previous-char-property-change (point))) (re-search-backward "]]" (point-at-bol) t)))) (insert "\n"))) GOAL:  If there are no attachments and no new lines at the end of the buffer, then insert \n\n and then insert the attachment thereafter. If there is just one new line at the end of the buffer, then insert \n and then insert the attachment thereafter. If there is an attachment at the end of the buffer, then do not insert any new lines.

    Read the article

  • How do I create an empty file in emacs?

    - by Singletoned
    How can I create an empty file from emacs, ideally from within a dired buffer? For example, I've just opened a Python module in dired mode, created a new directory, opened that in dired, and now need to add an empty __init__.py file in the directory. If I use C-x C-f __init__.py RET C-x C-s then emacs doesn't create the file because no changes have been made to it. I would have to type in the file, save it, delete my typing and then save it again for that to work. Thanks

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >