Previous: , Up: Narrowing & Widening   [Contents][Index]


6.3 Exercise with Narrowing

Write a function that will display the first 60 characters of the current buffer, even if you have narrowed the buffer to its latter half so that the first line is inaccessible. Restore point, mark, and narrowing. For this exercise, you need to use a whole potpourri of functions, including save-restriction, widen, goto-char, point-min, message, and buffer-substring.

(buffer-substring is a previously unmentioned function you will have to investigate yourself; or perhaps you will have to use buffer-substring-no-properties or filter-buffer-substring …, yet other functions. Text properties are a feature otherwise not discussed here. See Text Properties in The GNU Emacs Lisp Reference Manual.)

Additionally, do you really need goto-char or point-min? Or can you write the function without them?

This page has generated for branch:work/add_lispintr, commit:65845cf60c073f2f3182d1d07483530e9bbe1d96 to check Japanese translation.