]> code.delx.au - gnu-emacs/blobdiff - src/buffer.c
(message): Use message2, not message1.
[gnu-emacs] / src / buffer.c
index 5fbcad2c5d95e8b9d0d411dc87ce7f53d282d571..6b03e6d3e0ca30901c5812d7204df9d239a0731b 100644 (file)
@@ -28,7 +28,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define MAXPATHLEN 1024
 #endif /* not MAXPATHLEN */
 
-#include "config.h"
+#include <config.h>
 #include "lisp.h"
 #include "intervals.h"
 #include "window.h"
@@ -560,7 +560,11 @@ This does not change the name of the visited file (if any).")
 
   CHECK_STRING (name, 0);
   tem = Fget_buffer (name);
-  if (XBUFFER (tem) == current_buffer)
+  /* Don't short-circuit if UNIQUE is t.  That is a useful way to rename
+     the buffer automatically so you can create another with the original name.
+     It makes UNIQUE equivalent to
+     (rename-buffer (generate-new-buffer-name NAME)).  */
+  if (NILP (unique) && XBUFFER (tem) == current_buffer)
     return current_buffer->name;
   if (!NILP (tem))
     {
@@ -1012,7 +1016,7 @@ selected window if it is displayed there.")
 \f
 DEFUN ("erase-buffer", Ferase_buffer, Serase_buffer, 0, 0, "*",
   "Delete the entire contents of the current buffer.\n\
-Any clipping restriction in effect (see `narrow-to-region') is removed,\n\
+Any narrowing restriction in effect (see `narrow-to-region') is removed,\n\
 so the buffer is truly empty after this.")
   ()
 {
@@ -1141,9 +1145,9 @@ The R column contains a % for buffers that are read-only.")
 {
   Lisp_Object desired_point;
 
-  desired_point =
-    internal_with_output_to_temp_buffer ("*Buffer List*",
-                                        list_buffers_1, files);
+  desired_point
+    internal_with_output_to_temp_buffer ("*Buffer List*",
+                                          list_buffers_1, files);
 
   if (NUMBERP (desired_point))
     {
@@ -1153,6 +1157,7 @@ The R column contains a % for buffers that are read-only.")
       SET_PT (XINT (desired_point));
       return unbind_to (count, Qnil);
     }
+  return Qnil;
 }
 
 DEFUN ("kill-all-local-variables", Fkill_all_local_variables, Skill_all_local_variables,
@@ -1616,10 +1621,12 @@ buffer.")
   else
     /* Redisplay the area the overlay has just left, or just enclosed.  */
     {
-      Lisp_Object o_beg = OVERLAY_START (overlay);
-      Lisp_Object o_end = OVERLAY_END   (overlay);
+      Lisp_Object o_beg;
+      Lisp_Object o_end;
       int change_beg, change_end;
 
+      o_beg = OVERLAY_START (overlay);
+      o_end = OVERLAY_END   (overlay);
       o_beg = OVERLAY_POSITION (o_beg);
       o_end = OVERLAY_POSITION (o_end);
 
@@ -1680,8 +1687,8 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0,
   b->overlays_after  = Fdelq (overlay, b->overlays_after);
 
   redisplay_region (b,
-                   OVERLAY_POSITION (OVERLAY_START (overlay)),
-                   OVERLAY_POSITION (OVERLAY_END   (overlay)));
+                   marker_position (OVERLAY_START (overlay)),
+                   marker_position (OVERLAY_END   (overlay)));
 
   Fset_marker (OVERLAY_START (overlay), Qnil, Qnil);
   Fset_marker (OVERLAY_END   (overlay), Qnil, Qnil);
@@ -1863,9 +1870,11 @@ DEFUN ("overlay-put", Foverlay_put, Soverlay_put, 3, 3, 0,
 
   CHECK_OVERLAY (overlay, 0);
 
-  redisplay_region (XMARKER (OVERLAY_START (overlay))->buffer,
-                   OVERLAY_POSITION (OVERLAY_START (overlay)),
-                   OVERLAY_POSITION (OVERLAY_END   (overlay)));
+  tail = Fmarker_buffer (OVERLAY_START (overlay));
+  if (! NILP (tail))
+    redisplay_region (XMARKER (OVERLAY_START (overlay))->buffer,
+                     marker_position (OVERLAY_START (overlay)),
+                     marker_position (OVERLAY_END   (overlay)));
   
   plist = Fcdr_safe (XCONS (overlay)->cdr);
 
@@ -1903,7 +1912,7 @@ verify_overlay_modification (start, end)
        tail = XCONS (tail)->cdr)
     {
       int startpos, endpos;
-      int ostart, oend;
+      Lisp_Object ostart, oend;
 
       overlay = XCONS (tail)->car;
 
@@ -1937,13 +1946,14 @@ verify_overlay_modification (start, end)
        tail = XCONS (tail)->cdr)
     {
       int startpos, endpos;
-      int ostart, oend;
+      Lisp_Object ostart, oend;
 
       overlay = XCONS (tail)->car;
 
       ostart = OVERLAY_START (overlay);
       oend = OVERLAY_END (overlay);
       startpos = OVERLAY_POSITION (ostart);
+      endpos = OVERLAY_POSITION (oend);
       if (XFASTINT (end) < startpos)
        break;
       if (XFASTINT (end) == startpos && insertion)