comparison lisp/files.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 a5ee2ca8672c
comparison
equal deleted inserted replaced
501:0a255b32b157 502:7039e6323819
1706 (set var val)) 1706 (set var val))
1707 (message "Ignoring `eval:' in file's local variables"))) 1707 (message "Ignoring `eval:' in file's local variables")))
1708 ;; Ordinary variable, really set it. 1708 ;; Ordinary variable, really set it.
1709 (t (make-local-variable var) 1709 (t (make-local-variable var)
1710 (set var val)))) 1710 (set var val))))
1711
1712 (defun find-coding-system-magic-cookie-in-file (file)
1713 "Look for the coding-system magic cookie in FILE.
1714 The coding-system magic cookie is either the local variable specification
1715 -*- ... coding: ... -*- on the first line, or the exact string
1716 \";;;###coding system: \" somewhere within the first 3000 characters
1717 of the file. If found, the coding system name (as a string) is returned;
1718 otherwise nil is returned. Note that it is extremely unlikely that
1719 either such string would occur coincidentally as the result of encoding
1720 some characters in a non-ASCII charset, and that the spaces make it
1721 even less likely since the space character is not a valid octet in any
1722 ISO 2022 encoding of most non-ASCII charsets."
1723 (save-excursion
1724 (with-temp-buffer
1725 (let ((coding-system-for-read 'raw-text))
1726 (insert-file-contents file nil 1 3001))
1727 (goto-char (point-min))
1728 (or (and (looking-at
1729 "^[^\n]*-\\*-[^\n]*coding: \\([^ \t\n;]+\\)[^\n]*-\\*-")
1730 (buffer-substring (match-beginning 1) (match-end 1)))
1731 ;; (save-excursion
1732 ;; (let (start end)
1733 ;; (and (re-search-forward "^;+[ \t]*Local Variables:" nil t)
1734 ;; (setq start (match-end 0))
1735 ;; (re-search-forward "\n;+[ \t]*End:")
1736 ;; (setq end (match-beginning 0))
1737 ;; (save-restriction
1738 ;; (narrow-to-region start end)
1739 ;; (goto-char start)
1740 ;; (re-search-forward "^;;; coding: \\([^\n]+\\)$" nil t)
1741 ;; )
1742 ;; (let ((codesys
1743 ;; (intern (buffer-substring
1744 ;; (match-beginning 1)(match-end 1)))))
1745 ;; (if (find-coding-system codesys) codesys))
1746 ;; )))
1747 (let ((case-fold-search nil))
1748 (if (search-forward
1749 ";;;###coding system: " (+ (point-min) 3000) t)
1750 (let ((start (point))
1751 (end (progn
1752 (skip-chars-forward "^ \t\n\r")
1753 (point))))
1754 (if (> end start) (buffer-substring start end))
1755 )))
1756 ))))
1711 1757
1712 (defcustom change-major-mode-with-file-name t 1758 (defcustom change-major-mode-with-file-name t
1713 "*Non-nil means \\[write-file] should set the major mode from the file name. 1759 "*Non-nil means \\[write-file] should set the major mode from the file name.
1714 However, the mode will not be changed if 1760 However, the mode will not be changed if
1715 \(1) a local variables list or the `-*-' line specifies a major mode, or 1761 \(1) a local variables list or the `-*-' line specifies a major mode, or
1787 (kill-local-variable 'write-file-data-hooks) 1833 (kill-local-variable 'write-file-data-hooks)
1788 (kill-local-variable 'revert-buffer-function) 1834 (kill-local-variable 'revert-buffer-function)
1789 (kill-local-variable 'backup-inhibited) 1835 (kill-local-variable 'backup-inhibited)
1790 ;; If buffer was read-only because of version control, 1836 ;; If buffer was read-only because of version control,
1791 ;; that reason is gone now, so make it writable. 1837 ;; that reason is gone now, so make it writable.
1792 (when (boundp 'vc-mode) 1838 (if-boundp 'vc-mode
1793 (if vc-mode 1839 (progn
1794 (setq buffer-read-only nil)) 1840 (if vc-mode
1795 (kill-local-variable 'vc-mode)) 1841 (setq buffer-read-only nil))
1842 (kill-local-variable 'vc-mode)))
1796 ;; Turn off backup files for certain file names. 1843 ;; Turn off backup files for certain file names.
1797 ;; Since this is a permanent local, the major mode won't eliminate it. 1844 ;; Since this is a permanent local, the major mode won't eliminate it.
1798 (and buffer-file-name 1845 (and buffer-file-name
1799 (not (funcall backup-enable-predicate buffer-file-name)) 1846 (not (funcall backup-enable-predicate buffer-file-name))
1800 (progn 1847 (progn
2288 ) 2335 )
2289 ;; If the auto-save file was recent before this command, 2336 ;; If the auto-save file was recent before this command,
2290 ;; delete it now. 2337 ;; delete it now.
2291 (delete-auto-save-file-if-necessary recent-save) 2338 (delete-auto-save-file-if-necessary recent-save)
2292 ;; Support VC `implicit' locking. 2339 ;; Support VC `implicit' locking.
2293 (when (fboundp 'vc-after-save) 2340 (if-fboundp 'vc-after-save
2294 (vc-after-save)) 2341 (vc-after-save))
2295 (run-hooks 'after-save-hook)) 2342 (run-hooks 'after-save-hook))
2296 (display-message 'no-log "(No changes need to be saved)")))) 2343 (display-message 'no-log "(No changes need to be saved)"))))
2297 2344
2298 ;; This does the "real job" of writing a buffer into its visited file 2345 ;; This does the "real job" of writing a buffer into its visited file
2299 ;; and making a backup file. This is what is normally done 2346 ;; and making a backup file. This is what is normally done
2475 ;; this! --hniksic 2522 ;; this! --hniksic
2476 (list (list ?\C-r (lambda (buf) 2523 (list (list ?\C-r (lambda (buf)
2477 ;; #### FSF has an EXIT-ACTION argument 2524 ;; #### FSF has an EXIT-ACTION argument
2478 ;; to `view-buffer'. 2525 ;; to `view-buffer'.
2479 (view-buffer buf) 2526 (view-buffer buf)
2480 (setq view-exit-action 2527 (with-boundp 'view-exit-action
2481 (lambda (ignore) 2528 (setq view-exit-action
2482 (exit-recursive-edit))) 2529 (lambda (ignore)
2530 (exit-recursive-edit))))
2483 (recursive-edit) 2531 (recursive-edit)
2484 ;; Return nil to ask about BUF again. 2532 ;; Return nil to ask about BUF again.
2485 nil) 2533 nil)
2486 "%_Display Buffer")))) 2534 "%_Display Buffer"))))
2487 (abbrevs-done 2535 (abbrevs-done
3221 3269
3222 ;; Suggested by Michael Kifer <kifer@CS.SunySB.EDU> 3270 ;; Suggested by Michael Kifer <kifer@CS.SunySB.EDU>
3223 (defun file-remote-p (file-name) 3271 (defun file-remote-p (file-name)
3224 "Test whether FILE-NAME is looked for on a remote system." 3272 "Test whether FILE-NAME is looked for on a remote system."
3225 (cond ((not allow-remote-paths) nil) 3273 (cond ((not allow-remote-paths) nil)
3226 ((featurep 'ange-ftp) (ange-ftp-ftp-path file-name)) 3274 ((fboundp 'ange-ftp-ftp-path)
3227 ((fboundp 'efs-ftp-path) (efs-ftp-path file-name)) 3275 (declare-fboundp (ange-ftp-ftp-path file-name)))
3276 ((fboundp 'efs-ftp-path)
3277 (declare-fboundp (efs-ftp-path file-name)))
3228 (t nil))) 3278 (t nil)))
3229 3279
3230 ;; #### FSF has file-name-non-special here. 3280 ;; #### FSF has file-name-non-special here.
3231 3281
3232 ;;; files.el ends here 3282 ;;; files.el ends here