;; Maintainer: FSF
;; Keywords: internal
+;; Package: emacs
;; This file is part of GNU Emacs.
(defmacro ignore-errors (&rest body)
"Execute BODY; if an error occurs, return nil.
Otherwise, return result of last form in BODY."
+ (declare (debug t) (indent 0))
`(condition-case nil (progn ,@body) (error nil)))
\f
;;;; Basic Lisp functions.
(make-obsolete 'process-filter-multibyte-p nil "23.1")
(make-obsolete 'set-process-filter-multibyte nil "23.1")
-(make-obsolete-variable 'directory-sep-char "do not use it." "21.1")
+(defconst directory-sep-char ?/
+ "Directory separator character for built-in functions that return file names.
+The value is always ?/.")
+(make-obsolete-variable 'directory-sep-char "do not use it, just use `/'." "21.1")
+
(make-obsolete-variable
'mode-line-inverse-video
"use the appropriate faces instead."
some sort of escape sequence, the ambiguity is resolved via `read-key-delay'."
(let ((overriding-terminal-local-map read-key-empty-map)
(overriding-local-map nil)
+ (echo-keystrokes 0)
(old-global-map (current-global-map))
(timer (run-with-idle-timer
;; Wait long enough that Emacs has the time to receive and
(throw 'read-key keys)))))))
(unwind-protect
(progn
- (use-global-map read-key-empty-map)
+ (use-global-map
+ (let ((map (make-sparse-keymap)))
+ ;; Don't hide the menu-bar and tool-bar entries.
+ (define-key map [menu-bar] (lookup-key global-map [menu-bar]))
+ (define-key map [tool-bar] (lookup-key global-map [tool-bar]))
+ map))
(aref (catch 'read-key (read-key-sequence-vector prompt nil t)) 0))
(cancel-timer timer)
(use-global-map old-global-map))))
(if inhibit-quit (setq quit-flag nil)))
;; Translate TAB key into control-I ASCII character, and so on.
;; Note: `read-char' does it using the `ascii-character' property.
- ;; We could try and use read-key-sequence instead, but then C-q ESC
- ;; or C-q C-x might not return immediately since ESC or C-x might be
- ;; bound to some prefix in function-key-map or key-translation-map.
- (setq translated
- (if (integerp char)
- (char-resolve-modifiers char)
- char))
+ ;; We should try and use read-key instead.
(let ((translation (lookup-key local-function-key-map (vector char))))
- (if (arrayp translation)
- (setq translated (aref translation 0))))
+ (setq translated (if (arrayp translation)
+ (aref translation 0)
+ char)))
+ (if (integerp translated)
+ (setq translated (char-resolve-modifiers translated)))
(cond ((null translated))
((not (integerp translated))
(setq unread-command-events (list char)
(recenter (/ (window-height) 2))))
(message (or message "Type %s to continue editing.")
(single-key-description exit-char))
- (let (char)
- (if (integerp exit-char)
- (condition-case nil
- (progn
- (setq char (read-char))
- (or (eq char exit-char)
- (setq unread-command-events (list char))))
- (error
- ;; `exit-char' is a character, hence it differs
- ;; from char, which is an event.
- (setq unread-command-events (list char))))
- ;; `exit-char' can be an event, or an event description list.
- (setq char (read-event))
- (or (eq char exit-char)
- (eq char (event-convert-list exit-char))
- (setq unread-command-events (list char))))))
+ (let ((event (read-event)))
+ ;; `exit-char' can be an event, or an event description list.
+ (or (eq event exit-char)
+ (eq event (event-convert-list exit-char))
+ (setq unread-command-events (list event)))))
(delete-overlay ol))))
\f
(defconst version-regexp-alist
- '(("^[-_+ ]?a\\(lpha\\)?$" . -3)
+ '(("^[-_+ ]?alpha$" . -3)
("^[-_+]$" . -3) ; treat "1.2.3-20050920" and "1.2-3" as alpha releases
("^[-_+ ]cvs$" . -3) ; treat "1.2.3-CVS" as alpha release
- ("^[-_+ ]?b\\(eta\\)?$" . -2)
- ("^[-_+ ]?\\(pre\\|rc\\)$" . -1))
+ ("^[-_+ ]?beta$" . -2)
+ ("^[-_+ ]?\\(pre\\|rcc\\)$" . -1))
"*Specify association between non-numeric version and its priority.
This association is used to handle version string like \"1.0pre2\",
(setq al version-regexp-alist)
(while (and al (not (string-match (caar al) s)))
(setq al (cdr al)))
- (or al (error "Invalid version syntax: '%s'" ver))
- (setq lst (cons (cdar al) lst)))))
+ (cond (al
+ (push (cdar al) lst))
+ ;; Convert 22.3a to 22.3.1.
+ ((string-match "^[-_+ ]?\\([a-zA-Z]\\)$" s)
+ (push (- (aref (downcase (match-string 1 s)) 0) ?a -1)
+ lst))
+ (t (error "Invalid version syntax: '%s'" ver))))))
(if (null lst)
(error "Invalid version syntax: '%s'" ver)
(nreverse lst)))))
(prin1-to-string (make-hash-table)))))
(provide 'hashtable-print-readable))
-;; Moving with arrows in bidi-sensitive direction.
-(defun right-arrow-command (&optional n)
- "Move point N characters to the right (to the left if N is negative).
-On reaching beginning or end of buffer, stop and signal error.
-
-Depending on the bidirectional context, this may move either forward
-or backward in the buffer. This is in contrast with \\[forward-char]
-and \\[backward-char], which see."
- (interactive "^p")
- (if (eq (current-bidi-paragraph-direction) 'left-to-right)
- (forward-char n)
- (backward-char n)))
-
-(defun left-arrow-command ( &optional n)
- "Move point N characters to the left (to the right if N is negative).
-On reaching beginning or end of buffer, stop and signal error.
-
-Depending on the bidirectional context, this may move either backward
-or forward in the buffer. This is in contrast with \\[backward-char]
-and \\[forward-char], which see."
- (interactive "^p")
- (if (eq (current-bidi-paragraph-direction) 'left-to-right)
- (backward-char n)
- (forward-char n)))
-
;; arch-tag: f7e0e6e5-70aa-4897-ae72-7a3511ec40bc
;;; subr.el ends here