diff options
| author | tslil clingman <> | 2020-10-26 21:00:40 -0400 |
|---|---|---|
| committer | tslil clingman <> | 2020-10-26 21:00:40 -0400 |
| commit | 7c1beacef1dbed322e99d633742da6b2f655c603 (patch) | |
| tree | 226a42f0a56d43c4ab588f8cbb72e01e241dd747 /zile-kill-region-or-backward-kill-word.patch | |
| parent | 85f38e4e6315d16c3880ec694cf971e4f041c013 (diff) | |
Pruned old stuff, added zile patch
Diffstat (limited to 'zile-kill-region-or-backward-kill-word.patch')
| -rw-r--r-- | zile-kill-region-or-backward-kill-word.patch | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/zile-kill-region-or-backward-kill-word.patch b/zile-kill-region-or-backward-kill-word.patch new file mode 100644 index 0000000..fb6ddeb --- /dev/null +++ b/zile-kill-region-or-backward-kill-word.patch @@ -0,0 +1,85 @@ +diff --git a/src/buffer.c b/src/buffer.c +index bbb487c6..9656418c 100644 +--- a/src/buffer.c ++++ b/src/buffer.c +@@ -436,6 +436,16 @@ warn_if_readonly_buffer (void) + return false; + } + ++bool ++check_if_no_mark (void) { ++ if ((!cur_bp->mark) || ++ (!get_buffer_mark_active (cur_bp))) ++ { ++ return true; ++ } ++ return false; ++} ++ + bool + warn_if_no_mark (void) + { +diff --git a/src/extern.h b/src/extern.h +index 277e1619..2b04edc3 100644 +--- a/src/extern.h ++++ b/src/extern.h +@@ -74,6 +74,7 @@ _GL_ATTRIBUTE_PURE const char *get_buffer_filename_or_name (Buffer bp); + void set_buffer_names (Buffer bp, const char *filename); + _GL_ATTRIBUTE_PURE Buffer find_buffer (const char *name); + void switch_to_buffer (Buffer bp); ++bool check_if_no_mark (void); + bool warn_if_no_mark (void); + bool warn_if_readonly_buffer (void); + #define FIELD(ty, field) \ +diff --git a/src/killring.c b/src/killring.c +index 750acb1d..50753ac7 100644 +--- a/src/killring.c ++++ b/src/killring.c +@@ -211,6 +211,34 @@ kill_text (long uniarg, Function mark_func) + return true; + } + ++DEFUN_ARGS ("kill-region-or-backward-kill-word", ++ kill_region_or_backward_kill_word, ++ INT_OR_UNIARG (arg)) ++/*+ ++Kill (\"cut\") text between point and mark, if they are both ++active, otherwise performs \\[backward-kill-word]. This deletes the ++text from the buffer and saves it in the kill ring. The command ++\\[yank] can retrieve it from there. ++ ++Any command that calls this function is a \"kill command\". If the ++previous command was also a kill command, the text killed this time ++appends to the text killed last time to make one entry in the kill ++ring. ++ ++If the buffer is read-only, Zile will beep and refrain from deleting ++the text, but put the text in the kill ring anyway. This means that ++you can use the killing commands to copy text from a read-only buffer. +++*/ ++{ ++ INT_OR_UNIARG_INIT (arg); ++ if (check_if_no_mark ()) { ++ ok = kill_text (-arg, F_mark_word); ++ } else { ++ ok = copy_or_kill_the_region(true); ++ } ++} ++END_DEFUN ++ + DEFUN_ARGS ("kill-word", kill_word, + INT_OR_UNIARG (arg)) + /*+ +diff --git a/src/tbl_bindings.pl b/src/tbl_bindings.pl +index 61240d15..797e3bfa 100644 +--- a/src/tbl_bindings.pl ++++ b/src/tbl_bindings.pl +@@ -70,7 +70,7 @@ + "keyboard-quit" => ["\\C-g"], + "kill-buffer" => ["\\C-xk"], + "kill-line" => ["\\C-k"], +- "kill-region" => ["\\C-w"], ++ "kill-region-or-backward-kill-word" => ["\\C-w"], + "kill-sexp" => ["\\C-\\M-k"], + "kill-word" => ["\\M-d"], + "list-buffers" => ["\\C-x\\C-b"], |
