summaryrefslogtreecommitdiff
path: root/src/editfns.c
diff options
context:
space:
mode:
authorVitalie Spinu <spinuvit@gmail.com>2016-03-21 05:41:55 +0100
committerVitalie Spinu <spinuvit@gmail.com>2016-03-22 03:16:17 +0100
commitc331b6626a427fb89303fea75faebd8c39d343a8 (patch)
treef5cf4ee74164ed2b9fe2037d764be441e4b67175 /src/editfns.c
parent91e667692ba1362ca1334b8d58fd16c305ad5e2a (diff)
downloademacs-scratch/widen-limits.tar.gz
Implement buffer-widen-limits functionalitywiden-limitsscratch/widen-limits
`widen` now respects restrictions imposed by new variable `hard-widen-limits`
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 2ac0537eddb..e5ab637aba1 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3480,12 +3480,25 @@ DEFUN ("delete-and-extract-region", Fdelete_and_extract_region,
return empty_unibyte_string;
return del_range_1 (XINT (start), XINT (end), 1, 1);
}
+
DEFUN ("widen", Fwiden, Swiden, 0, 0, "",
doc: /* Remove restrictions (narrowing) from current buffer.
-This allows the buffer's full text to be seen and edited. */)
+This allows the buffer's full text to be seen and edited.
+If `buffer-widen-limits` is non-nil, widen only to those limits. */)
(void)
{
+
+ if (!NILP (BVAR(current_buffer, widen_limits)))
+ {
+ Lisp_Object hl = BVAR(current_buffer, widen_limits);
+ CHECK_CONS(hl);
+ CHECK_NUMBER(XCAR(hl));
+ CHECK_NUMBER(XCDR(hl));
+ Fnarrow_to_region(XCAR(hl), XCDR(hl));
+ return Qnil;
+ }
+
if (BEG != BEGV || Z != ZV)
current_buffer->clip_changed = 1;
BEGV = BEG;