Mercurial > emacs
comparison lisp/subr.el @ 90182:f042e7c0fe20
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-53
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 302-319)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 69)
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 20 May 2005 04:22:05 +0000 |
parents | 08185296b491 3f80c5cf6771 |
children | 5b029ff3b08d |
comparison
equal
deleted
inserted
replaced
90181:0c828e2b0b6f | 90182:f042e7c0fe20 |
---|---|
601 in the current Emacs session, then this function may return nil." | 601 in the current Emacs session, then this function may return nil." |
602 (if (consp event) | 602 (if (consp event) |
603 (setq event (car event))) | 603 (setq event (car event))) |
604 (if (symbolp event) | 604 (if (symbolp event) |
605 (car (get event 'event-symbol-elements)) | 605 (car (get event 'event-symbol-elements)) |
606 (let ((base (logand event (1- ?\A-\^@)))) | 606 (let* ((base (logand event (1- ?\A-\^@))) |
607 (downcase (if (< base 32) (logior base 64) base))))) | 607 (uncontrolled (if (< base 32) (logior base 64) base))) |
608 ;; There are some numbers that are invalid characters and | |
609 ;; cause `downcase' to get an error. | |
610 (condition-case () | |
611 (downcase uncontrolled) | |
612 (error uncontrolled))))) | |
608 | 613 |
609 (defsubst mouse-movement-p (object) | 614 (defsubst mouse-movement-p (object) |
610 "Return non-nil if OBJECT is a mouse movement event." | 615 "Return non-nil if OBJECT is a mouse movement event." |
611 (eq (car-safe object) 'mouse-movement)) | 616 (eq (car-safe object) 'mouse-movement)) |
612 | 617 |
751 (nth 9 position)) | 756 (nth 9 position)) |
752 | 757 |
753 | 758 |
754 ;;;; Obsolescent names for functions. | 759 ;;;; Obsolescent names for functions. |
755 | 760 |
756 (defalias 'window-dot 'window-point) | 761 (define-obsolete-function-alias 'window-dot 'window-point "22.1") |
757 (defalias 'set-window-dot 'set-window-point) | 762 (define-obsolete-function-alias 'set-window-dot 'set-window-point "22.1") |
758 (defalias 'read-input 'read-string) | 763 (define-obsolete-function-alias 'read-input 'read-string "22.1") |
759 (defalias 'send-string 'process-send-string) | 764 (define-obsolete-function-alias 'show-buffer 'set-window-buffer "22.1") |
760 (defalias 'send-region 'process-send-region) | 765 (define-obsolete-function-alias 'eval-current-buffer 'eval-buffer "22.1") |
761 (defalias 'show-buffer 'set-window-buffer) | 766 (define-obsolete-function-alias 'string-to-int 'string-to-number "22.1") |
762 (defalias 'eval-current-buffer 'eval-buffer) | |
763 | 767 |
764 (make-obsolete 'char-bytes "now always returns 1." "20.4") | 768 (make-obsolete 'char-bytes "now always returns 1." "20.4") |
765 (make-obsolete 'baud-rate "use the `baud-rate' variable instead." "before 19.15") | |
766 | 769 |
767 (defun insert-string (&rest args) | 770 (defun insert-string (&rest args) |
768 "Mocklisp-compatibility insert function. | 771 "Mocklisp-compatibility insert function. |
769 Like the function `insert' except that any argument that is a number | 772 Like the function `insert' except that any argument that is a number |
770 is converted into a string by expressing it in decimal." | 773 is converted into a string by expressing it in decimal." |
771 (dolist (el args) | 774 (dolist (el args) |
772 (insert (if (integerp el) (number-to-string el) el)))) | 775 (insert (if (integerp el) (number-to-string el) el)))) |
773 (make-obsolete 'insert-string 'insert "22.1") | 776 (make-obsolete 'insert-string 'insert "22.1") |
777 | |
774 (defun makehash (&optional test) (make-hash-table :test (or test 'eql))) | 778 (defun makehash (&optional test) (make-hash-table :test (or test 'eql))) |
775 (make-obsolete 'makehash 'make-hash-table "22.1") | 779 (make-obsolete 'makehash 'make-hash-table "22.1") |
776 | 780 |
777 ;; Some programs still use this as a function. | 781 ;; Some programs still use this as a function. |
778 (defun baud-rate () | 782 (defun baud-rate () |
779 "Return the value of the `baud-rate' variable." | 783 "Return the value of the `baud-rate' variable." |
780 baud-rate) | 784 baud-rate) |
785 (make-obsolete 'baud-rate "use the `baud-rate' variable instead." "before 19.15") | |
781 | 786 |
782 | 787 |
783 ;;;; Obsolescence declarations for variables, and aliases. | 788 ;;;; Obsolescence declarations for variables, and aliases. |
784 | 789 |
785 (make-obsolete-variable 'directory-sep-char "do not use it." "21.1") | 790 (make-obsolete-variable 'directory-sep-char "do not use it." "21.1") |
786 (make-obsolete-variable 'mode-line-inverse-video "use the appropriate faces instead." "21.1") | 791 (make-obsolete-variable 'mode-line-inverse-video "use the appropriate faces instead." "21.1") |
787 (make-obsolete-variable 'unread-command-char | 792 (make-obsolete-variable 'unread-command-char |
788 "use `unread-command-events' instead. That variable is a list of events to reread, so it now uses nil to mean `no event', instead of -1." | 793 "use `unread-command-events' instead. That variable is a list of events to reread, so it now uses nil to mean `no event', instead of -1." |
789 "before 19.15") | 794 "before 19.15") |
790 (make-obsolete-variable 'post-command-idle-hook | |
791 "use timers instead, with `run-with-idle-timer'." "before 19.34") | |
792 (make-obsolete-variable 'post-command-idle-delay | |
793 "use timers instead, with `run-with-idle-timer'." "before 19.34") | |
794 | 795 |
795 ;; Lisp manual only updated in 22.1. | 796 ;; Lisp manual only updated in 22.1. |
796 (define-obsolete-variable-alias 'executing-macro 'executing-kbd-macro | 797 (define-obsolete-variable-alias 'executing-macro 'executing-kbd-macro |
797 "before 19.34") | 798 "before 19.34") |
798 | 799 |
803 | 804 |
804 (defvaralias 'messages-buffer-max-lines 'message-log-max) | 805 (defvaralias 'messages-buffer-max-lines 'message-log-max) |
805 | 806 |
806 ;;;; Alternate names for functions - these are not being phased out. | 807 ;;;; Alternate names for functions - these are not being phased out. |
807 | 808 |
809 (defalias 'send-string 'process-send-string) | |
810 (defalias 'send-region 'process-send-region) | |
808 (defalias 'string= 'string-equal) | 811 (defalias 'string= 'string-equal) |
809 (defalias 'string< 'string-lessp) | 812 (defalias 'string< 'string-lessp) |
810 (defalias 'move-marker 'set-marker) | 813 (defalias 'move-marker 'set-marker) |
811 (defalias 'rplaca 'setcar) | 814 (defalias 'rplaca 'setcar) |
812 (defalias 'rplacd 'setcdr) | 815 (defalias 'rplacd 'setcdr) |
820 (defalias 'make-variable-frame-localizable 'make-variable-frame-local) | 823 (defalias 'make-variable-frame-localizable 'make-variable-frame-local) |
821 ;; These are the XEmacs names: | 824 ;; These are the XEmacs names: |
822 (defalias 'point-at-eol 'line-end-position) | 825 (defalias 'point-at-eol 'line-end-position) |
823 (defalias 'point-at-bol 'line-beginning-position) | 826 (defalias 'point-at-bol 'line-beginning-position) |
824 | 827 |
825 ;;; Should this be an obsolete name? If you decide it should, you get | |
826 ;;; to go through all the sources and change them. | |
827 (define-obsolete-function-alias 'string-to-int 'string-to-number) | |
828 | 828 |
829 ;;;; Hook manipulation functions. | 829 ;;;; Hook manipulation functions. |
830 | 830 |
831 (defun make-local-hook (hook) | 831 (defun make-local-hook (hook) |
832 "Make the hook HOOK local to the current buffer. | 832 "Make the hook HOOK local to the current buffer. |
981 \(with no directory name and no `.el' or `.elc' at the end). | 981 \(with no directory name and no `.el' or `.elc' at the end). |
982 It can also be nil, if the definition is not associated with any file. | 982 It can also be nil, if the definition is not associated with any file. |
983 | 983 |
984 If TYPE is nil, then any kind of definition is acceptable. | 984 If TYPE is nil, then any kind of definition is acceptable. |
985 If TYPE is `defun' or `defvar', that specifies function | 985 If TYPE is `defun' or `defvar', that specifies function |
986 definition only or variable definition only." | 986 definition only or variable definition only. |
987 `defface' specifies a face definition only." | |
987 (if (and (or (null type) (eq type 'defun)) | 988 (if (and (or (null type) (eq type 'defun)) |
988 (symbolp symbol) (fboundp symbol) | 989 (symbolp symbol) (fboundp symbol) |
989 (eq 'autoload (car-safe (symbol-function symbol)))) | 990 (eq 'autoload (car-safe (symbol-function symbol)))) |
990 (nth 1 (symbol-function symbol)) | 991 (nth 1 (symbol-function symbol)) |
991 (let ((files load-history) | 992 (let ((files load-history) |
1038 "Read the following input sexp, and run it whenever FILE is loaded. | 1039 "Read the following input sexp, and run it whenever FILE is loaded. |
1039 This makes or adds to an entry on `after-load-alist'. | 1040 This makes or adds to an entry on `after-load-alist'. |
1040 FILE should be the name of a library, with no directory name." | 1041 FILE should be the name of a library, with no directory name." |
1041 (eval-after-load file (read))) | 1042 (eval-after-load file (read))) |
1042 | 1043 |
1043 ;;; make-network-process wrappers | 1044 ;;; open-network-stream is a wrapper around make-network-process. |
1044 | 1045 |
1045 (if (featurep 'make-network-process) | 1046 (when (featurep 'make-network-process) |
1046 (progn | 1047 (defun open-network-stream (name buffer host service) |
1047 | |
1048 (defun open-network-stream (name buffer host service) | |
1049 "Open a TCP connection for a service to a host. | 1048 "Open a TCP connection for a service to a host. |
1050 Returns a subprocess-object to represent the connection. | 1049 Returns a subprocess-object to represent the connection. |
1051 Input and output work as for subprocesses; `delete-process' closes it. | 1050 Input and output work as for subprocesses; `delete-process' closes it. |
1052 | 1051 |
1053 Args are NAME BUFFER HOST SERVICE. | 1052 Args are NAME BUFFER HOST SERVICE. |
1059 with any buffer. | 1058 with any buffer. |
1060 HOST is name of the host to connect to, or its IP address. | 1059 HOST is name of the host to connect to, or its IP address. |
1061 SERVICE is name of the service desired, or an integer specifying | 1060 SERVICE is name of the service desired, or an integer specifying |
1062 a port number to connect to." | 1061 a port number to connect to." |
1063 (make-network-process :name name :buffer buffer | 1062 (make-network-process :name name :buffer buffer |
1064 :host host :service service)) | 1063 :host host :service service))) |
1065 | |
1066 (defun open-network-stream-nowait (name buffer host service &optional sentinel filter) | |
1067 "Initiate connection to a TCP connection for a service to a host. | |
1068 It returns nil if non-blocking connects are not supported; otherwise, | |
1069 it returns a subprocess-object to represent the connection. | |
1070 | |
1071 This function is similar to `open-network-stream', except that it | |
1072 returns before the connection is established. When the connection | |
1073 is completed, the sentinel function will be called with second arg | |
1074 matching `open' (if successful) or `failed' (on error). | |
1075 | |
1076 Args are NAME BUFFER HOST SERVICE SENTINEL FILTER. | |
1077 NAME, BUFFER, HOST, and SERVICE are as for `open-network-stream'. | |
1078 Optional args SENTINEL and FILTER specify the sentinel and filter | |
1079 functions to be used for this network stream." | |
1080 (if (featurep 'make-network-process '(:nowait t)) | |
1081 (make-network-process :name name :buffer buffer :nowait t | |
1082 :host host :service service | |
1083 :filter filter :sentinel sentinel))) | |
1084 | |
1085 (defun open-network-stream-server (name buffer service &optional sentinel filter) | |
1086 "Create a network server process for a TCP service. | |
1087 It returns nil if server processes are not supported; otherwise, | |
1088 it returns a subprocess-object to represent the server. | |
1089 | |
1090 When a client connects to the specified service, a new subprocess | |
1091 is created to handle the new connection, and the sentinel function | |
1092 is called for the new process. | |
1093 | |
1094 Args are NAME BUFFER SERVICE SENTINEL FILTER. | |
1095 NAME is name for the server process. Client processes are named by | |
1096 appending the ip-address and port number of the client to NAME. | |
1097 BUFFER is the buffer (or buffer name) to associate with the server | |
1098 process. Client processes will not get a buffer if a process filter | |
1099 is specified or BUFFER is nil; otherwise, a new buffer is created for | |
1100 the client process. The name is similar to the process name. | |
1101 Third arg SERVICE is name of the service desired, or an integer | |
1102 specifying a port number to connect to. It may also be t to select | |
1103 an unused port number for the server. | |
1104 Optional args SENTINEL and FILTER specify the sentinel and filter | |
1105 functions to be used for the client processes; the server process | |
1106 does not use these function." | |
1107 (if (featurep 'make-network-process '(:server t)) | |
1108 (make-network-process :name name :buffer buffer | |
1109 :service service :server t :noquery t | |
1110 :sentinel sentinel :filter filter))) | |
1111 | |
1112 )) ;; (featurep 'make-network-process) | |
1113 | |
1114 | 1064 |
1115 ;; compatibility | 1065 ;; compatibility |
1116 | 1066 |
1117 (make-obsolete 'process-kill-without-query | 1067 (make-obsolete 'process-kill-without-query |
1118 "use `process-query-on-exit-flag' or `set-process-query-on-exit-flag'." | 1068 "use `process-query-on-exit-flag' or `set-process-query-on-exit-flag'." |
2360 | 2310 |
2361 (defun assq-delete-all (key alist) | 2311 (defun assq-delete-all (key alist) |
2362 "Delete from ALIST all elements whose car is `eq' to KEY. | 2312 "Delete from ALIST all elements whose car is `eq' to KEY. |
2363 Return the modified alist. | 2313 Return the modified alist. |
2364 Elements of ALIST that are not conses are ignored." | 2314 Elements of ALIST that are not conses are ignored." |
2365 (while (and (consp (car alist)) | 2315 (while (and (consp (car alist)) |
2366 (eq (car (car alist)) key)) | 2316 (eq (car (car alist)) key)) |
2367 (setq alist (cdr alist))) | 2317 (setq alist (cdr alist))) |
2368 (let ((tail alist) tail-cdr) | 2318 (let ((tail alist) tail-cdr) |
2369 (while (setq tail-cdr (cdr tail)) | 2319 (while (setq tail-cdr (cdr tail)) |
2370 (if (and (consp (car tail-cdr)) | 2320 (if (and (consp (car tail-cdr)) |
2375 | 2325 |
2376 (defun rassq-delete-all (value alist) | 2326 (defun rassq-delete-all (value alist) |
2377 "Delete from ALIST all elements whose cdr is `eq' to VALUE. | 2327 "Delete from ALIST all elements whose cdr is `eq' to VALUE. |
2378 Return the modified alist. | 2328 Return the modified alist. |
2379 Elements of ALIST that are not conses are ignored." | 2329 Elements of ALIST that are not conses are ignored." |
2380 (while (and (consp (car alist)) | 2330 (while (and (consp (car alist)) |
2381 (eq (cdr (car alist)) value)) | 2331 (eq (cdr (car alist)) value)) |
2382 (setq alist (cdr alist))) | 2332 (setq alist (cdr alist))) |
2383 (let ((tail alist) tail-cdr) | 2333 (let ((tail alist) tail-cdr) |
2384 (while (setq tail-cdr (cdr tail)) | 2334 (while (setq tail-cdr (cdr tail)) |
2385 (if (and (consp (car tail-cdr)) | 2335 (if (and (consp (car tail-cdr)) |