]> code.delx.au - gnu-emacs/blobdiff - src/marker.c
(Fbury_buffer): If buffer is in selected window, remove it.
[gnu-emacs] / src / marker.c
index 3bbccb0b735461092d949ebf4de47668a46fd9d3..a11068d69df2d6f8de19749df2dc1e0ad1f31f0f 100644 (file)
@@ -15,7 +15,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
 
 
 #include <config.h>
@@ -72,13 +73,13 @@ DEFUN ("marker-position", Fmarker_position, Smarker_position, 1, 1, 0,
 }
 \f
 DEFUN ("set-marker", Fset_marker, Sset_marker, 2, 3, 0,
-  "Position MARKER before character number NUMBER in BUFFER.\n\
+  "Position MARKER before character number POSITION in BUFFER.\n\
 BUFFER defaults to the current buffer.\n\
-If NUMBER is nil, makes marker point nowhere.\n\
+If POSITION is nil, makes marker point nowhere.\n\
 Then it no longer slows down editing in any buffer.\n\
 Returns MARKER.")
-  (marker, pos, buffer)
-     Lisp_Object marker, pos, buffer;
+  (marker, position, buffer)
+     Lisp_Object marker, position, buffer;
 {
   register int charno;
   register struct buffer *b;
@@ -87,14 +88,14 @@ Returns MARKER.")
   CHECK_MARKER (marker, 0);
   /* If position is nil or a marker that points nowhere,
      make this marker point nowhere.  */
-  if (NILP (pos)
-      || (MARKERP (pos) && !XMARKER (pos)->buffer))
+  if (NILP (position)
+      || (MARKERP (position) && !XMARKER (position)->buffer))
     {
       unchain_marker (marker);
       return marker;
     }
 
-  CHECK_NUMBER_COERCE_MARKER (pos, 1);
+  CHECK_NUMBER_COERCE_MARKER (position, 1);
   if (NILP (buffer))
     b = current_buffer;
   else
@@ -109,7 +110,7 @@ Returns MARKER.")
        }
     }
 
-  charno = XINT (pos);
+  charno = XINT (position);
   m = XMARKER (marker);
 
   if (charno < BUF_BEG (b))
@@ -303,7 +304,7 @@ DEFUN ("set-marker-insertion-type", Fset_marker_insertion_type,
        Sset_marker_insertion_type, 2, 2, 0,
   "Set the insertion-type of MARKER to TYPE.\n\
 If TYPE is t, it means the marker advances when you insert text at it.\n\
-If TYPE is t, it means the marker stays behind when you insert text at it.")
+If TYPE is nil, it means the marker stays behind when you insert text at it.")
   (marker, type)
      Lisp_Object marker, type;
 {
@@ -312,6 +313,32 @@ If TYPE is t, it means the marker stays behind when you insert text at it.")
   XMARKER (marker)->insertion_type = ! NILP (type);
   return type;
 }
+
+DEFUN ("buffer-has-markers-at", Fbuffer_has_markers_at, Sbuffer_has_markers_at,
+  1, 1, 0,
+  "Return t if there are markers pointing at POSITION in the currentbuffer.")
+  (position)
+      Lisp_Object position;
+{
+  register Lisp_Object tail;
+  register int charno;
+
+  charno = XINT (position);
+
+  if (charno < BEG)
+    charno = BEG;
+  if (charno > Z)
+    charno = Z;
+  if (charno > GPT) charno += GAP_SIZE;
+
+  for (tail = BUF_MARKERS (current_buffer);
+       XSYMBOL (tail) != XSYMBOL (Qnil);
+       tail = XMARKER (tail)->chain)
+    if (XMARKER (tail)->bufpos == charno)
+      return Qt;
+
+  return Qnil;
+}
 \f
 syms_of_marker ()
 {
@@ -321,4 +348,5 @@ syms_of_marker ()
   defsubr (&Scopy_marker);
   defsubr (&Smarker_insertion_type);
   defsubr (&Sset_marker_insertion_type);
+  defsubr (&Sbuffer_has_markers_at);
 }