English 中文(简体)
emacs command to append to ring
原标题:

How can I make an emacs command to copy text (to the kill ring) by appending? (Why is there no such built-in command?)

Appending Kills mentions C-M-w (`append-next-kill ) which allows me to append with kill commands such as C-d or C-k. But it s for killing texts instead of copying them.

最佳回答

Actually, there is such a built in command. C-M-w will append a subsequent copy as well as a kill. So you would mark the region you desire to copy, then type C-M-w followed by M-w and the next C-y will yank the joined kills.

问题回答

Play with a variation of this in your .emacs file...

(defun append-kill-line (&optional arg)
  "Append kill-line to current kill buffer, prefix arg kills from beginning of line."
  (interactive "P")
  (append-next-kill)
  (kill-line arg)
)

(define-key global-map "C-xC-m"  append-kill-line)

Can append-to-register meet your needs?

The various kill commands use a little trick to decide whether or not to append. If the previous command is the same as the current command, it will append; if not, it doesn t. The functions use the value of last-command to do this, and manipulating this value is key to getting what you want.

(defun copy-region-as-kill-append (beg end)
  (interactive "r")
  (let ((last-command  kill-region))
    (copy-region-as-kill beg end)))




相关问题
Duplicate a table row with UITableViewCellEditingStyleInsert?

I have an application based on the Core Data Books example, and I m coming to the conclusion that I need to give the user the ability to duplicate a row in the table - a set of data - and then let ...

Copy/Paste in Windows Forms with custom controls

I am writing a small application in C# using Windows Forms. I want to let my users copy and paste data around the application and there are some custom controls, for example one is a colour picker. ...

Copying only non-existent files in ant

I m deploying my project to a web-server to be deployed with java Web Start. However, Web Start uses modification date to figure out whether to download the resources again (by default). What I want ...

Copying one FlowDocument to Second FlowDocument

How can i copy the contents of one FlowDocument to another FlowDocument below is what i tryed foreach (var blk in fd1.Blocks) { fd2.Blocks.Add(blk); } fd1 is FlowDocument1 and fd2 is ...

emacs command to append to ring

How can I make an emacs command to copy text (to the kill ring) by appending? (Why is there no such built-in command?) Appending Kills mentions C-M-w (`append-next-kill ) which allows me to append ...

about get value from sqlite

Code Sample: NSString *str= [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectStatement, 1)]; Test *t=[[Test alloc] init]; t.str=[str copy]; // why use "copy" here? [str release];

Insert into an STL queue using std::copy

I d like to use std::copy to insert elements into a queue like this: vector<int> v; v.push_back( 1 ); v.push_back( 2 ); queue<int> q; copy( v.begin(), v.end(), insert_iterator< queue&...

热门标签