aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Schroeder2006-01-07 02:29:14 +0000
committerAlex Schroeder2006-01-07 02:29:14 +0000
commit53f831f3cbcbb79825348e231c306ab8e6d418ad (patch)
treee69560c62ecdb59b23d9e6c38214443b7bcba7b3
parent53dab082e3b103317f2a34b4f0533b0c3038782c (diff)
downloademacs-53f831f3cbcbb79825348e231c306ab8e6d418ad.tar.gz
emacs-53f831f3cbcbb79825348e231c306ab8e6d418ad.zip
(rcirc-send-input): No longer check whether the
process is open, since not all commands need an open process. (rcirc-send-string): Check whether the process is open before sending anything.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/net/rcirc.el112
2 files changed, 63 insertions, 56 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 298899e3365..f6e01b030a1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12006-01-07 Alex Schroeder <alex@gnu.org>
2
3 * net/rcirc.el (rcirc-send-input): No longer check whether the
4 process is open, since not all commands need an open process.
5 (rcirc-send-string): Check whether the process is open before
6 sending anything.
7
12006-01-06 David Reitter <david.reitter@gmail.com> 82006-01-06 David Reitter <david.reitter@gmail.com>
2 9
3 * mail/emacsbug.el (report-emacs-bug): Let explanations correctly 10 * mail/emacsbug.el (report-emacs-bug): Let explanations correctly
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 93476a0997e..ed507860dc7 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -434,6 +434,9 @@ Function is called with PROCESS COMMAND SENDER ARGS and LINE.")
434 (let ((string (concat (encode-coding-string string 434 (let ((string (concat (encode-coding-string string
435 buffer-file-coding-system) 435 buffer-file-coding-system)
436 "\n"))) 436 "\n")))
437 (unless (eq (process-status rcirc-process) 'open)
438 (error "Network connection to %s is not open"
439 (process-name rcirc-process)))
437 (rcirc-debug process string) 440 (rcirc-debug process string)
438 (process-send-string process string))) 441 (process-send-string process string)))
439 442
@@ -734,62 +737,59 @@ Create the buffer if it doesn't exist."
734(defun rcirc-send-input () 737(defun rcirc-send-input ()
735 "Send input to target associated with the current buffer." 738 "Send input to target associated with the current buffer."
736 (interactive) 739 (interactive)
737 (if (not (eq (process-status rcirc-process) 'open)) 740 (if (< (point) rcirc-prompt-end-marker)
738 (error "Network connection to %s is not open" 741 ;; copy the line down to the input area
739 (process-name rcirc-process)) 742 (progn
740 (if (< (point) rcirc-prompt-end-marker) 743 (forward-line 0)
741 ;; copy the line down to the input area 744 (let ((start (if (eq (point) (point-min))
742 (progn 745 (point)
743 (forward-line 0) 746 (if (get-text-property (1- (point)) 'hard)
744 (let ((start (if (eq (point) (point-min)) 747 (point)
745 (point) 748 (previous-single-property-change (point) 'hard))))
746 (if (get-text-property (1- (point)) 'hard) 749 (end (next-single-property-change (1+ (point)) 'hard)))
747 (point) 750 (goto-char (point-max))
748 (previous-single-property-change (point) 'hard)))) 751 (insert (replace-regexp-in-string
749 (end (next-single-property-change (1+ (point)) 'hard))) 752 "\n\\s-+" " "
750 (goto-char (point-max)) 753 (buffer-substring-no-properties start end)))))
751 (insert (replace-regexp-in-string 754 ;; process input
752 "\n\\s-+" " " 755 (goto-char (point-max))
753 (buffer-substring-no-properties start end))))) 756 (let ((target (rcirc-buffer-target))
754 ;; process input 757 (start rcirc-prompt-end-marker))
755 (goto-char (point-max)) 758 (when (not (equal 0 (- (point) start)))
756 (let ((target (rcirc-buffer-target)) 759 ;; delete a trailing newline
757 (start rcirc-prompt-end-marker)) 760 (when (eq (point) (point-at-bol))
758 (when (not (equal 0 (- (point) start))) 761 (delete-backward-char 1))
759 ;; delete a trailing newline 762 (let ((input (buffer-substring-no-properties
760 (when (eq (point) (point-at-bol)) 763 rcirc-prompt-end-marker (point))))
761 (delete-backward-char 1)) 764 ;; process a /cmd
762 (let ((input (buffer-substring-no-properties 765 (if (string-match "^/\\([^ ]+\\) ?\\(.*\\)$" input)
763 rcirc-prompt-end-marker (point)))) 766 (let* ((command (match-string 1 input))
764 ;; process a /cmd 767 (fun (intern-soft (concat "rcirc-cmd-" command)))
765 (if (string-match "^/\\([^ ]+\\) ?\\(.*\\)$" input) 768 (args (match-string 2 input)))
766 (let* ((command (match-string 1 input)) 769 (newline)
767 (fun (intern-soft (concat "rcirc-cmd-" command))) 770 (with-current-buffer (current-buffer)
768 (args (match-string 2 input))) 771 (delete-region rcirc-prompt-end-marker (point))
769 (newline) 772 (if (string= command "me")
770 (with-current-buffer (current-buffer) 773 (rcirc-print rcirc-process (rcirc-nick rcirc-process)
771 (delete-region rcirc-prompt-end-marker (point)) 774 "ACTION" (current-buffer) args)
772 (if (string= command "me") 775 (rcirc-print rcirc-process (rcirc-nick rcirc-process)
773 (rcirc-print rcirc-process (rcirc-nick rcirc-process) 776 "COMMAND" (current-buffer) input))
774 "ACTION" (current-buffer) args) 777 (set-marker rcirc-prompt-end-marker (point))
775 (rcirc-print rcirc-process (rcirc-nick rcirc-process) 778 (if (fboundp fun)
776 "COMMAND" (current-buffer) input)) 779 (funcall fun args rcirc-process target)
777 (set-marker rcirc-prompt-end-marker (point)) 780 (rcirc-send-string rcirc-process
778 (if (fboundp fun) 781 (concat command " " args)))))
779 (funcall fun args rcirc-process target) 782 ;; send message to server
780 (rcirc-send-string rcirc-process 783 (if (not rcirc-target)
781 (concat command " " args))))) 784 (message "Not joined")
782 ;; send message to server 785 (delete-region rcirc-prompt-end-marker (point))
783 (if (not rcirc-target) 786 (mapc (lambda (message)
784 (message "Not joined") 787 (rcirc-send-message rcirc-process target message))
785 (delete-region rcirc-prompt-end-marker (point)) 788 (split-string input "\n"))))
786 (mapc (lambda (message) 789 ;; add to input-ring
787 (rcirc-send-message rcirc-process target message)) 790 (save-excursion
788 (split-string input "\n")))) 791 (ring-insert rcirc-input-ring input)
789 ;; add to input-ring 792 (setq rcirc-input-ring-index 0)))))))
790 (save-excursion
791 (ring-insert rcirc-input-ring input)
792 (setq rcirc-input-ring-index 0))))))))
793 793
794(defvar rcirc-parent-buffer nil) 794(defvar rcirc-parent-buffer nil)
795(defvar rcirc-window-configuration nil) 795(defvar rcirc-window-configuration nil)