erc-commit
[Top][All Lists]
Advanced

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

[Erc-commit] [commit][master] Fix buggy interaction between move-to-prom


From: mwolson
Subject: [Erc-commit] [commit][master] Fix buggy interaction between move-to-prompt and delete-selection-mode.
Date: Sun, 20 Jan 2008 19:30:05 -0500

commit 774e9a55e452c2686d6fd2b537a692afd51b4313
Author: Michael W. Olson <address@hidden>
Date:   Sun Jan 20 19:22:28 2008 -0500

    Fix buggy interaction between move-to-prompt and delete-selection-mode.

diff --git a/ChangeLog b/ChangeLog
index 8e6d89d..9b0132e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-01-21  Michael Olson  <address@hidden>
+
+       * erc-goodies.el (move-to-prompt): Use the "XEmacs" method
+       instead, because the [remap ...] method interferes with
+       delete-selection-mode.
+       (erc-move-to-prompt): Rename from erc-move-to-prompt-xemacs.  Call
+       push-mark before moving point.  Thanks to bojohan for the
+       suggestion.
+       (erc-move-to-prompt-setup): Rename from
+       erc-move-to-prompt-init-xemacs.
+
 2008-01-20  Michael Olson  <address@hidden>
 
        * erc-goodies.el (erc-move-to-prompt, erc-move-to-prompt-xemacs):
diff --git a/erc-goodies.el b/erc-goodies.el
index acf08cc..2649dda 100644
--- a/erc-goodies.el
+++ b/erc-goodies.el
@@ -133,39 +133,25 @@ does not appear in the ERC buffer after the user presses 
ENTER.")
 ;;; Move to prompt when typing text
 (define-erc-module move-to-prompt nil
   "This mode causes the point to be moved to the prompt when typing text."
-  ((if (featurep 'xemacs)
-       (progn
-         (add-hook 'erc-mode-hook 'erc-move-to-prompt-init-xemacs)
-         (dolist (buffer (erc-buffer-list))
-           (with-current-buffer buffer
-             (erc-move-to-prompt-init-xemacs))))
-     (define-key erc-mode-map [remap self-insert-command]
-       'erc-move-to-prompt)))
-  ((if (featurep 'xemacs)
-       (progn
-         (remove-hook 'erc-mode-hook 'erc-move-to-prompt-init-xemacs)
-         (dolist (buffer (erc-buffer-list))
-           (with-current-buffer buffer
-             (remove-hook 'pre-command-hook 'erc-move-to-prompt-xemacs t))))
-     (define-key erc-mode-map [remap self-insert-command]
-       'self-insert-command))))
+  ((add-hook 'erc-mode-hook 'erc-move-to-prompt-setup)
+   (dolist (buffer (erc-buffer-list))
+     (with-current-buffer buffer
+       (erc-move-to-prompt-setup))))
+  ((remove-hook 'erc-mode-hook 'erc-move-to-prompt-setup)
+   (dolist (buffer (erc-buffer-list))
+     (with-current-buffer buffer
+       (remove-hook 'pre-command-hook 'erc-move-to-prompt t)))))
 
 (defun erc-move-to-prompt ()
-  "Move the point to the ERC prompt."
-  (interactive)
-  (when (and erc-input-marker (< (point) erc-input-marker))
-    (goto-char (point-max)))
-  (call-interactively 'self-insert-command))
-
-(defun erc-move-to-prompt-xemacs ()
   "Move the point to the ERC prompt if this is a self-inserting command."
   (when (and erc-input-marker (< (point) erc-input-marker)
              (eq 'self-insert-command this-command))
+    (push-mark)
     (goto-char (point-max))))
 
-(defun erc-move-to-prompt-init-xemacs ()
+(defun erc-move-to-prompt-setup ()
   "Initialize the move-to-prompt module for XEmacs."
-  (add-hook 'pre-command-hook 'erc-move-to-prompt-xemacs nil t))
+  (add-hook 'pre-command-hook 'erc-move-to-prompt nil t))
 
 (define-erc-module noncommands nil
   "This mode distinguishies non-commands.




reply via email to

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