comparison lisp/help.el @ 502:7039e6323819

[xemacs-hg @ 2001-05-04 22:41:46 by ben] ----------------------- byte-comp warning fixes ----------------- New functions for cleanly eliminating byte-compiler warnings. Their definitions require no changes at all in bytecomp.el, meaning that any package that wants to use them and be compatible with older versions of XEmacs need only copy the code and rename the functions (i.e. prefix them with the package name). Eliminate byte-compiler warnings using the new functions in bytecomp-runtime.el. Move coding-system-put,get,category, since they're not Mule-specific and are used in prefer-coding-system. font.el was incredibly ugly. Clean it up. Avoid using defsubst for any exported functions, to avoid possible compatibility problems if we later change the internal interface. (It happened before, with face accessors, between 19.8 and 19.9). Fix tons of warnings. Clean up (new function gpm-is-supported-p eliminates duplicate code in gpm-create/delete-device-hook) and eliminate warnings. ---------- make byte-recompile-directory work in the --------- core `lisp' dir, even in the absence of a Mule XEmacs (i.e. make it skip the Mule files rather than trying to compile them). now you should be able to do `touch *.el' in the `lisp' dir, then M-x byte-recompile-directory, and get no warnings. Avoid trying to compile Mule files in byte-recompile-directory when we're not in a Mule XEmacs, since we're highly likely to get syntax errors. Add a coding-system cookie to all Mule files so that byte-recompile-directory ignores them. Magic cookie function moved to files.el from code-files.el (for use by bytecomp even in a non-coding-system XEmacs), and changed names and semantics for use by bytecomp. NOTE: IMO this is an internal function that we can change as we like (and there is absolutely no code anywhere else using the function). ---------------- GUI improvements: menus, help ------------------- Rearrange order of keymap declarations to be alphabetical. Improve help on help to include all bindings, and group by category. Add bindings for new Info commands. Remove warnings. Use command-hyper-apropos in place of command-apropos. Add a function to do the equivalent of command-apropos. Evals its help-text argument so you can put expressions there. Used now by help-for-help. Add binding to continue text searches. Expand index searches to work over multiple info documents. Add commands to search text/index in User and Lispref. Add new entry, "Uncomment Region" (parallels "Comment Out Region"). Redo Help menu; add bindings for new Info commands to search the index or text of the User and Lispref manuals. Add command for mark-paragraph, activate-region. Make Edit->R accelerator be rectangle, not register (more commonly used), and put rectangle first. Fix the Edit Init File entry to never load the .elc file. Simplify the default-popup-menu. Add Cmds->Tabs menu. Use kp-left not kp_left, etc. ---------------- Miscellaneous bug fixes/cleanup ------------------- byte-compiler-options: Correct doc string. easy-menu-do-define: fix extra quote. fill-paragraph-or-region:Rewrite to be more correct -- use call-interactively so that we always get exactly the same behavior as if the functions were called directly. No need to fiddle with zmacs-region-stays, now that bogus clearing of it (2001-04-28 src/ChangeLog) is removed. Put dialog titles back in -- this time correctly. Fix various other problems with leaks and such. key-sequence-list-description: Clean up fun to always correctly canonicalize. Clean up Kinsoku comments, synch comment-region with FSF 20.7. * simple.el (region-exists-p): * simple.el (region-active-p): Add comment about which one is correct to use in menu specs. * sound.el (load-sound-file): Minor code clean up. * startup.el: * startup.el (command-line-early): * startup.el (initial-scratch-message): Comment changes. Add info about sample.init.el to splash screen. Improve initial-scratch-message and clarify purpose of Scratch buffer. Fix byte-compile warning. ------------------------ Added features ------------------------- Add new variable to control whether etags checks all parent directories for tag files. (On by default.) * hash-table.el: New file, useful utility functions. * dumped-lisp.el (preloaded-file-list): Dump hash-table.el. ------------ notable bug fix: Windows event code -------------- Get critical quit working. ------------ notable bug fix and new feature: regex code -------------- Shy groups were implemented in a horrible, half-assed way that would cause them to screw up regex searching in most cases. Fixed to work correctly. Also extended back-reference syntax past 9. Only is recognized as such if there are at least that many non-shy groups; and optionally will warn about such uses, to catch old code that might be using them differently. (Added variable to control this in search.c -- `warn-about-possibly-incompatible-back- references', on by default for the moment. Declared in lisp.h. ---------------- process/SIGIO improvements ------------------- define USE_GETADDRINFO to replace more complex conditional, and use it. the code conditionalized on this in unix_open_network_stream had *serious* problems handling errors. it's now fixed, and major amounts of duplicate code between the two versions were combined. don't disable SIGIO and other interrupts unless CONNECT_NEEDS_SLOWED_INTERRUPTS is defined -- don't penalize OS's without bugs. similarly for a freebsd bug that was affecting all OS's. * s\ultrix.h: define CONNECT_NEEDS_SLOWED_INTERRUPTS, since that's the OS mentioned as having a kernel bug. * sysdep.c (request_sigio_on_device): * sysdep.c (unrequest_sigio_on_device): fix SIGIO problems on Linux. add check for O_ASYNC in case it's defined and FASYNC isn't. add comment about other ways to do SIGIO on Linux. * callproc.c (Fold_call_process_internal): * process.c (Fstart_process_internal): Deal with the possibility that `default-directory' doesn't have terminating slash. Correct comments about vfork. ---------------- Miscellaneous bug fixes/cleanup ------------------- * callint.c (Finteractive): Add lots of documentation -- exactly what the Lisp equivalents of all the interactive specs are. * console.h (struct console): change type of quit_char to Emchar. * event-msw.c (lstream_type_create_mswindows_selectable): spacing change. Eliminate events-mod.h and combine into events.h. * emacs.c: * emacs.c (make_arg_list_1): * emacs.c (main_1): A couple of char->Extbyte changes, add a comment. * glyphs-msw.c: Correct indentation of function defns to not exceed 80 cols. Try (sort of) to fix some code that sets the colors of the progress gauge. (Commented out) * keymap.c (syms_of_keymap): use DEFSYMBOL. * process.c (read_process_output): No need to fiddle with zmacs_region_stays, now that bogus clearing of it (see below) is removed. * search.c (Freplace_match): warning fix.
author ben
date Fri, 04 May 2001 22:42:35 +0000
parents 5aa1854ad537
children 11502791fc1c
comparison
equal deleted inserted replaced
501:0a255b32b157 502:7039e6323819
62 (define-key help-map (vector help-char) 'help-for-help) 62 (define-key help-map (vector help-char) 'help-for-help)
63 (define-key help-map "?" 'help-for-help) 63 (define-key help-map "?" 'help-for-help)
64 (define-key help-map 'help 'help-for-help) 64 (define-key help-map 'help 'help-for-help)
65 (define-key help-map '(f1) 'help-for-help) 65 (define-key help-map '(f1) 'help-for-help)
66 66
67 (define-key help-map "\C-l" 'describe-copying) ; on \C-c in FSFmacs
68 (define-key help-map "\C-d" 'describe-distribution)
69 (define-key help-map "\C-w" 'describe-no-warranty)
70 (define-key help-map "a" 'hyper-apropos) ; 'command-apropos in FSFmacs 67 (define-key help-map "a" 'hyper-apropos) ; 'command-apropos in FSFmacs
71 (define-key help-map "A" 'command-apropos) 68 (define-key help-map "A" 'command-hyper-apropos)
69 ;; #### should be hyper-apropos-documentation, once that's written.
70 (define-key help-map "\C-a" 'apropos-documentation)
72 71
73 (define-key help-map "b" 'describe-bindings) 72 (define-key help-map "b" 'describe-bindings)
74 (define-key help-map "B" 'describe-beta) 73 (define-key help-map "B" 'describe-beta)
75 (define-key help-map "\C-p" 'describe-pointer) 74
76 75 (define-key help-map "c" 'describe-key-briefly)
77 (define-key help-map "C" 'customize) 76 (define-key help-map "C" 'customize)
78 (define-key help-map "c" 'describe-key-briefly)
79 (define-key help-map "k" 'describe-key)
80
81 (define-key help-map "d" 'describe-function)
82 (define-key help-map "e" 'describe-last-error)
83 (define-key help-map "f" 'describe-function)
84
85 (define-key help-map "F" 'xemacs-local-faq)
86
87 (define-key help-map "i" 'info)
88 (define-key help-map '(control i) 'Info-query)
89 ;; FSFmacs has Info-goto-emacs-command-node on C-f, no binding 77 ;; FSFmacs has Info-goto-emacs-command-node on C-f, no binding
90 ;; for Info-elisp-ref 78 ;; for Info-elisp-ref
91 (define-key help-map '(control c) 'Info-goto-emacs-command-node) 79 (define-key help-map "\C-c" 'Info-goto-emacs-command-node)
92 (define-key help-map '(control k) 'Info-goto-emacs-key-command-node) 80
93 (define-key help-map '(control f) 'Info-elisp-ref) 81 (define-key help-map "d" 'describe-function)
82 (define-key help-map "\C-d" 'describe-distribution)
83
84 (define-key help-map "e" (if (fboundp 'view-last-error) 'view-last-error
85 'describe-last-error))
86
87 (define-key help-map "f" 'describe-function)
88 ;; #### not a good interface. no way to specify that C-h is preferred
89 ;; as a prefix and not BS. should instead be specified as part of
90 ;; `define-key'.
91 ;; (put 'describe-function 'preferred-key-sequence "\C-hf")
92 (define-key help-map "F" 'xemacs-local-faq)
93 (define-key help-map "\C-f" 'Info-elisp-ref)
94
95 (define-key help-map "i" 'info)
96 (define-key help-map "I" 'Info-search-index-in-xemacs-and-lispref)
97 (define-key help-map "\C-i" 'Info-query)
98
99 (define-key help-map "k" 'describe-key)
100 (define-key help-map "\C-k" 'Info-goto-emacs-key-command-node)
94 101
95 (define-key help-map "l" 'view-lossage) 102 (define-key help-map "l" 'view-lossage)
103 (define-key help-map "\C-l" 'describe-copying) ; on \C-c in FSFmacs
96 104
97 (define-key help-map "m" 'describe-mode) 105 (define-key help-map "m" 'describe-mode)
98 106
107 (define-key help-map "n" 'view-emacs-news)
99 (define-key help-map "\C-n" 'view-emacs-news) 108 (define-key help-map "\C-n" 'view-emacs-news)
100 (define-key help-map "n" 'view-emacs-news)
101 109
102 (define-key help-map "p" 'finder-by-keyword) 110 (define-key help-map "p" 'finder-by-keyword)
111 (define-key help-map "\C-p" 'describe-pointer)
112
113 (define-key help-map "q" 'help-quit)
103 114
104 ;; Do this right with an autoload cookie in finder.el. 115 ;; Do this right with an autoload cookie in finder.el.
105 ;;(autoload 'finder-by-keyword "finder" 116 ;;(autoload 'finder-by-keyword "finder"
106 ;; "Find packages matching a given keyword." t) 117 ;; "Find packages matching a given keyword." t)
107 118
108 (define-key help-map "s" 'describe-syntax) 119 (define-key help-map "s" 'describe-syntax)
120 (define-key help-map "S" 'view-sample-init-el)
109 121
110 (define-key help-map "t" 'help-with-tutorial) 122 (define-key help-map "t" 'help-with-tutorial)
111 123
124 (define-key help-map "v" 'describe-variable)
125
112 (define-key help-map "w" 'where-is) 126 (define-key help-map "w" 'where-is)
113 127 (define-key help-map "\C-w" 'describe-no-warranty)
114 (define-key help-map "v" 'describe-variable) 128
115 129 ;; #### It would be nice if the code below to add hyperlinks was
116 (if (fboundp 'view-last-error) 130 ;; generalized. We would probably need a "hyperlink mode" from which
117 (define-key help-map "e" 'view-last-error)) 131 ;; help-mode is derived. This means we probably need multiple
118 132 ;; inheritance of modes! Thankfully this is not hard to implement; we
119 133 ;; already have the ability for a keymap to have multiple parents.
120 (define-key help-map "q" 'help-quit) 134 ;; However, we'd have to define any multiply-inherited-from modes using
121 135 ;; a standard `define-mode' construction instead of manually doing it,
122 ;#### This stuff was an attempt to have font locking and hyperlinks in the 136 ;; because we don't want each guy calling `kill-all-local-variables' and
123 ;help buffer, but it doesn't really work. Some of this stuff comes from 137 ;; messing up the previous one.
124 ;FSF Emacs; but the FSF Emacs implementation is rather broken, as usual.
125 ;What needs to happen is this:
126 ;
127 ; -- we probably need a "hyperlink mode" from which help-mode is derived.
128 ; -- this means we probably need multiple inheritance of modes!
129 ; Thankfully this is not hard to implement; we already have the
130 ; ability for a keymap to have multiple parents. However, we'd
131 ; have to define any multiply-inherited-from modes using a standard
132 ; `define-mode' construction instead of manually doing it, because
133 ; we don't want each guy calling `kill-all-local-variables' and
134 ; messing up the previous one.
135 ; -- we need to scan the buffer ourselves (not from font-lock, because
136 ; the user might not have font-lock enabled) and highlight only
137 ; those words that are *documented* functions and variables (and
138 ; probably excluding words without dashes in them unless enclosed
139 ; in quotes, so that common words like "list" and "point" don't
140 ; become hyperlinks.
141 ; -- we should *not* use font-lock keywords like below. Instead we
142 ; should add the font-lock stuff ourselves during the scanning phase,
143 ; if font-lock is enabled in this buffer.
144
145 ;(defun help-follow-reference (event extent user-data)
146 ; (let ((symbol (intern-soft (extent-string extent))))
147 ; (cond ((and symbol (fboundp symbol))
148 ; (describe-function symbol))
149 ; ((and symbol (boundp symbol))
150 ; (describe-variable symbol))
151 ; (t nil))))
152
153 ;(defvar help-font-lock-keywords
154 ; (let ((name-char "[-+a-zA-Z0-9_*]") (sym-char "[-+a-zA-Z0-9_:*]"))
155 ; (list
156 ; ;;
157 ; ;; The symbol itself.
158 ; (list (concat "\\`\\(" name-char "+\\)\\(:\\)?")
159 ; '(1 (if (match-beginning 2)
160 ; 'font-lock-function-name-face
161 ; 'font-lock-variable-name-face)
162 ; nil t))
163 ; ;;
164 ; ;; Words inside `' which tend to be symbol names.
165 ; (list (concat "`\\(" sym-char sym-char "+\\)'")
166 ; 1 '(prog1
167 ; 'font-lock-reference-face
168 ; (add-list-mode-item (match-beginning 1)
169 ; (match-end 1)
170 ; nil
171 ; 'help-follow-reference))
172 ; t)
173 ; ;;
174 ; ;; CLisp `:' keywords as references.
175 ; (list (concat "\\<:" sym-char "+\\>") 0 'font-lock-reference-face t)))
176 ; "Default expressions to highlight in Help mode.")
177
178 ;(put 'help-mode 'font-lock-defaults '(help-font-lock-keywords))
179 138
180 (define-derived-mode help-mode view-major-mode "Help" 139 (define-derived-mode help-mode view-major-mode "Help"
181 "Major mode for viewing help text. 140 "Major mode for viewing help text.
182 Entry to this mode runs the normal hook `help-mode-hook'. 141 Entry to this mode runs the normal hook `help-mode-hook'.
183 Commands: 142 Commands:
817 776
818 (define-function 'help 'help-for-help) 777 (define-function 'help 'help-for-help)
819 778
820 (make-help-screen help-for-help 779 (make-help-screen help-for-help
821 "A B C F I K L M N P S T V W C-c C-d C-f C-i C-k C-n C-w; ? for more help:" 780 "A B C F I K L M N P S T V W C-c C-d C-f C-i C-k C-n C-w; ? for more help:"
822 "Type a Help option: 781 (concat
782 "Type a Help option:
823 \(Use SPC or DEL to scroll through this text. Type \\<help-map>\\[help-quit] to exit the Help command.) 783 \(Use SPC or DEL to scroll through this text. Type \\<help-map>\\[help-quit] to exit the Help command.)
784
785 Help on key bindings:
786
787 \\[describe-bindings] Table of all key bindings.
788 \\[describe-key-briefly] Type a key sequence or select a menu item;
789 it displays the corresponding command name.
790 \\[describe-key] Type a key sequence or select a menu item;
791 it displays the documentation for the command bound to that key.
792 (Terser but more up-to-date than what's in the manual.)
793 \\[Info-goto-emacs-key-command-node] Type a key sequence or select a menu item;
794 it jumps to the full documentation in the XEmacs User's Manual
795 for the corresponding command.
796 \\[view-lossage] Recent input keystrokes and minibuffer messages.
797 \\[describe-mode] Documentation of current major and minor modes.
798 \\[describe-pointer] Table of all mouse-button bindings.
799 \\[where-is] Type a command name; it displays which keystrokes invoke that command.
800
801 Help on functions and variables:
824 802
825 \\[hyper-apropos] Type a substring; it shows a hypertext list of 803 \\[hyper-apropos] Type a substring; it shows a hypertext list of
826 functions and variables that contain that substring. 804 functions and variables that contain that substring.
827 See also the `apropos' command. 805 \\[command-apropos] Older version of apropos; superseded by previous command.
828 \\[command-apropos] Type a substring; it shows a list of commands 806 \\[apropos-documentation] Type a substring; it shows a hypertext list of
829 (interactively callable functions) that contain that substring. 807 functions and variables containing that substring anywhere
830 \\[describe-bindings] Table of all key bindings. 808 in their documentation.
831 \\[describe-key-briefly] Type a command key sequence; 809 \\[Info-goto-emacs-command-node] Type a command name; it jumps to the full documentation
832 it displays the function name that sequence runs. 810 in the XEmacs User's Manual.
811 \\[describe-function] Type a command or function name; it shows its documentation.
812 (Terser but more up-to-date than what's in the manual.)
813 \\[Info-elisp-ref] Type a function name; it jumps to the full documentation
814 in the XEmacs Lisp Reference Manual.
815 \\[Info-search-index-in-xemacs-and-lispref] Type a substring; it looks it up in the indices of both
816 the XEmacs User's Manual and the XEmacs Lisp Reference Manual.
817 It jumps to the first match (preferring an exact match); you
818 can use `\\<Info-mode-map>\\[Info-index-next]\\<help-map>' to successively visit other matches.
819 \\[describe-variable] Type a variable name; it displays its documentation and value.
820
821 Miscellaneous:
822
823 "
824 (if (string-match "beta" emacs-version)
825 "\\[describe-beta] Special considerations about running a beta version of XEmacs.
826 "
827 "")
828 "
833 \\[customize] Customize Emacs options. 829 \\[customize] Customize Emacs options.
834 \\[Info-goto-emacs-command-node] Type a function name; it displays the Info node for that command. 830 \\[describe-distribution] How to obtain XEmacs.
835 \\[describe-function] Type a function name; it shows its documentation. 831 \\[describe-last-error] Information about the most recent error.
836 \\[Info-elisp-ref] Type a function name; it jumps to the full documentation
837 in the XEmacs Lisp Programmer's Manual.
838 \\[xemacs-local-faq] Local copy of the XEmacs FAQ. 832 \\[xemacs-local-faq] Local copy of the XEmacs FAQ.
839 \\[info] Info documentation reader. 833 \\[info] Info documentation reader.
840 \\[Info-query] Type an Info file name; it displays it in Info reader. 834 \\[Info-query] Type an Info file name; it displays it in Info reader.
841 \\[describe-key] Type a command key sequence; 835 \\[describe-copying] XEmacs copying permission (General Public License).
842 it displays the documentation for the command bound to that key.
843 \\[Info-goto-emacs-key-command-node] Type a command key sequence;
844 it displays the Info node for the command bound to that key.
845 \\[view-lossage] Recent input keystrokes and minibuffer messages.
846 \\[describe-mode] Documentation of current major and minor modes.
847 \\[view-emacs-news] News of recent XEmacs changes. 836 \\[view-emacs-news] News of recent XEmacs changes.
848 \\[finder-by-keyword] Type a topic keyword; it finds matching packages. 837 \\[finder-by-keyword] Type a topic keyword; it finds matching packages.
849 \\[describe-pointer] Table of all mouse-button bindings.
850 \\[describe-syntax] Contents of syntax table with explanations. 838 \\[describe-syntax] Contents of syntax table with explanations.
839 \\[view-sample-init-el] View the sample init.el that comes with XEmacs.
851 \\[help-with-tutorial] XEmacs learn-by-doing tutorial. 840 \\[help-with-tutorial] XEmacs learn-by-doing tutorial.
852 \\[describe-variable] Type a variable name; it displays its documentation and value. 841 \\[describe-no-warranty] Information on absence of warranty for XEmacs."
853 \\[where-is] Type a command name; it displays which keystrokes invoke that command. 842 )
854 \\[describe-distribution] XEmacs ordering information.
855 \\[describe-no-warranty] Information on absence of warranty for XEmacs.
856 \\[describe-copying] XEmacs copying permission (General Public License)."
857 help-map) 843 help-map)
858 844
859 (defmacro with-syntax-table (syntab &rest body) 845 (defmacro with-syntax-table (syntab &rest body)
860 "Evaluate BODY with the SYNTAB as the current syntax table." 846 "Evaluate BODY with the SYNTAB as the current syntax table."
861 `(let ((stab (syntax-table))) 847 `(let ((stab (syntax-table)))
1220 (symbol-name def))) 1206 (symbol-name def)))
1221 (format "an alias for `%s', " (symbol-name def))))) 1207 (format "an alias for `%s', " (symbol-name def)))))
1222 (setq def (symbol-function def))) 1208 (setq def (symbol-function def)))
1223 (if (and (fboundp 'compiled-function-annotation) 1209 (if (and (fboundp 'compiled-function-annotation)
1224 (compiled-function-p def)) 1210 (compiled-function-p def))
1225 (setq file-name (compiled-function-annotation def))) 1211 (setq file-name (declare-fboundp (compiled-function-annotation def))))
1226 (if (eq 'macro (car-safe def)) 1212 (if (eq 'macro (car-safe def))
1227 (setq fndef (cdr def) 1213 (setq fndef (cdr def)
1228 file-name (and (compiled-function-p (cdr def)) 1214 file-name (and (compiled-function-p (cdr def))
1229 (fboundp 'compiled-function-annotation) 1215 (fboundp 'compiled-function-annotation)
1230 (compiled-function-annotation (cdr def))) 1216 (declare-fboundp
1217 (compiled-function-annotation (cdr def))))
1231 macrop t) 1218 macrop t)
1232 (setq fndef def)) 1219 (setq fndef def))
1233 (if aliases (princ aliases)) 1220 (if aliases (princ aliases))
1234 (let ((int #'(lambda (string an-p macro-p) 1221 (let ((int #'(lambda (string an-p macro-p)
1235 (princ (format 1222 (princ (format
1411 (let ((origvar variable) 1398 (let ((origvar variable)
1412 aliases) 1399 aliases)
1413 (let ((print-escape-newlines t)) 1400 (let ((print-escape-newlines t))
1414 (princ "`") 1401 (princ "`")
1415 ;; (Help-princ-face (symbol-name variable) 1402 ;; (Help-princ-face (symbol-name variable)
1416 ;; 'font-lock-variable-name-face) overkill 1403 ;; 'font-lock-variable-name-face) overkill
1417 (princ (symbol-name variable)) 1404 (princ (symbol-name variable))
1418 (princ "' is ") 1405 (princ "' is ")
1419 (while (variable-alias variable) 1406 (while (variable-alias variable)
1420 (let ((newvar (variable-alias variable))) 1407 (let ((newvar (variable-alias variable)))
1421 (if aliases 1408 (if aliases