Next: , Previous: , Up: Miscellaneous  


Q5.3.7: Can I have the end of the buffer delimited in some way?

Say, with: ‘[END]’?

Try this:

(let ((ext (make-extent (point-min) (point-max))))
  (set-extent-property ext 'start-closed t)
  (set-extent-property ext 'end-closed t)
  (set-extent-property ext 'detachable nil)
  (set-extent-end-glyph ext (make-glyph [string :data "[END]"])))

Since this is SXEmacs, you can specify an icon to be shown on window-system devices. To do so, change the make-glyph call to something like this:

(make-glyph '([xpm :file "~/something.xpm"]
              [string :data "[END]"]))

You can inline the XPM definition yourself by specifying :data instead of :file. Here is such a full-featured version that works on both X and TTY devices:

(let ((ext (make-extent (point-min) (point-max))))
  (set-extent-property ext 'start-closed t)
  (set-extent-property ext 'end-closed t)
  (set-extent-property ext 'detachable nil)
  (set-extent-end-glyph ext (make-glyph '([xpm :data "\
/* XPM */
static char* eye = {
\"20 11 7 2\",
\"__ c None\"
\"_` c #7f7f7f\",
\"_a c #fefefe\",
\"_b c #7f0000\",
\"_c c #fefe00\",
\"_d c #fe0000\",
\"_e c #bfbfbf\",
\"___________`_`_`___b_b_b_b_________`____\",
\"_________`_`_`___b_c_c_c_b_b____________\",
\"_____`_`_`_e___b_b_c_c_c___b___b_______`\",
\"___`_`_e_a___b_b_d___b___b___b___b______\",
\"_`_`_e_a_e___b_b_d_b___b___b___b___b____\",
\"_`_`_a_e_a___b_b_d___b___b___b___b___b__\",
\"_`_`_e_a_e___b_b_d_b___b___b___b___b_b__\",
\"___`_`_e_a___b_b_b_d_c___b___b___d_b____\",
\"_____`_`_e_e___b_b_b_d_c___b_b_d_b______\",
\"_`_____`_`_`_`___b_b_b_d_d_d_d_b________\",
\"___`_____`_`_`_`___b_b_b_b_b_b__________\",
} ;"]
                                          [string :data "[END]"]))))

Note that you might want to make this a function, and put it to a hook. We leave that as an exercise for the reader.