aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-05-10 00:39:44 +0000
committerRichard M. Stallman1997-05-10 00:39:44 +0000
commit53efb70716887d9b1a2a2645d0d79823bbb58558 (patch)
tree3784faabc68676b667dc4529b3cbdaa5b5d10577
parentb392bac9b9f6ce3223845d738a556d755f4a2f24 (diff)
downloademacs-53efb70716887d9b1a2a2645d0d79823bbb58558.tar.gz
emacs-53efb70716887d9b1a2a2645d0d79823bbb58558.zip
(quoted-insert-character-offset): Initialize more cleanly.
(quoted-insert): Don't offset codes above 377.
-rw-r--r--lisp/simple.el75
1 files changed, 70 insertions, 5 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 178b020b40d..30ec4d558d1 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -156,8 +156,10 @@ With arg N, insert N newlines."
156 (indent-to col 0) 156 (indent-to col 0)
157 (goto-char pos))) 157 (goto-char pos)))
158 158
159(defvar quoted-insert-character-offset 2048 159(defcustom quoted-insert-character-offset (- (make-char 'latin-iso8859-1) 128)
160 "Offset added by \\[quoted-insert] to character codes 0200 and above.") 160 "*Offset added by \\[quoted-insert] to character codes 0200 and above."
161 :tag 'integer
162 :group 'i18n)
161 163
162(defun quoted-insert (arg) 164(defun quoted-insert (arg)
163 "Read next input character and insert it. 165 "Read next input character and insert it.
@@ -182,6 +184,7 @@ this function useful in editing binary files."
182 ;; to Emacs characters. 184 ;; to Emacs characters.
183 (and enable-multibyte-characters 185 (and enable-multibyte-characters
184 (>= char ?\200) 186 (>= char ?\200)
187 (<= char ?\377)
185 (setq char (+ quoted-insert-character-offset char))) 188 (setq char (+ quoted-insert-character-offset char)))
186 (if (> arg 0) 189 (if (> arg 0)
187 (if (eq overwrite-mode 'overwrite-mode-binary) 190 (if (eq overwrite-mode 'overwrite-mode-binary)
@@ -1152,13 +1155,74 @@ when given no argument at the beginning of a line."
1152 ;; the value of point from before the command was run. 1155 ;; the value of point from before the command was run.
1153 (progn 1156 (progn
1154 (if arg 1157 (if arg
1155 (forward-line (prefix-numeric-value arg)) 1158 (forward-visible-line (prefix-numeric-value arg))
1156 (if (eobp) 1159 (if (eobp)
1157 (signal 'end-of-buffer nil)) 1160 (signal 'end-of-buffer nil))
1158 (if (or (looking-at "[ \t]*$") (and kill-whole-line (bolp))) 1161 (if (or (looking-at "[ \t]*$") (and kill-whole-line (bolp)))
1159 (forward-line 1) 1162 (forward-visible-line 1)
1160 (end-of-line))) 1163 (end-of-visible-line)))
1161 (point)))) 1164 (point))))
1165
1166(defun forward-visible-line (arg)
1167 "Move forward by ARG lines, ignoring currently invisible newlines only."
1168 (condition-case nil
1169 (progn
1170 (while (> arg 0)
1171 (or (zerop (forward-line 1))
1172 (signal 'end-of-buffer nil))
1173 ;; If the following character is currently invisible,
1174 ;; skip all characters with that same `invisible' property value,
1175 ;; then find the next newline.
1176 (while (and (not (eobp))
1177 (let ((prop
1178 (get-char-property (point) 'invisible)))
1179 (if (eq buffer-invisibility-spec t)
1180 prop
1181 (or (memq prop buffer-invisibility-spec)
1182 (assq prop buffer-invisibility-spec)))))
1183 (if (get-text-property (point) 'invisible)
1184 (goto-char (next-single-property-change (point) 'invisible))
1185 (goto-char (next-overlay-change (point))))
1186 (or (zerop (forward-line 1))
1187 (signal 'end-of-buffer nil)))
1188 (setq arg (1- arg)))
1189 (while (< arg 0)
1190 (or (zerop (vertical-motion -1))
1191 (signal 'beginning-of-buffer nil))
1192 (while (and (not (bobp))
1193 (let ((prop
1194 (get-char-property (1- (point)) 'invisible)))
1195 (if (eq buffer-invisibility-spec t)
1196 prop
1197 (or (memq prop buffer-invisibility-spec)
1198 (assq prop buffer-invisibility-spec)))))
1199 (if (get-text-property (1- (point)) 'invisible)
1200 (goto-char (previous-single-property-change (point) 'invisible))
1201 (goto-char (previous-overlay-change (point))))
1202 (or (zerop (vertical-motion -1))
1203 (signal 'beginning-of-buffer nil)))
1204 (setq arg (1+ arg))))
1205 ((beginning-of-buffer end-of-buffer)
1206 nil)))
1207
1208(defun end-of-visible-line ()
1209 "Move to end of current visible line."
1210 (end-of-line)
1211 ;; If the following character is currently invisible,
1212 ;; skip all characters with that same `invisible' property value,
1213 ;; then find the next newline.
1214 (while (and (not (eobp))
1215 (let ((prop
1216 (get-char-property (point) 'invisible)))
1217 (if (eq buffer-invisibility-spec t)
1218 prop
1219 (or (memq prop buffer-invisibility-spec)
1220 (assq prop buffer-invisibility-spec)))))
1221 (if (get-text-property (point) 'invisible)
1222 (goto-char (next-single-property-change (point) 'invisible))
1223 (goto-char (next-overlay-change (point))))
1224 (forward-char 1)
1225 (end-of-line)))
1162 1226
1163;;;; Window system cut and paste hooks. 1227;;;; Window system cut and paste hooks.
1164 1228
@@ -3026,6 +3090,7 @@ The properties used on SYMBOL are `composefunc', `sendfunc',
3026 3090
3027(defun assoc-ignore-case (key alist) 3091(defun assoc-ignore-case (key alist)
3028 "Like `assoc', but assumes KEY is a string and ignores case when comparing." 3092 "Like `assoc', but assumes KEY is a string and ignores case when comparing."
3093 (setq key (downcase key))
3029 (let (element) 3094 (let (element)
3030 (while (and alist (not element)) 3095 (while (and alist (not element))
3031 (if (equal key (downcase (car (car alist)))) 3096 (if (equal key (downcase (car (car alist))))