However, when selecting multiple lines and copying, only one is copied. (message "%d line%s copied" arg (if (= 1 arg) "" "s")))įrom the message, it appears that you can have multiple lines copied. (kill-ring-save (line-beginning-position) "Copy lines (as many as prefix argument) in the kill ring" Description of problem: emacs-24.4 adds extra spaces/formatting when copy/pasting text with leading spaces Version-Release number of selected component (if. My second question: using the standard copy-line found in the link above: (defun copy-line (arg) My first question: How can I put (message "1 line copied") into my global-set-key above? This however, throws a wrong number of arguments error. So I conveyed each keystroke into a function and did this: (defun copy-line () Basically, I am unable to run a raw sequence as above in a function. I am trying to insert that message into my global-set-key above but it is not working. Now, I saw: and it appears that their copy-line function prints a message with the number of lines it copied. I decided to change it to: (global-set-key (kbd "C-x c") "\M-m\C- \C-e\M-w") This is a little annoying since it copies any new line after the line. I always used to have: (global-set-key (kbd "C-x c") "\C-a\C- \C-n\M-w") I am trying to write a function that copies a line. It is surprising that Emacs does not have this by default somewhere. The usual way to move or copy text is to kill it and then yank it. If I'm doing something wrong here, please let me know. Yanking means reinserting text previously killed. This is of course not the Emacs kill ring but at least I found them very useful as a "next best" thing.For some reason, copying lines in Emacs is very unintuitive and difficult. Then, do a similar for append-to-file, insert-file, etc., and then setup shortcuts and/or (Emacs) aliases for fast access. You should see the selected text highlighted. Then, navigate the cursor to the end of the text you want to select. First, put the cursor (or point) at the start of the text you want to select, then press C-SPC. (write-region (region-beginning) (region-end) "~/.fclipboard.txt") ) In Emacs, you can use the keyboard to select the text, then copy or cut it. "Write the region to `~/.fclipboard.txt'" As we have seen, the issue with the Copy Current Filename In Emacs variable was resolved by making use of a variety of distinct instances. The simplest way to do this is just to put your point on the stuff and GNU Emacs will take over all the others. So I decided to leverage GNU Emacs to do it for me. Because selecting what you want accurately is the most time-consuming. It’s pretty boring to copy and paste so much stuff all the time. Now, to get Emacs-Emacs communication (and I agree several instances is not optimal), if they share access to a file, how about using it by setting up functions like: (defun write-to-file-clipboard () So I used to copy and paste stuff between them. (shell-command "/home/user_name/scripts/pst" '(1)) `M-1' (the '(1)) to insert in the current buffer." "Inserts the X clipboard (xclip -d ':0' -o -selection clipboard)Īt point. #!/bin/zshĬLIP=`xclip -d ":0" -o -selection clipboard`Įcho "(set-variable '*clip-len* $CLIP_LEN)" > ~/.clip_len I also put the xo part into a script (called pst), so as to paste from X to Emacs. Xo: aliased to xclip -d ":0" -selection clipboard -o It is not true that you can't access the X clipboard in the Linux VT/tty/console.Ĭheck out those aliases, as they are shown when I use where in zsh: xi: aliased to xclip -d ":0" -selection clipboard But there are some other things I know of that might help you. To get access to the actual Emacs kill ring, I don't know, but if you find out, please tell us, and I'd be very appreciative.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |