comparison src/fileio.c @ 844:047d37eb70d7

[xemacs-hg @ 2002-05-16 13:30:23 by ben] ui fixes for things that were bothering me bytecode.c, editfns.c, lisp.h, lread.c: Fix save-restriction to use markers rather than pseudo-markers (integers representing the amount of text on either side of the region). That way, all inserts are handled correctly, not just those inside old restriction. Add buffer argument to save_restriction_save(). process.c: Clean up very dirty and kludgy code that outputs into a buffer -- use proper unwind protects, etc. font-lock.c: Do save-restriction/widen around the function -- otherwise, incorrect results will ensue when a buffer has been narrowed before a call to e.g. `buffer-syntactic-context' -- something that happens quite often. fileio.c: Look for a handler for make-temp-name. window.c, winslots.h: Try to solve this annoying problem: have two frames displaying the buffer, in different places; in one, temporarily switch away to another buffer and then back -- and you've lost your position; it's reset to the other one in the other frame. My current solution involves window-level caches of buffers and points (also a cache for window-start); when set-window-buffer is called, it looks to see if the buffer was previously visited in the window, and if so, uses the most recent point at that time. (It's a marker, so it handles changes.) #### Note: It could be argued that doing it on the frame level would be better -- e.g. if you visit a buffer temporarily through a grep, and then go back to that buffer, you presumably want the grep's position rather than some previous position provided everything was in the same frame, even though the grep was in another window in the frame. However, doing it on the frame level fails when you have two windows on the same frame. Perhaps we keep both a window and a frame cache, and use the frame cache if there are no other windows on the frame showing the buffer, else the window's cache? This is probably something to be configurable using a specifier. Suggestions please please please? window.c: Clean up a bit code that deals with the annoyance of window-point vs. point. dialog.el: Function to ask a multiple-choice question, automatically choosing a dialog box or minibuffer representation as necessary. Generalized version of yes-or-no-p, y-or-n-p. files.el: Use get-user-response to ask "yes/no/diff" question when recovering. "diff" means that a diff is displayed between the current file and the autosave. (Converts/deconverts escape-quoted as necessary. No more complaints from you, Mr. Turnbull!) One known problem: when a dialog is used, it's modal, so you can't scroll the diff. Will fix soon. lisp-mode.el: If we're filling a string, don't treat semicolon as a comment, which would give very unfriendly results. Uses `buffer-syntactic-context'. simple.el: all changes back to the beginning. (Useful if you've saved the file in the middle of the changes.) simple.el: Add option kill-word-into-kill-ring, which controls whether words deleted with kill-word, backward-kill-word, etc. are "cut" into the kill ring, or "cleared" into nothingness. (My preference is the latter, by far. I'd almost go so far as suggesting we make it the default, as you can always select a word and then cut it if you want it cut.) menubar-items.el: Add option corresponding to kill-word-into-kill-ring.
author ben
date Thu, 16 May 2002 13:30:58 +0000
parents 6728e641994e
children e7ee5f8bde58
comparison
equal deleted inserted replaced
843:f46864126a0d 844:047d37eb70d7
224 Lisp_Object Qdelete_directory; 224 Lisp_Object Qdelete_directory;
225 Lisp_Object Qdelete_file; 225 Lisp_Object Qdelete_file;
226 Lisp_Object Qrename_file; 226 Lisp_Object Qrename_file;
227 Lisp_Object Qadd_name_to_file; 227 Lisp_Object Qadd_name_to_file;
228 Lisp_Object Qmake_symbolic_link; 228 Lisp_Object Qmake_symbolic_link;
229 Lisp_Object Qmake_temp_name;
229 Lisp_Object Qfile_exists_p; 230 Lisp_Object Qfile_exists_p;
230 Lisp_Object Qfile_executable_p; 231 Lisp_Object Qfile_executable_p;
231 Lisp_Object Qfile_readable_p; 232 Lisp_Object Qfile_readable_p;
232 Lisp_Object Qfile_symlink_p; 233 Lisp_Object Qfile_symlink_p;
233 Lisp_Object Qfile_writable_p; 234 Lisp_Object Qfile_writable_p;
593 The Emacs process number forms part of the result, so there is no 594 The Emacs process number forms part of the result, so there is no
594 danger of generating a name being used by another process. 595 danger of generating a name being used by another process.
595 596
596 In addition, this function makes an attempt to choose a name that 597 In addition, this function makes an attempt to choose a name that
597 does not specify an existing file. To make this work, PREFIX should 598 does not specify an existing file. To make this work, PREFIX should
598 be an absolute file name. 599 be an absolute file name. A reasonable idiom is
600
601 \(make-temp-name (expand-file-name "myprefix" (temp-directory)))
602
603 which puts the file in the OS-specified temporary directory.
599 */ 604 */
600 (prefix)) 605 (prefix))
601 { 606 {
602 static const char tbl[64] = 607 static const char tbl[64] =
603 { 608 {
611 '4','5','6','7','8','9','-','_' 616 '4','5','6','7','8','9','-','_'
612 }; 617 };
613 618
614 Bytecount len; 619 Bytecount len;
615 Intbyte *p, *data; 620 Intbyte *p, *data;
621 Lisp_Object handler;
616 622
617 CHECK_STRING (prefix); 623 CHECK_STRING (prefix);
624 handler = Ffind_file_name_handler (prefix, Qmake_temp_name);
625 if (!NILP (handler))
626 return call2_check_string (handler, Qmake_temp_name, prefix);
618 627
619 /* I was tempted to apply Fexpand_file_name on PREFIX here, but it's 628 /* I was tempted to apply Fexpand_file_name on PREFIX here, but it's
620 a bad idea because: 629 a bad idea because:
621 630
622 1) It might change the prefix, so the resulting string might not 631 1) It might change the prefix, so the resulting string might not
625 634
626 2) It breaks under many unforeseeable circumstances, such as with 635 2) It breaks under many unforeseeable circumstances, such as with
627 the code that uses (make-temp-name "") instead of 636 the code that uses (make-temp-name "") instead of
628 (make-temp-name "./"). 637 (make-temp-name "./").
629 638
630 3) It might yield unexpected (to stat(2)) results in the presence 639 [[ 3) It might yield unexpected (to stat(2)) results in the presence
631 of EFS and file name handlers. */ 640 of EFS and file name handlers.]] Now that we check for a handler,
641 that's less of a concern. --ben */
632 642
633 len = XSTRING_LENGTH (prefix); 643 len = XSTRING_LENGTH (prefix);
634 data = alloca_intbytes (len + 7); 644 data = alloca_intbytes (len + 7);
635 memcpy (data, XSTRING_DATA (prefix), len); 645 memcpy (data, XSTRING_DATA (prefix), len);
636 p = data + len; 646 p = data + len;
4199 DEFSYMBOL (Qdelete_directory); 4209 DEFSYMBOL (Qdelete_directory);
4200 DEFSYMBOL (Qdelete_file); 4210 DEFSYMBOL (Qdelete_file);
4201 DEFSYMBOL (Qrename_file); 4211 DEFSYMBOL (Qrename_file);
4202 DEFSYMBOL (Qadd_name_to_file); 4212 DEFSYMBOL (Qadd_name_to_file);
4203 DEFSYMBOL (Qmake_symbolic_link); 4213 DEFSYMBOL (Qmake_symbolic_link);
4214 DEFSYMBOL (Qmake_temp_name);
4204 DEFSYMBOL (Qfile_exists_p); 4215 DEFSYMBOL (Qfile_exists_p);
4205 DEFSYMBOL (Qfile_executable_p); 4216 DEFSYMBOL (Qfile_executable_p);
4206 DEFSYMBOL (Qfile_readable_p); 4217 DEFSYMBOL (Qfile_readable_p);
4207 DEFSYMBOL (Qfile_symlink_p); 4218 DEFSYMBOL (Qfile_symlink_p);
4208 DEFSYMBOL (Qfile_writable_p); 4219 DEFSYMBOL (Qfile_writable_p);