summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien <bzg@gnu.org>2020-02-17 13:59:19 +0100
committerBastien <bzg@gnu.org>2020-02-17 13:59:19 +0100
commit055742562c50d37df0aff92f74864da8b790df95 (patch)
tree393f8a0df9126bb580fdf9e90c089a2937936c60
parent5dd7721242316a0fd63bcdcda2ec073d0821ab3f (diff)
downloadorg-mode-055742562c50d37df0aff92f74864da8b790df95.tar.gz
org-colview.el: Allow text rescaling
* lisp/org-colview.el (org-columns-header-line-remap): New variable. (org-columns--display-here): Don't rigidly inherit the :height from the default face, allow text-scale-* to also rescale the temporary column view header-line. (org-columns-remove-overlays): If `org-columns-header-line-remap' is non-nil, remove the header-line face relative remapping. * etc/ORG-NEWS (Allow text rescaling in column view): Document the ability to scale text in column view. Thanks to Marco Wahl for this suggestion.
-rw-r--r--etc/ORG-NEWS5
-rw-r--r--lisp/org-colview.el15
2 files changed, 18 insertions, 2 deletions
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 2b52d78..b6ee443 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -111,6 +111,11 @@ option ~org-display-remote-inline-images~.
`k' option, but the user specifies a time of day, not a number of
minutes.
+*** Allow text rescaling in column view
+
+You can now use =C-x C-+= in column view: the columns face size will
+increase or decrease, together with the column header size.
+
*** =ob-clojure.el= supports inf-clojure.el and ClojureScript evaluation
You can now set ~(setq org-babel-clojure-backend 'inf-clojure)~ and
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index bb24443..4170486 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -44,6 +44,8 @@
(declare-function org-dynamic-block-define "org" (type func))
(declare-function org-link-display-format "ol" (s))
(declare-function org-link-open-from-string "ol" (s &optional arg))
+(declare-function face-remap-remove-relative "face-remap" (cookie))
+(declare-function face-remap-add-relative "face-remap" (face &rest specs))
(defvar org-agenda-columns-add-appointments-to-effort-sum)
(defvar org-agenda-columns-compute-summary-properties)
@@ -364,11 +366,18 @@ ORIGINAL is the real string, i.e., before it is modified by
("TODO" (propertize v 'face (org-get-todo-face original)))
(_ v)))))
+(defvar org-columns-header-line-remap nil
+ "Store the relative remapping of column header-line.
+This is needed to later remove this relative remapping.")
+
(defun org-columns--display-here (columns &optional dateline)
"Overlay the current line with column display.
COLUMNS is an alist (SPEC VALUE DISPLAYED). Optional argument
DATELINE is non-nil when the face used should be
`org-agenda-column-dateline'."
+ (when (ignore-errors (require 'face-remap))
+ (setq org-columns-header-line-remap
+ (face-remap-add-relative 'header-line '(:inherit default))))
(save-excursion
(beginning-of-line)
(let* ((level-face (and (looking-at "\\(\\**\\)\\(\\* \\)")
@@ -378,8 +387,7 @@ DATELINE is non-nil when the face used should be
(org-get-at-bol 'face))
'default))
(color (list :foreground (face-attribute ref-face :foreground)))
- (font (list :height (face-attribute 'default :height)
- :family (face-attribute 'default :family)))
+ (font (list :family (face-attribute 'default :family)))
(face (list color font 'org-column ref-face))
(face1 (list color font 'org-agenda-column-dateline ref-face)))
;; Each column is an overlay on top of a character. So there has
@@ -502,6 +510,9 @@ for the duration of the command.")
(defun org-columns-remove-overlays ()
"Remove all currently active column overlays."
(interactive)
+ (when (and (fboundp 'face-remap-remove-relative)
+ org-columns-header-line-remap)
+ (face-remap-remove-relative org-columns-header-line-remap))
(when org-columns-overlays
(when (local-variable-p 'org-previous-header-line-format)
(setq header-line-format org-previous-header-line-format)