summaryrefslogtreecommitdiff
path: root/src/marker.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/marker.c')
-rw-r--r--src/marker.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/marker.c b/src/marker.c
index 377f6fbe8db..2abc951fc76 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -20,6 +20,11 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
+/* Work around GCC bug 113253. */
+#if __GNUC__ == 13
+# pragma GCC diagnostic ignored "-Wanalyzer-deref-before-check"
+#endif
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
@@ -458,6 +463,18 @@ DEFUN ("marker-position", Fmarker_position, Smarker_position, 1, 1, 0,
return Qnil;
}
+DEFUN ("marker-last-position", Fmarker_last_position, Smarker_last_position, 1, 1, 0,
+ doc: /* Return last position of MARKER in its buffer.
+This is like `marker-position' with one exception: If the buffer of
+MARKER is dead, it returns the last position of MARKER in that buffer
+before it was killed. */)
+ (Lisp_Object marker)
+{
+ CHECK_MARKER (marker);
+
+ return make_fixnum (XMARKER (marker)->charpos);
+}
+
/* Change M so it points to B at CHARPOS and BYTEPOS. */
static void
@@ -825,6 +842,7 @@ void
syms_of_marker (void)
{
defsubr (&Smarker_position);
+ defsubr (&Smarker_last_position);
defsubr (&Smarker_buffer);
defsubr (&Sset_marker);
defsubr (&Scopy_marker);