diff options
| author | Richard M. Stallman | 1995-11-27 05:47:49 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-11-27 05:47:49 +0000 |
| commit | 17ef035379818c495077d6a42a87f56754523f49 (patch) | |
| tree | 83d59607dc412c71a5dd0835cdad19142ca70b95 | |
| parent | 3c7d31b921c1f532f0c2ff6b97a1cb9c93617dbf (diff) | |
| download | emacs-17ef035379818c495077d6a42a87f56754523f49.tar.gz emacs-17ef035379818c495077d6a42a87f56754523f49.zip | |
(apropos-follow): Rewrite to use whole line as target of reference.
(apropos-mouse-follow): Do save-excursion.
Error if not adjacent to a mouse-face property.
| -rw-r--r-- | lisp/apropos.el | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/lisp/apropos.el b/lisp/apropos.el index e220b928926..3d20b6e2981 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el | |||
| @@ -514,33 +514,36 @@ found." | |||
| 514 | (let ((other (if (eq (current-buffer) (get-buffer "*Help*")) | 514 | (let ((other (if (eq (current-buffer) (get-buffer "*Help*")) |
| 515 | () | 515 | () |
| 516 | (current-buffer)))) | 516 | (current-buffer)))) |
| 517 | (set-buffer (window-buffer (posn-window (event-start event)))) | 517 | (save-excursion |
| 518 | (goto-char (posn-point (event-start event))) | 518 | (set-buffer (window-buffer (posn-window (event-start event)))) |
| 519 | ;; somehow when clicking with the point in another window, undoes badly | 519 | (goto-char (posn-point (event-start event))) |
| 520 | (undo-boundary) | 520 | (or (and (not (eobp)) (get-text-property (point) 'mouse-face)) |
| 521 | (apropos-follow other))) | 521 | (and (not (bobp)) (get-text-property (1- (point)) 'mouse-face)) |
| 522 | (error "There is nothing to follow here")) | ||
| 523 | ;; somehow when clicking with the point in another window, undoes badly | ||
| 524 | (undo-boundary) | ||
| 525 | (apropos-follow other)))) | ||
| 522 | 526 | ||
| 523 | 527 | ||
| 524 | (defun apropos-follow (&optional other) | 528 | (defun apropos-follow (&optional other) |
| 525 | (interactive) | 529 | (interactive) |
| 526 | (let ((point (point)) | 530 | (let* (;; Properties are always found at the beginning of the line. |
| 527 | (item | 531 | (bol (save-excursion (beginning-of-line) (point))) |
| 528 | (or (and (not (eobp)) (get-text-property (point) 'item)) | 532 | ;; If there is no `item' property here, look behind us. |
| 529 | (and (not (bobp)) (get-text-property (1- (point)) 'item)))) | 533 | (item (get-text-property bol 'item)) |
| 530 | action action-point) | 534 | (item-at (if item nil (previous-single-property-change bol 'item))) |
| 531 | (if (null item) | 535 | ;; Likewise, if there is no `action' property here, look in front. |
| 536 | (action (get-text-property bol 'action)) | ||
| 537 | (action-at (if action nil (next-single-property-change bol 'action)))) | ||
| 538 | (and (null item) item-at | ||
| 539 | (setq item (get-text-property (1- item-at) 'item))) | ||
| 540 | (and (null action) action-at | ||
| 541 | (setq action (get-text-property action-at 'action))) | ||
| 542 | (if (not (and item action)) | ||
| 532 | (error "There is nothing to follow here")) | 543 | (error "There is nothing to follow here")) |
| 533 | (if (consp item) | 544 | (if (consp item) (error "There is nothing to follow in `%s'" (car item))) |
| 534 | (error "There is nothing to follow in `%s'" (car item))) | 545 | (if other (set-buffer other)) |
| 535 | (while (if (setq action-point | 546 | (funcall action item))) |
| 536 | (next-single-property-change (point) 'action)) | ||
| 537 | (<= action-point point)) | ||
| 538 | (goto-char (1+ action-point)) | ||
| 539 | (setq action action-point)) | ||
| 540 | (funcall | ||
| 541 | (prog1 (get-text-property (or action action-point (point)) 'action) | ||
| 542 | (if other (set-buffer other))) | ||
| 543 | item))) | ||
| 544 | 547 | ||
| 545 | 548 | ||
| 546 | 549 | ||