/* Simple built-in editing commands.
Copyright (C) 1985, 1993, 1994, 1995, 1996, 1997, 1998, 2001, 2002,
- 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
#include "lisp.h"
#include "commands.h"
#include "buffer.h"
-#include "charset.h"
+#include "character.h"
#include "syntax.h"
#include "window.h"
#include "keyboard.h"
if (new_point < BEGV)
{
SET_PT (BEGV);
- Fsignal (Qbeginning_of_buffer, Qnil);
+ xsignal0 (Qbeginning_of_buffer);
}
if (new_point > ZV)
{
SET_PT (ZV);
- Fsignal (Qend_of_buffer, Qnil);
+ xsignal0 (Qend_of_buffer);
}
SET_PT (new_point);
With argument N not nil or 1, move forward N - 1 lines first.
If point reaches the beginning or end of buffer, it stops there.
-This function does not move point across a field boundary unless that
-would move point to a different line than the original, unconstrained
-result. If N is nil or 1, and a front-sticky field starts at point,
-the point does not move. To ignore field boundaries bind
+This function constrains point to the current field unless this moves
+point to a different line than the original, unconstrained result. If
+N is nil or 1, and a front-sticky field starts at point, the point
+does not move. To ignore field boundaries bind
`inhibit-field-text-motion' to t, or use the `forward-line' function
instead. For instance, `(forward-line 0)' does the same thing as
`(beginning-of-line)', except that it ignores field boundaries. */)
If point reaches the beginning or end of buffer, it stops there.
To ignore intangibility, bind `inhibit-point-motion-hooks' to t.
-This function does not move point across a field boundary unless that
-would move point to a different line than the original, unconstrained
-result. If N is nil or 1, and a rear-sticky field ends at point,
-the point does not move. To ignore field boundaries bind
-`inhibit-field-text-motion' to t. */)
+This function constrains point to the current field unless this moves
+point to a different line than the original, unconstrained result. If
+N is nil or 1, and a rear-sticky field ends at point, the point does
+not move. To ignore field boundaries bind `inhibit-field-text-motion'
+to t. */)
(n)
Lisp_Object n;
{
if (XINT (n) < 0)
{
if (pos < BEGV)
- Fsignal (Qbeginning_of_buffer, Qnil);
+ xsignal0 (Qbeginning_of_buffer);
else
del_range (pos, PT);
}
else
{
if (pos > ZV)
- Fsignal (Qend_of_buffer, Qnil);
+ xsignal0 (Qend_of_buffer);
else
del_range (PT, pos);
}
CHECK_NUMBER (n);
/* Barf if the key that invoked this was not a character. */
- if (!INTEGERP (last_command_char))
+ if (!CHARACTERP (last_command_char))
bitch_at_user ();
{
int character = translate_char (Vtranslation_table_for_input,
- XINT (last_command_char), 0, 0, 0);
+ XINT (last_command_char));
if (XINT (n) >= 2 && NILP (current_buffer->overwrite_mode))
{
int modified_char = character;
/* At first, get multi-byte form of C in STR. */
if (!NILP (current_buffer->enable_multibyte_characters))
{
- c = unibyte_char_to_multibyte (c);
len = CHAR_STRING (c, str);
if (len == 1)
/* If C has modifier bits, this makes C an appropriate
}
hairy = 2;
}
+
+ if (NILP (current_buffer->enable_multibyte_characters))
+ MAKE_CHAR_MULTIBYTE (c);
+ synt = SYNTAX (c);
+
if (!NILP (current_buffer->abbrev_mode)
- && SYNTAX (c) != Sword
+ && synt != Sword
&& NILP (current_buffer->read_only)
- && PT > BEGV && SYNTAX (XFASTINT (Fprevious_char ())) == Sword)
+ && PT > BEGV
+ && (!NILP (current_buffer->enable_multibyte_characters)
+ ? SYNTAX (XFASTINT (Fprevious_char ())) == Sword
+ : (SYNTAX (unibyte_char_to_multibyte (XFASTINT (Fprevious_char ())))
+ == Sword)))
{
int modiff = MODIFF;
Lisp_Object sym;
justification, if any, know where the end is going to be. */
SET_PT_BOTH (PT - 1, PT_BYTE - 1);
tem = call0 (current_buffer->auto_fill_function);
- if (c == '\n')
+ /* Test PT < ZV in case the auto-fill-function is strange. */
+ if (c == '\n' && PT < ZV)
SET_PT_BOTH (PT + 1, PT_BYTE + 1);
if (!NILP (tem))
hairy = 2;
Vself_insert_face = Qnil;
}
- synt = SYNTAX (c);
if ((synt == Sclose || synt == Smath)
&& !NILP (Vblink_paren_function) && INTERACTIVE
&& !noautofill)