comparison lisp/simple.el @ 1740:6d74de06a35d

* simple.el (kill-region): Change interactive spec to signal an error if the buffer is read-only, and remove the code to do a copy-region-as-kill if the buffer is read-only. * simple.el (set-mark-command): Clarify doc string. * simple.el (prefix-arg-internal): Don't apply string-to-char to get the first element of the key sequence - it might be a vector.
author Jim Blandy <jimb@redhat.com>
date Thu, 07 Jan 1993 02:50:39 +0000
parents 9de0900ca56a
children 05492c456293
comparison
equal deleted inserted replaced
1739:d738d3690836 1740:6d74de06a35d
767 (describe-arg value sign) 767 (describe-arg value sign)
768 (setq key (read-key-sequence nil t)))) 768 (setq key (read-key-sequence nil t))))
769 (if (= (length key) 1) 769 (if (= (length key) 1)
770 ;; Make sure self-insert-command finds the proper character; 770 ;; Make sure self-insert-command finds the proper character;
771 ;; unread the character and let the command loop process it. 771 ;; unread the character and let the command loop process it.
772 (setq unread-command-event (string-to-char key)) 772 (setq unread-command-event (aref key 0))
773 ;; We can't push back a longer string, so we'll emulate the 773 ;; We can't push back a longer string, so we'll emulate the
774 ;; command loop ourselves. 774 ;; command loop ourselves.
775 (command-execute (key-binding key))))) 775 (command-execute (key-binding key)))))
776 776
777 (defun describe-arg (value sign) 777 (defun describe-arg (value sign)
948 to be killed. 948 to be killed.
949 Any command that calls this function is a \"kill command\". 949 Any command that calls this function is a \"kill command\".
950 If the previous command was also a kill command, 950 If the previous command was also a kill command,
951 the text killed this time appends to the text killed last time 951 the text killed this time appends to the text killed last time
952 to make one entry in the kill ring." 952 to make one entry in the kill ring."
953 (interactive "r") 953 (interactive "*r")
954 (cond 954 (cond
955 (buffer-read-only 955 ;; If the buffer was read-only, we used to just do a
956 (copy-region-as-kill beg end)) 956 ;; copy-region-as-kill. This was never what I wanted - usually I
957 ;; was making a mistake and trying to edit a file checked into RCS -
958 ;; so I've taken the code out.
957 ((not (or (eq buffer-undo-list t) 959 ((not (or (eq buffer-undo-list t)
958 (eq last-command 'kill-region) 960 (eq last-command 'kill-region)
959 (eq beg end))) 961 (eq beg end)))
960 ;; Don't let the undo list be truncated before we can even access it. 962 ;; Don't let the undo list be truncated before we can even access it.
961 (let ((undo-strong-limit (+ (- (max beg end) (min beg end)) 100))) 963 (let ((undo-strong-limit (+ (- (max beg end) (min beg end)) 100)))
1148 (defconst mark-ring-max 16 1150 (defconst mark-ring-max 16
1149 "*Maximum size of mark ring. Start discarding off end if gets this big.") 1151 "*Maximum size of mark ring. Start discarding off end if gets this big.")
1150 1152
1151 (defun set-mark-command (arg) 1153 (defun set-mark-command (arg)
1152 "Set mark at where point is, or jump to mark. 1154 "Set mark at where point is, or jump to mark.
1153 With no prefix argument, set mark, and push previous mark on mark ring. 1155 With no prefix argument, set mark, and push old mark position on mark ring.
1154 With argument, jump to mark, and pop into mark off the mark ring. 1156 With argument, jump to mark, and pop a new position for mark off the ring.
1155 1157
1156 Novice Emacs Lisp programmers often try to use the mark for the wrong 1158 Novice Emacs Lisp programmers often try to use the mark for the wrong
1157 purposes. See the documentation of `set-mark' for more information." 1159 purposes. See the documentation of `set-mark' for more information."
1158 (interactive "P") 1160 (interactive "P")
1159 (if (null arg) 1161 (if (null arg)