Ar an ceathrú lá de mí Lúnasa, scríobh Uwe Brauer:
[..] Another point, as the function is now, only a warning is
released
when more that 155 chars a typed. Is there any possibility that (X)Emacs
would just refuse any more char. (I thought of using the error Funktion
but even then I can continue typing.)
(defvar sms-buffer-max-length 155
"How long the buffer can be before we stop accepting input. ")
(defun truncate-buffer-to-sms-max ()
"Remove input in the buffer making it longer than
`sms-buffer-max-length'"
(when (> (point-max) (1+ sms-buffer-max-length))
(delete-region (1+ sms-buffer-max-length) (point-max))))
;; You want to add a check that the buffer in question is one you want to
;; truncate to truncate-buffer-to-sms-max before doing this, otherwise every
;; buffer you type a command in will be truncated.
;; (add-hook 'post-command-hook 'truncate-buffer-to-sms-max)
--
Santa Maradona, priez pour moi!