emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCHv2] Docstring updates around `delete[-forward|-backward]-char'.


From: Michal Nazarewicz
Subject: [PATCHv2] Docstring updates around `delete[-forward|-backward]-char'.
Date: Sat, 08 Feb 2014 00:40:39 +0100
User-agent: Notmuch/0.17+15~gb65ca8e (http://notmuchmail.org) Emacs/24.3.50.1 (x86_64-unknown-linux-gnu)

* cmds.c (delete-char): Update docstring pointing out that the
function ignores `delete-active-region' and `overwrite-mode'.

* binding.el: Add comment describing why C-d binds to `delete-char'.

* simple.el (delete-backward-char): Point to `delete-char' in docstring.
(delete-forward-char): Mark as interactive-only and point to
`delete-char' in docstring.
---
 Slightly updated patch.  Feel free to ignore as I'm less convinced this
 change is actually useful than yesterday. ;)

 lisp/ChangeLog   | 8 ++++++++
 lisp/bindings.el | 3 +++
 lisp/simple.el   | 9 +++++++--
 src/ChangeLog    | 5 +++++
 src/cmds.c       | 4 +++-
 5 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ae9b774..989768d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2014-02-06  Michal Nazarewicz  <address@hidden>
+
+       * binding.el: Add comment describing why C-d binds to `delete-char'.
+       * simple.el (delete-backward-char): Point to `delete-char' in
+       docstring.
+       (delete-forward-char): Mark as interactive-only and point to
+       `delete-char' in docstring.
+
 2014-02-06  Michael Albinus  <address@hidden>
 
        * net/tramp-sh.el (tramp-sh-handle-start-file-process): Use "&&"
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 7106c73..64751da 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -873,6 +873,9 @@ if `inhibit-field-text-motion' is non-nil."
 
 ;; Update tutorial--default-keys if you change these.
 (define-key global-map "\177" 'delete-backward-char)
+;; We explicitly want C-d to use `delete-char' instead of
+;; `delete-forward-char' so that it ignores `delete-active-region'.
+;; See commit message for revision 102001 of the repository.
 (define-key global-map "\C-d" 'delete-char)
 
 (define-key global-map "\C-k" 'kill-line)
diff --git a/lisp/simple.el b/lisp/simple.el
index 2e924c8..bf940d2 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -958,7 +958,9 @@ arg, and KILLFLAG is set if N is explicitly specified.
 
 In Overwrite mode, single character backward deletion may replace
 tabs with spaces so as to back over columns, unless point is at
-the end of the line."
+the end of the line.
+
+`delete-char' is recommended instead of this function in Emacs Lisp code."
   (interactive "p\nP")
   (unless (integerp n)
     (signal 'wrong-type-argument (list 'integerp n)))
@@ -991,7 +993,9 @@ To disable this, set variable `delete-active-region' to nil.
 
 Optional second arg KILLFLAG non-nil means to kill (save in kill
 ring) instead of delete.  Interactively, N is the prefix arg, and
-KILLFLAG is set if N was explicitly specified."
+KILLFLAG is set if N was explicitly specified.
+
+`delete-char' is recommended instead of this function in Emacs Lisp code."
   (interactive "p\nP")
   (unless (integerp n)
     (signal 'wrong-type-argument (list 'integerp n)))
@@ -1005,6 +1009,7 @@ KILLFLAG is set if N was explicitly specified."
 
        ;; Otherwise, do simple deletion.
        (t (delete-char n killflag))))
+(put 'delete-forward-char 'interactive-only 'delete-char)
 
 (defun mark-whole-buffer ()
   "Put point at beginning and mark at end of buffer.
diff --git a/src/ChangeLog b/src/ChangeLog
index 140d501..9853fc6 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2014-02-06  Michal Nazarewicz  <address@hidden>
+
+       * cmds.c (delete-char): Update docstring pointing out that the
+       function ignores `delete-active-region' and `overwrite-mode'.
+
 2014-02-06  Jan Djärv  <address@hidden>
 
        * nsterm.m (toggleFullScreen:): Hide menubar on secondary monitor
diff --git a/src/cmds.c b/src/cmds.c
index 8d61c19..59cc7f8 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -229,7 +229,9 @@ Optional second arg KILLFLAG non-nil means kill instead 
(save in kill ring).
 Interactively, N is the prefix arg, and KILLFLAG is set if
 N was explicitly specified.
 
-The command `delete-forward-char' is preferable for interactive use.  */)
+The command `delete-forward-char' is preferable for interactive use since
+unlike `delete-forward-char' and `delete-backward-char', `delete-char' does
+not respect values of `delete-active-region' and `overwrite-mode'.  */)
   (Lisp_Object n, Lisp_Object killflag)
 {
   EMACS_INT pos;
-- 
1.8.5.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]