Mercurial > emacs
comparison lisp/progmodes/cpp.el @ 11492:2e09c796bf70
(cpp-edit-reset): Fix typo.
(cpp-signal-read-only, cpp-grow-overlay): Update to new calling conventions.
(cpp-make-overlay-hidden): Don't allow insertion before a read-only overlay.
| author | Richard M. Stallman <rms@gnu.org> |
|---|---|
| date | Wed, 19 Apr 1995 06:37:49 +0000 |
| parents | 5865f4bc9521 |
| children | 3e9e8b468bc1 |
comparison
equal
deleted
inserted
replaced
| 11491:272baf4a077a | 11492:2e09c796bf70 |
|---|---|
| 330 ;; Make overlay hidden and intangible. | 330 ;; Make overlay hidden and intangible. |
| 331 (overlay-put overlay 'invisible t) | 331 (overlay-put overlay 'invisible t) |
| 332 (overlay-put overlay 'intangible t) | 332 (overlay-put overlay 'intangible t) |
| 333 ;; Unfortunately `intangible' is not implemented for overlays yet, | 333 ;; Unfortunately `intangible' is not implemented for overlays yet, |
| 334 ;; so we make is read-only instead. | 334 ;; so we make is read-only instead. |
| 335 (overlay-put overlay 'modification-hooks '(cpp-signal-read-only))) | 335 (overlay-put overlay 'modification-hooks '(cpp-signal-read-only)) |
| 336 (overlay-put overlay 'insert-in-front-hooks '(cpp-signal-read-only))) | |
| 336 | 337 |
| 337 (defun cpp-make-overlay-read-only (overlay) | 338 (defun cpp-make-overlay-read-only (overlay) |
| 338 ;; Make overlay read only. | 339 ;; Make overlay read only. |
| 339 (overlay-put overlay 'modification-hooks '(cpp-signal-read-only)) | 340 (overlay-put overlay 'modification-hooks '(cpp-signal-read-only)) |
| 340 (overlay-put overlay 'insert-in-front-hooks '(cpp-signal-read-only)) | 341 (overlay-put overlay 'insert-in-front-hooks '(cpp-signal-read-only)) |
| 343 (defun cpp-make-overlay-sticky (overlay) | 344 (defun cpp-make-overlay-sticky (overlay) |
| 344 ;; Make OVERLAY grow when you insert text at either end. | 345 ;; Make OVERLAY grow when you insert text at either end. |
| 345 (overlay-put overlay 'insert-in-front-hooks '(cpp-grow-overlay)) | 346 (overlay-put overlay 'insert-in-front-hooks '(cpp-grow-overlay)) |
| 346 (overlay-put overlay 'insert-behind-hooks '(cpp-grow-overlay))) | 347 (overlay-put overlay 'insert-behind-hooks '(cpp-grow-overlay))) |
| 347 | 348 |
| 348 (defun cpp-signal-read-only (overlay start end) | 349 (defun cpp-signal-read-only (overlay after start end &optional len) |
| 349 ;; Only allow deleting the whole overlay. | 350 ;; Only allow deleting the whole overlay. |
| 350 ;; Trying to change a read-only overlay. | 351 ;; Trying to change a read-only overlay. |
| 351 (if (or (< (overlay-start overlay) start) | 352 (if (and (not after) |
| 352 (> (overlay-end overlay) end)) | 353 (or (< (overlay-start overlay) start) |
| 354 (> (overlay-end overlay) end))) | |
| 353 (error "This text is read only"))) | 355 (error "This text is read only"))) |
| 354 | 356 |
| 355 (defun cpp-grow-overlay (overlay start end) | 357 (defun cpp-grow-overlay (overlay after start end &optional len) |
| 356 ;; Make OVERLAY grow to contain range START to END. | 358 ;; Make OVERLAY grow to contain range START to END. |
| 357 (move-overlay overlay | 359 (if after |
| 358 (min start (overlay-start overlay)) | 360 (move-overlay overlay |
| 359 (max end (overlay-end overlay)))) | 361 (min start (overlay-start overlay)) |
| 362 (max end (overlay-end overlay))))) | |
| 360 | 363 |
| 361 ;;; Edit Buffer: | 364 ;;; Edit Buffer: |
| 362 | 365 |
| 363 (defvar cpp-edit-map nil) | 366 (defvar cpp-edit-map nil) |
| 364 ;; Keymap for `cpp-edit-mode'. | 367 ;; Keymap for `cpp-edit-mode'. |
| 481 (or (null false) (eq false 'default)) | 484 (or (null false) (eq false 'default)) |
| 482 (eq write 'both)) | 485 (eq write 'both)) |
| 483 (setq cpp-edit-list (delq entry cpp-edit-list) | 486 (setq cpp-edit-list (delq entry cpp-edit-list) |
| 484 entry nil)) | 487 entry nil)) |
| 485 | 488 |
| 486 (if (> (length symbol) 29) | 489 (if (> (length symbol) 39) |
| 487 (insert (substring symbol 0 39) ": ") | 490 (insert (substring symbol 0 39) ": ") |
| 488 (insert (format "%39s: " symbol))) | 491 (insert (format "%39s: " symbol))) |
| 489 | 492 |
| 490 (cpp-make-button (cpp-face-name true) | 493 (cpp-make-button (cpp-face-name true) |
| 491 'cpp-edit-true symbol t 14) | 494 'cpp-edit-true symbol t 14) |
