diff options
| -rw-r--r-- | doc/lispref/display.texi | 23 | ||||
| -rw-r--r-- | etc/NEWS | 2 | ||||
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/htmlfontify.el | 11 | ||||
| -rw-r--r-- | lisp/obsolete/lucid.el | 10 | ||||
| -rw-r--r-- | lisp/ps-def.el | 46 | ||||
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/buffer.c | 11 |
8 files changed, 41 insertions, 76 deletions
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 0246d1a44de..acbef6b9495 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -1475,8 +1475,10 @@ the buffer's undo list. | |||
| 1475 | 1475 | ||
| 1476 | Since more than one overlay can specify a property value for the | 1476 | Since more than one overlay can specify a property value for the |
| 1477 | same character, Emacs lets you specify a priority value of each | 1477 | same character, Emacs lets you specify a priority value of each |
| 1478 | overlay. You should not make assumptions about which overlay will | 1478 | overlay. In case two overlays have the same priority value, and one |
| 1479 | prevail when there is a conflict and they have the same priority. | 1479 | is nested in the other, then the inner one will have priority over the |
| 1480 | outer one. If neither is nested in the other then you should not make | ||
| 1481 | assumptions about which overlay will prevail. | ||
| 1480 | 1482 | ||
| 1481 | These functions read and set the properties of an overlay: | 1483 | These functions read and set the properties of an overlay: |
| 1482 | 1484 | ||
| @@ -1507,9 +1509,9 @@ of them: | |||
| 1507 | @table @code | 1509 | @table @code |
| 1508 | @item priority | 1510 | @item priority |
| 1509 | @kindex priority @r{(overlay property)} | 1511 | @kindex priority @r{(overlay property)} |
| 1510 | This property's value (which should be a non-negative integer) | 1512 | This property's value determines the priority of the overlay. No priority, or |
| 1511 | determines the priority of the overlay. No priority, or @code{nil}, | 1513 | @code{nil}, means zero. A non-nil and non-integer value has |
| 1512 | means zero. | 1514 | undefined behavior. |
| 1513 | 1515 | ||
| 1514 | The priority matters when two or more overlays cover the same | 1516 | The priority matters when two or more overlays cover the same |
| 1515 | character and both specify the same property; the one whose | 1517 | character and both specify the same property; the one whose |
| @@ -1706,11 +1708,12 @@ Properties}. | |||
| 1706 | @node Finding Overlays | 1708 | @node Finding Overlays |
| 1707 | @subsection Searching for Overlays | 1709 | @subsection Searching for Overlays |
| 1708 | 1710 | ||
| 1709 | @defun overlays-at pos | 1711 | @defun overlays-at pos &optional sorted |
| 1710 | This function returns a list of all the overlays that cover the | 1712 | This function returns a list of all the overlays that cover the character at |
| 1711 | character at position @var{pos} in the current buffer. The list is in | 1713 | position @var{pos} in the current buffer. If @var{sorted} is non-nil, the list |
| 1712 | no particular order. An overlay contains position @var{pos} if it | 1714 | is in decreasing order of priority, otherwise it is in no particular order. |
| 1713 | begins at or before @var{pos}, and ends after @var{pos}. | 1715 | An overlay contains position @var{pos} if it begins at or before @var{pos}, and |
| 1716 | ends after @var{pos}. | ||
| 1714 | 1717 | ||
| 1715 | To illustrate usage, here is a Lisp function that returns a list of the | 1718 | To illustrate usage, here is a Lisp function that returns a list of the |
| 1716 | overlays that specify property @var{prop} for the character at point: | 1719 | overlays that specify property @var{prop} for the character at point: |
| @@ -1219,6 +1219,8 @@ treated as regexps rather than literal strings. | |||
| 1219 | 1219 | ||
| 1220 | * Lisp Changes in Emacs 24.4 | 1220 | * Lisp Changes in Emacs 24.4 |
| 1221 | 1221 | ||
| 1222 | ** overlays-at can optionally sort its result by priority. | ||
| 1223 | |||
| 1222 | +++ | 1224 | +++ |
| 1223 | ** The second argument of `eval' can now specify a lexical environment. | 1225 | ** The second argument of `eval' can now specify a lexical environment. |
| 1224 | 1226 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 40690692e88..d8e66425d75 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2014-04-15 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * ps-def.el (ps-generate-postscript-with-faces1): Use the new `sorted' | ||
| 4 | arg of overlays-at. Use `invisible-p'. | ||
| 5 | |||
| 6 | * obsolete/lucid.el (extent-at): | ||
| 7 | * htmlfontify.el (hfy-overlay-props-at): Use the new `sorted' arg of | ||
| 8 | overlays-at. | ||
| 9 | (hfy-fontify-buffer): Remove unused var `orig-ovls'. | ||
| 10 | |||
| 1 | 2014-04-14 João Távora <joaotavora@gmail.com> | 11 | 2014-04-14 João Távora <joaotavora@gmail.com> |
| 2 | 12 | ||
| 3 | * net/shr.el (shr-expand-url): Use `expand-file-name' for relative | 13 | * net/shr.el (shr-expand-url): Use `expand-file-name' for relative |
diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index 1282654899f..56887f39bef 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el | |||
| @@ -1328,9 +1328,7 @@ return a `defface' style list of face properties instead of a face symbol." | |||
| 1328 | (defun hfy-overlay-props-at (p) | 1328 | (defun hfy-overlay-props-at (p) |
| 1329 | "Grab overlay properties at point P. | 1329 | "Grab overlay properties at point P. |
| 1330 | The plists are returned in descending priority order." | 1330 | The plists are returned in descending priority order." |
| 1331 | (sort (mapcar #'overlay-properties (overlays-at p)) | 1331 | (mapcar #'overlay-properties (overlays-at p 'sorted))) |
| 1332 | (lambda (A B) (> (or (cadr (memq 'priority A)) 0) ;FIXME: plist-get? | ||
| 1333 | (or (cadr (memq 'priority B)) 0))))) | ||
| 1334 | 1332 | ||
| 1335 | ;; construct an assoc of (face-name . (css-name . "{ css-style }")) elements: | 1333 | ;; construct an assoc of (face-name . (css-name . "{ css-style }")) elements: |
| 1336 | (defun hfy-compile-stylesheet () | 1334 | (defun hfy-compile-stylesheet () |
| @@ -1642,7 +1640,6 @@ FILE, if set, is the file name." | |||
| 1642 | (css-map nil) | 1640 | (css-map nil) |
| 1643 | (invis-ranges nil) | 1641 | (invis-ranges nil) |
| 1644 | (rovl nil) | 1642 | (rovl nil) |
| 1645 | (orig-ovls (overlays-in (point-min) (point-max))) | ||
| 1646 | (rmin (when mark-active (region-beginning))) | 1643 | (rmin (when mark-active (region-beginning))) |
| 1647 | (rmax (when mark-active (region-end ))) ) | 1644 | (rmax (when mark-active (region-end ))) ) |
| 1648 | (when (and mark-active | 1645 | (when (and mark-active |
| @@ -1664,12 +1661,6 @@ FILE, if set, is the file name." | |||
| 1664 | (set-buffer html-buffer) | 1661 | (set-buffer html-buffer) |
| 1665 | ;; rip out props that could interfere with our htmlization of the buffer: | 1662 | ;; rip out props that could interfere with our htmlization of the buffer: |
| 1666 | (remove-text-properties (point-min) (point-max) hfy-ignored-properties) | 1663 | (remove-text-properties (point-min) (point-max) hfy-ignored-properties) |
| 1667 | ;; Apply overlay invisible spec | ||
| 1668 | (setq orig-ovls | ||
| 1669 | (sort orig-ovls | ||
| 1670 | (lambda (A B) | ||
| 1671 | (> (or (cadr (memq 'priority (overlay-properties A))) 0) | ||
| 1672 | (or (cadr (memq 'priority (overlay-properties B))) 0))))) | ||
| 1673 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 1664 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 1674 | ;; at this point, html-buffer retains the fontification of the parent: | 1665 | ;; at this point, html-buffer retains the fontification of the parent: |
| 1675 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 1666 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
diff --git a/lisp/obsolete/lucid.el b/lisp/obsolete/lucid.el index d3cb3f135d8..15f80652809 100644 --- a/lisp/obsolete/lucid.el +++ b/lisp/obsolete/lucid.el | |||
| @@ -125,7 +125,7 @@ This is an XEmacs compatibility function." | |||
| 125 | 125 | ||
| 126 | (defun extent-at (pos &optional object property before) | 126 | (defun extent-at (pos &optional object property before) |
| 127 | (with-current-buffer (or object (current-buffer)) | 127 | (with-current-buffer (or object (current-buffer)) |
| 128 | (let ((overlays (overlays-at pos))) | 128 | (let ((overlays (overlays-at pos 'sorted))) |
| 129 | (when property | 129 | (when property |
| 130 | (let (filtered) | 130 | (let (filtered) |
| 131 | (while overlays | 131 | (while overlays |
| @@ -133,14 +133,6 @@ This is an XEmacs compatibility function." | |||
| 133 | (setq filtered (cons (car overlays) filtered))) | 133 | (setq filtered (cons (car overlays) filtered))) |
| 134 | (setq overlays (cdr overlays))) | 134 | (setq overlays (cdr overlays))) |
| 135 | (setq overlays filtered))) | 135 | (setq overlays filtered))) |
| 136 | (setq overlays | ||
| 137 | (sort overlays | ||
| 138 | (function (lambda (o1 o2) | ||
| 139 | (let ((p1 (or (overlay-get o1 'priority) 0)) | ||
| 140 | (p2 (or (overlay-get o2 'priority) 0))) | ||
| 141 | (or (> p1 p2) | ||
| 142 | (and (= p1 p2) | ||
| 143 | (> (overlay-start o1) (overlay-start o2))))))))) | ||
| 144 | (if before | 136 | (if before |
| 145 | (nth 1 (memq before overlays)) | 137 | (nth 1 (memq before overlays)) |
| 146 | (car overlays))))) | 138 | (car overlays))))) |
diff --git a/lisp/ps-def.el b/lisp/ps-def.el index 06cef75cbbd..92a2e0b38cd 100644 --- a/lisp/ps-def.el +++ b/lisp/ps-def.el | |||
| @@ -339,53 +339,11 @@ | |||
| 339 | (setq position (min property-change overlay-change) | 339 | (setq position (min property-change overlay-change) |
| 340 | before-string nil | 340 | before-string nil |
| 341 | after-string nil) | 341 | after-string nil) |
| 342 | ;; The code below is not quite correct, | ||
| 343 | ;; because a non-nil overlay invisible property | ||
| 344 | ;; which is inactive according to the current value | ||
| 345 | ;; of buffer-invisibility-spec nonetheless overrides | ||
| 346 | ;; a face text property. | ||
| 347 | (setq face | 342 | (setq face |
| 348 | (cond ((let ((prop (get-text-property from 'invisible))) | 343 | (cond ((invisible-p from) |
| 349 | ;; Decide whether this invisible property | ||
| 350 | ;; really makes the text invisible. | ||
| 351 | (if (eq save-buffer-invisibility-spec t) | ||
| 352 | (not (null prop)) | ||
| 353 | (or (memq prop save-buffer-invisibility-spec) | ||
| 354 | (assq prop save-buffer-invisibility-spec)))) | ||
| 355 | 'emacs--invisible--face) | 344 | 'emacs--invisible--face) |
| 356 | ((get-text-property from 'face)) | 345 | ((get-char-property from 'face)) |
| 357 | (t 'default))) | 346 | (t 'default))) |
| 358 | (let ((overlays (overlays-at from)) | ||
| 359 | (face-priority -1)) ; text-property | ||
| 360 | (while (and overlays | ||
| 361 | (not (eq face 'emacs--invisible--face))) | ||
| 362 | (let* ((overlay (car overlays)) | ||
| 363 | (overlay-invisible | ||
| 364 | (overlay-get overlay 'invisible)) | ||
| 365 | (overlay-priority | ||
| 366 | (or (overlay-get overlay 'priority) 0))) | ||
| 367 | (and (> overlay-priority face-priority) | ||
| 368 | (setq before-string | ||
| 369 | (or (overlay-get overlay 'before-string) | ||
| 370 | before-string) | ||
| 371 | after-string | ||
| 372 | (or (and (<= (overlay-end overlay) position) | ||
| 373 | (overlay-get overlay 'after-string)) | ||
| 374 | after-string) | ||
| 375 | face-priority overlay-priority | ||
| 376 | face | ||
| 377 | (cond | ||
| 378 | ((if (eq save-buffer-invisibility-spec t) | ||
| 379 | (not (null overlay-invisible)) | ||
| 380 | (or (memq overlay-invisible | ||
| 381 | save-buffer-invisibility-spec) | ||
| 382 | (assq overlay-invisible | ||
| 383 | save-buffer-invisibility-spec))) | ||
| 384 | 'emacs--invisible--face) | ||
| 385 | ((overlay-get overlay 'face)) | ||
| 386 | (t face) | ||
| 387 | )))) | ||
| 388 | (setq overlays (cdr overlays)))) | ||
| 389 | ;; Plot up to this record. | 347 | ;; Plot up to this record. |
| 390 | (and before-string | 348 | (and before-string |
| 391 | (ps-plot-string before-string)) | 349 | (ps-plot-string before-string)) |
diff --git a/src/ChangeLog b/src/ChangeLog index 6b6bd06634a..51861c6ca7d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2014-04-15 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * buffer.c (Foverlays_at): Add argument `sorted'. | ||
| 4 | |||
| 1 | 2014-04-14 Eli Zaretskii <eliz@gnu.org> | 5 | 2014-04-14 Eli Zaretskii <eliz@gnu.org> |
| 2 | 6 | ||
| 3 | * insdel.c (invalidate_buffer_caches): When deleting or replacing | 7 | * insdel.c (invalidate_buffer_caches): When deleting or replacing |
diff --git a/src/buffer.c b/src/buffer.c index a1678951984..3e1359707cd 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -4168,9 +4168,10 @@ OVERLAY. */) | |||
| 4168 | } | 4168 | } |
| 4169 | 4169 | ||
| 4170 | 4170 | ||
| 4171 | DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0, | 4171 | DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 2, 0, |
| 4172 | doc: /* Return a list of the overlays that contain the character at POS. */) | 4172 | doc: /* Return a list of the overlays that contain the character at POS. |
| 4173 | (Lisp_Object pos) | 4173 | If SORTED is non-nil, then sort them by decreasing priority. */) |
| 4174 | (Lisp_Object pos, Lisp_Object sorted) | ||
| 4174 | { | 4175 | { |
| 4175 | ptrdiff_t len, noverlays; | 4176 | ptrdiff_t len, noverlays; |
| 4176 | Lisp_Object *overlay_vec; | 4177 | Lisp_Object *overlay_vec; |
| @@ -4190,6 +4191,10 @@ DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0, | |||
| 4190 | noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, | 4191 | noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, |
| 4191 | NULL, NULL, 0); | 4192 | NULL, NULL, 0); |
| 4192 | 4193 | ||
| 4194 | if (!NILP (sorted)) | ||
| 4195 | noverlays = sort_overlays (overlay_vec, noverlays, | ||
| 4196 | WINDOWP (sorted) ? XWINDOW (sorted) : NULL); | ||
| 4197 | |||
| 4193 | /* Make a list of them all. */ | 4198 | /* Make a list of them all. */ |
| 4194 | result = Flist (noverlays, overlay_vec); | 4199 | result = Flist (noverlays, overlay_vec); |
| 4195 | 4200 | ||