Mercurial > hg > xemacs-beta
comparison lisp/files.el @ 851:e7ee5f8bde58
[xemacs-hg @ 2002-05-23 11:46:08 by ben]
fix for raymond toy's crash, alloca crashes, some recover-session improvements
files.el: Recover-session improvements: Only show session files where some
files can actually be recovered, and show in chronological order.
subr.el, menubar-items.el: As promised to rms, the functionality in
truncate-string-with-continuation-dots has been merged into
truncate-string-to-width. Change callers in menubar-items.el.
select.el: Document some of these funs better. Fix problem where we were
doing own-clipboard twice.
Makefile.in.in: Add alloca.o. Ensure that alloca.s doesn't compile into alloca.o,
but allocax.o (not that it's currently used or anything.)
EmacsFrame.c, abbrev.c, alloc.c, alloca.c, callint.c, callproc.c, config.h.in, device-msw.c, device-x.c, dired.c, doc.c, editfns.c, emacs.c, emodules.c, eval.c, event-Xt.c, event-msw.c, event-stream.c, file-coding.c, fileio.c, filelock.c, fns.c, glyphs-gtk.c, glyphs-msw.c, glyphs-x.c, gui-x.c, input-method-xlib.c, intl-win32.c, lisp.h, lread.c, menubar-gtk.c, menubar-msw.c, menubar.c, mule-wnnfns.c, nt.c, objects-msw.c, process-nt.c, realpath.c, redisplay-gtk.c, redisplay-output.c, redisplay-x.c, redisplay.c, search.c, select-msw.c, sysdep.c, syswindows.h, text.c, text.h, ui-byhand.c: Fix Raymond Toy's crash. Repeat to self: 2^21 - 1 is NOT the
same as (2 << 21) - 1.
Fix crashes due to excessive alloca(). replace alloca() with
ALLOCA(), which calls the C alloca() [which uses xmalloc()]
when the size is too big. Insert in various places calls to
try to flush the C alloca() stored info if there is any.
Add MALLOC_OR_ALLOCA(), for places that expect to be alloca()ing
large blocks. This xmalloc()s when too large and records an
unwind-protect to free -- relying on the caller to unbind_to()
elsewhere in the function. Use it in concat().
Use MALLOC instead of ALLOCA in select-msw.c.
xemacs.mak: Add alloca.o.
author | ben |
---|---|
date | Thu, 23 May 2002 11:46:46 +0000 |
parents | 503b6a57cf47 |
children | 42375619fa45 |
comparison
equal
deleted
inserted
replaced
850:f915ad7befaf | 851:e7ee5f8bde58 |
---|---|
3129 (unless (fboundp 'dired) | 3129 (unless (fboundp 'dired) |
3130 (error "recover-session requires dired")) | 3130 (error "recover-session requires dired")) |
3131 (if (null auto-save-list-file-prefix) | 3131 (if (null auto-save-list-file-prefix) |
3132 (error | 3132 (error |
3133 "You set `auto-save-list-file-prefix' to disable making session files")) | 3133 "You set `auto-save-list-file-prefix' to disable making session files")) |
3134 (declare-fboundp (dired (concat auto-save-list-file-prefix "*"))) | 3134 (let* ((auto-save-list-dir |
3135 (goto-char (point-min)) | 3135 (file-name-directory auto-save-list-file-prefix)) |
3136 (or (looking-at "Move to the session you want to recover,") | 3136 (files (directory-files |
3137 (let ((inhibit-read-only t)) | 3137 auto-save-list-dir |
3138 (insert "Move to the session you want to recover,\n" | 3138 t |
3139 "then type C-c C-c to select it.\n\n" | 3139 (concat "^" (regexp-quote (file-name-nondirectory |
3140 "You can also delete some of these files;\n" | 3140 auto-save-list-file-prefix))))) |
3141 "type d on a line to mark that file for deletion.\n\n"))) | 3141 (files (sort (delete-if-not #'Recover-session-files-from-auto-save-list-file |
3142 (use-local-map (let ((map (make-sparse-keymap))) | 3142 files) #'file-newer-than-file-p))) |
3143 (set-keymap-parents map (list (current-local-map))) | 3143 (unless files |
3144 map)) | 3144 (error "No sessions can be recovered now")) |
3145 (define-key (current-local-map) "\C-c\C-c" 'recover-session-finish)) | 3145 (declare-fboundp (dired (cons auto-save-list-dir files))) |
3146 | 3146 (goto-char (point-min)) |
3147 (defun recover-session-finish () | 3147 (or (looking-at "Move to the session you want to recover,") |
3148 "Choose one saved session to recover auto-save files from. | 3148 (let ((inhibit-read-only t)) |
3149 This command is used in the special Dired buffer created by | 3149 (delete-matching-lines "^[ \t]*total.*$") |
3150 \\[recover-session]." | 3150 (insert "Move to the session you want to recover,\n" |
3151 (interactive) | 3151 "then type C-c C-c to select it.\n\n" |
3152 ;; Get the name of the session file to recover from. | 3152 "You can also delete some of these files;\n" |
3153 (let ((file (declare-fboundp (dired-get-filename))) | 3153 "type d on a line to mark that file for deletion.\n\n"))) |
3154 files | 3154 (use-local-map (let ((map (make-sparse-keymap))) |
3155 (set-keymap-parents map (list (current-local-map))) | |
3156 map)) | |
3157 (define-key (current-local-map) "\C-c\C-c" 'recover-session-finish))) | |
3158 | |
3159 (defun Recover-session-files-from-auto-save-list-file (file) | |
3160 "Return the auto save files in list file FILE that are current." | |
3161 (let (files | |
3155 (buffer (get-buffer-create " *recover*"))) | 3162 (buffer (get-buffer-create " *recover*"))) |
3156 ;; #### dired-do-flagged-delete in FSF. | |
3157 ;; This version is for ange-ftp | |
3158 ;;(dired-do-deletions t) | |
3159 ;; This version is for efs | |
3160 (declare-fboundp (dired-expunge-deletions)) | |
3161 (unwind-protect | 3163 (unwind-protect |
3162 (save-excursion | 3164 (save-excursion |
3163 ;; Read in the auto-save-list file. | 3165 ;; Read in the auto-save-list file. |
3164 (set-buffer buffer) | 3166 (set-buffer buffer) |
3165 (erase-buffer) | 3167 (erase-buffer) |
3200 (point) (progn (end-of-line) (point)))) | 3202 (point) (progn (end-of-line) (point)))) |
3201 (forward-line 1))) | 3203 (forward-line 1))) |
3202 ;; Ignore a file if its auto-save file does not exist now. | 3204 ;; Ignore a file if its auto-save file does not exist now. |
3203 (if (file-exists-p autofile) | 3205 (if (file-exists-p autofile) |
3204 (setq files (cons thisfile files))))) | 3206 (setq files (cons thisfile files))))) |
3205 (setq files (nreverse files)) | 3207 (setq files (nreverse files))) |
3206 ;; The file contains a pair of line for each auto-saved buffer. | |
3207 ;; The first line of the pair contains the visited file name | |
3208 ;; or is empty if the buffer was not visiting a file. | |
3209 ;; The second line is the auto-save file name. | |
3210 (if files | |
3211 (map-y-or-n-p "Recover %s? " | |
3212 (lambda (file) | |
3213 (condition-case nil | |
3214 (save-excursion (recover-file file)) | |
3215 (error | |
3216 (lwarn 'recover 'alert "Failed to recover `%s'" file)))) | |
3217 files | |
3218 '("file" "files" "recover")) | |
3219 (message "No files can be recovered from this session now"))) | |
3220 (kill-buffer buffer)))) | 3208 (kill-buffer buffer)))) |
3209 | |
3210 (defun recover-session-finish () | |
3211 "Choose one saved session to recover auto-save files from. | |
3212 This command is used in the special Dired buffer created by | |
3213 \\[recover-session]." | |
3214 (interactive) | |
3215 ;; Get the name of the session file to recover from. | |
3216 (let ((file (declare-fboundp (dired-get-filename)))) | |
3217 ;; #### dired-do-flagged-delete in FSF. | |
3218 ;; This version is for ange-ftp | |
3219 ;;(dired-do-deletions t) | |
3220 ;; This version is for efs | |
3221 (declare-fboundp (dired-expunge-deletions)) | |
3222 (let ((files (Recover-session-files-from-auto-save-list-file file))) | |
3223 ;; The file contains a pair of line for each auto-saved buffer. | |
3224 ;; The first line of the pair contains the visited file name | |
3225 ;; or is empty if the buffer was not visiting a file. | |
3226 ;; The second line is the auto-save file name. | |
3227 (if files | |
3228 (map-y-or-n-p "Recover %s? " | |
3229 (lambda (file) | |
3230 (condition-case nil | |
3231 (save-excursion (recover-file file)) | |
3232 (error | |
3233 (lwarn 'recover 'alert | |
3234 "Failed to recover `%s'" file)))) | |
3235 files | |
3236 '("file" "files" "recover")) | |
3237 (message "No files can be recovered from this session now"))))) | |
3221 | 3238 |
3222 (defun kill-some-buffers (&optional list) | 3239 (defun kill-some-buffers (&optional list) |
3223 "For each buffer in LIST, ask whether to kill it. | 3240 "For each buffer in LIST, ask whether to kill it. |
3224 LIST defaults to all existing live buffers." | 3241 LIST defaults to all existing live buffers." |
3225 (interactive) | 3242 (interactive) |