I have advised the narrow and widen functions so that the fringe color indicates if narrowing is active:
(advice-add 'narrow-to-region :after '(lambda (&rest args) (set-face-attribute 'fringe nil :background my-fringe-narrow-bg))) (advice-add 'widen :after '(lambda (&rest args) (set-face-attribute 'fringe nil :background (face-attribute 'default :background))))
This works very well. However, sometimes the fringe gets colored by my advice while I did not call any narrowing function. One example is
'org-table-sort-lines: it calls
'narrow-to-region within a
'save-restriction block but does not call
'widen afterwards, of course.
So, how can I find out if
'narrow-to-region have been called from within
EDIT: Something like this would help as well:
(advice-add 'save-restriction :before '(lambda (&rest args) (ad-deactivate 'narrow-to-region))) (advice-add 'save-restriction :after '(lambda (&rest args) (ad-activate 'narrow-to-region)))
However this doesn't work, I get the error:
advice--normalize: Advice impossible: save-restriction is a special form.