2012-10-26 17:07:35 +00:00
|
|
|
|
;;; face-remap.el --- Functions for managing `face-remapping-alist' -*- lexical-binding: t -*-
|
2008-06-03 11:05:52 +00:00
|
|
|
|
;;
|
2024-01-02 01:47:10 +00:00
|
|
|
|
;; Copyright (C) 2008-2024 Free Software Foundation, Inc.
|
2008-06-03 11:05:52 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Author: Miles Bader <miles@gnu.org>
|
2010-03-14 21:15:02 +00:00
|
|
|
|
;; Keywords: faces, face remapping, display, user commands
|
2008-06-03 11:05:52 +00:00
|
|
|
|
;;
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
;;
|
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
;;
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
;;
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 22:52:52 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2008-06-03 11:05:52 +00:00
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;; This file defines some simple operations that can be used for
|
|
|
|
|
;; maintaining the `face-remapping-alist' in a cooperative way. This is
|
|
|
|
|
;; especially important for the `default' face.
|
|
|
|
|
;;
|
|
|
|
|
;; Each face-remapping definition in `face-remapping-alist' added by
|
|
|
|
|
;; this code uses the form:
|
|
|
|
|
;;
|
|
|
|
|
;; (face RELATIVE_SPECS_1 RELATIVE_SPECS_2 ... BASE_SPECS)
|
|
|
|
|
;;
|
2020-12-19 18:54:11 +00:00
|
|
|
|
;; The "specs" values are lists of face names or face attribute-value
|
2008-06-03 11:05:52 +00:00
|
|
|
|
;; pairs, and are merged together, with earlier values taking precedence.
|
|
|
|
|
;;
|
2008-06-05 02:42:55 +00:00
|
|
|
|
;; The RELATIVE_SPECS_* values are added by `face-remap-add-relative'
|
|
|
|
|
;; (and removed by `face-remap-remove-relative', and are intended for
|
2008-06-03 11:05:52 +00:00
|
|
|
|
;; face "modifications" (such as increasing the size). Typical users of
|
|
|
|
|
;; relative specs would be minor modes.
|
|
|
|
|
;;
|
|
|
|
|
;; BASE_SPECS is the lowest-priority value, and by default is just the
|
|
|
|
|
;; face name, which causes the global definition of that face to be used.
|
|
|
|
|
;;
|
|
|
|
|
;; A non-default value of BASE_SPECS may also be set using
|
2008-06-05 02:42:55 +00:00
|
|
|
|
;; `face-remap-set-base'. Because this _overwrites_ the default
|
2008-06-03 11:05:52 +00:00
|
|
|
|
;; value inheriting from the global face definition, it is up to the
|
2008-06-05 02:42:55 +00:00
|
|
|
|
;; caller of face-remap-set-base to add such inheritance if it is
|
|
|
|
|
;; desired. A typical use of face-remap-set-base would be a major
|
2008-06-03 11:05:52 +00:00
|
|
|
|
;; mode setting face remappings, e.g., of the default face.
|
|
|
|
|
;;
|
|
|
|
|
;; All modifications cause face-remapping-alist to be made buffer-local.
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; ----------------------------------------------------------------
|
|
|
|
|
;; Utility functions
|
|
|
|
|
|
2008-06-17 11:27:36 +00:00
|
|
|
|
;; Names of face attributes corresponding to lisp face-vector positions.
|
|
|
|
|
;; This variable should probably be defined in C code where the actual
|
|
|
|
|
;; definitions are available.
|
2019-10-20 13:54:18 +00:00
|
|
|
|
;; :vector must be always at the end as a guard
|
2008-06-17 11:27:36 +00:00
|
|
|
|
;;
|
|
|
|
|
(defvar internal-lisp-face-attributes
|
|
|
|
|
[nil
|
2019-10-20 13:54:18 +00:00
|
|
|
|
:family :foundry :width :height :weight :slant :underline
|
|
|
|
|
:inverse-video
|
|
|
|
|
:foreground :background :stipple :overline :strike-through :box
|
|
|
|
|
:font :inherit :fontset :distant-foreground :extend :vector])
|
2008-06-17 11:27:36 +00:00
|
|
|
|
|
2022-01-20 13:42:31 +00:00
|
|
|
|
(defun face-attrs--make-indirect-safe ()
|
2022-01-20 17:18:54 +00:00
|
|
|
|
"Deep-copy the buffer's `face-remapping-alist' upon cloning the buffer."
|
2022-01-20 13:42:31 +00:00
|
|
|
|
(setq-local face-remapping-alist
|
2023-08-17 07:51:36 +00:00
|
|
|
|
(mapcar #'copy-tree face-remapping-alist)))
|
2022-01-20 13:42:31 +00:00
|
|
|
|
|
|
|
|
|
(add-hook 'clone-indirect-buffer-hook #'face-attrs--make-indirect-safe)
|
|
|
|
|
|
2008-06-17 11:27:36 +00:00
|
|
|
|
(defun face-attrs-more-relative-p (attrs1 attrs2)
|
2022-02-17 13:37:24 +00:00
|
|
|
|
"Return non-nil if ATTRS1 is \"more relative\" than ATTRS2.
|
|
|
|
|
We define this as meaning that ATTRS1 contains a greater number of
|
|
|
|
|
relative face-attributes than ATTRS2. A face attribute is considered
|
2008-06-17 11:27:36 +00:00
|
|
|
|
relative if `face-attribute-relative-p' returns non-nil.
|
|
|
|
|
|
|
|
|
|
ATTRS1 and ATTRS2 may be any value suitable for a `face' text
|
|
|
|
|
property, including face names, lists of face names,
|
|
|
|
|
face-attribute plists, etc.
|
|
|
|
|
|
|
|
|
|
This function can be used as a predicate with `sort', to sort
|
|
|
|
|
face lists so that more specific faces are located near the end."
|
|
|
|
|
(unless (vectorp attrs1)
|
|
|
|
|
(setq attrs1 (face-attributes-as-vector attrs1)))
|
|
|
|
|
(unless (vectorp attrs2)
|
|
|
|
|
(setq attrs2 (face-attributes-as-vector attrs2)))
|
|
|
|
|
(let ((rel1-count 0) (rel2-count 0))
|
|
|
|
|
(dotimes (i (length attrs1))
|
|
|
|
|
(let ((attr (aref internal-lisp-face-attributes i)))
|
|
|
|
|
(when attr
|
|
|
|
|
(when (face-attribute-relative-p attr (aref attrs1 i))
|
|
|
|
|
(setq rel1-count (+ rel1-count 1)))
|
|
|
|
|
(when (face-attribute-relative-p attr (aref attrs2 i))
|
|
|
|
|
(setq rel2-count (+ rel2-count 1))))))
|
|
|
|
|
(< rel1-count rel2-count)))
|
|
|
|
|
|
|
|
|
|
(defun face-remap-order (entry)
|
|
|
|
|
"Order ENTRY so that more relative face specs are near the beginning.
|
|
|
|
|
The list structure of ENTRY may be destructively modified."
|
|
|
|
|
(setq entry (nreverse entry))
|
2022-02-17 13:37:24 +00:00
|
|
|
|
(setcdr entry (sort (cdr entry) #'face-attrs-more-relative-p))
|
2008-06-17 11:27:36 +00:00
|
|
|
|
(nreverse entry))
|
|
|
|
|
|
2008-06-21 06:51:23 +00:00
|
|
|
|
;;;###autoload
|
2008-06-05 02:42:55 +00:00
|
|
|
|
(defun face-remap-add-relative (face &rest specs)
|
2008-06-03 11:05:52 +00:00
|
|
|
|
"Add a face remapping entry of FACE to SPECS in the current buffer.
|
2012-03-21 07:02:13 +00:00
|
|
|
|
Return a cookie which can be used to delete this remapping with
|
2008-06-05 02:42:55 +00:00
|
|
|
|
`face-remap-remove-relative'.
|
2008-06-03 11:05:52 +00:00
|
|
|
|
|
2012-06-09 06:26:46 +00:00
|
|
|
|
The remaining arguments, SPECS, should form a list of faces.
|
|
|
|
|
Each list element should be either a face name or a property list
|
|
|
|
|
of face attribute/value pairs. If more than one face is listed,
|
|
|
|
|
that specifies an aggregate face, in the same way as in a `face'
|
|
|
|
|
text property, except for possible priority changes noted below.
|
|
|
|
|
|
|
|
|
|
The face remapping specified by SPECS takes effect alongside the
|
|
|
|
|
remappings from other calls to `face-remap-add-relative' for the
|
|
|
|
|
same FACE, as well as the normal definition of FACE (at lowest
|
|
|
|
|
priority). This function tries to sort multiple remappings for
|
|
|
|
|
the same face, so that remappings specifying relative face
|
|
|
|
|
attributes are applied after remappings specifying absolute face
|
|
|
|
|
attributes.
|
2012-03-21 07:02:13 +00:00
|
|
|
|
|
|
|
|
|
The base (lowest priority) remapping may be set to something
|
|
|
|
|
other than the normal definition of FACE via `face-remap-set-base'."
|
2008-06-20 08:55:22 +00:00
|
|
|
|
(while (and (consp specs) (null (cdr specs)))
|
|
|
|
|
(setq specs (car specs)))
|
2008-06-03 11:05:52 +00:00
|
|
|
|
(make-local-variable 'face-remapping-alist)
|
|
|
|
|
(let ((entry (assq face face-remapping-alist)))
|
|
|
|
|
(when (null entry)
|
|
|
|
|
(setq entry (list face face)) ; explicitly merge with global def
|
|
|
|
|
(push entry face-remapping-alist))
|
2012-10-29 09:55:57 +00:00
|
|
|
|
(let ((faces (cdr entry)))
|
|
|
|
|
(if (symbolp faces)
|
|
|
|
|
(setq faces (list faces)))
|
2014-02-10 16:08:37 +00:00
|
|
|
|
(setcdr entry (face-remap-order (cons specs faces)))
|
|
|
|
|
;; Force redisplay of this buffer.
|
|
|
|
|
(force-mode-line-update))
|
2008-06-03 11:05:52 +00:00
|
|
|
|
(cons face specs)))
|
|
|
|
|
|
2008-06-05 02:42:55 +00:00
|
|
|
|
(defun face-remap-remove-relative (cookie)
|
|
|
|
|
"Remove a face remapping previously added by `face-remap-add-relative'.
|
2008-06-03 11:05:52 +00:00
|
|
|
|
COOKIE should be the return value from that function."
|
|
|
|
|
(let ((remapping (assq (car cookie) face-remapping-alist)))
|
|
|
|
|
(when remapping
|
|
|
|
|
(let ((updated-entries (remq (cdr cookie) (cdr remapping))))
|
|
|
|
|
(unless (eq updated-entries (cdr remapping))
|
|
|
|
|
(setcdr remapping updated-entries)
|
|
|
|
|
(when (or (null updated-entries)
|
|
|
|
|
(and (eq (car-safe updated-entries) (car cookie))
|
|
|
|
|
(null (cdr updated-entries))))
|
|
|
|
|
(setq face-remapping-alist
|
2014-02-10 16:08:37 +00:00
|
|
|
|
(remq remapping face-remapping-alist))
|
|
|
|
|
;; Force redisplay of this buffer.
|
|
|
|
|
(force-mode-line-update))
|
2008-06-03 11:05:52 +00:00
|
|
|
|
(cdr cookie))))))
|
|
|
|
|
|
2008-06-21 06:51:23 +00:00
|
|
|
|
;;;###autoload
|
2008-06-05 02:42:55 +00:00
|
|
|
|
(defun face-remap-reset-base (face)
|
2012-03-21 07:02:13 +00:00
|
|
|
|
"Set the base remapping of FACE to the normal definition of FACE.
|
|
|
|
|
This causes the remappings specified by `face-remap-add-relative'
|
|
|
|
|
to apply on top of the normal definition of FACE."
|
2008-06-03 11:05:52 +00:00
|
|
|
|
(let ((entry (assq face face-remapping-alist)))
|
|
|
|
|
(when entry
|
|
|
|
|
;; If there's nothing except a base remapping, we simply remove
|
|
|
|
|
;; the entire remapping entry, as setting the base to the default
|
|
|
|
|
;; would be the same as the global definition. Otherwise, we
|
|
|
|
|
;; modify the base remapping.
|
|
|
|
|
(if (null (cddr entry)) ; nothing except base remapping
|
|
|
|
|
(setq face-remapping-alist ; so remove entire entry
|
|
|
|
|
(remq entry face-remapping-alist))
|
2014-02-10 16:08:37 +00:00
|
|
|
|
(setcar (last entry) face))
|
|
|
|
|
;; Force redisplay of this buffer.
|
|
|
|
|
(force-mode-line-update)))) ; otherwise, just inherit global def
|
2008-06-03 11:05:52 +00:00
|
|
|
|
|
2008-06-21 06:51:23 +00:00
|
|
|
|
;;;###autoload
|
2008-06-05 02:42:55 +00:00
|
|
|
|
(defun face-remap-set-base (face &rest specs)
|
2008-06-03 11:05:52 +00:00
|
|
|
|
"Set the base remapping of FACE in the current buffer to SPECS.
|
2012-03-21 07:02:13 +00:00
|
|
|
|
This causes the remappings specified by `face-remap-add-relative'
|
2012-06-09 06:26:46 +00:00
|
|
|
|
to apply on top of the face specification given by SPECS.
|
|
|
|
|
|
2020-12-19 18:54:11 +00:00
|
|
|
|
The remaining arguments, SPECS, specify the base of the remapping.
|
|
|
|
|
Each one of SPECS should be either a face name or a property list
|
2012-06-09 06:26:46 +00:00
|
|
|
|
of face attribute/value pairs, like in a `face' text property.
|
2012-03-21 07:02:13 +00:00
|
|
|
|
|
2020-12-19 18:54:11 +00:00
|
|
|
|
If SPECS is empty or a single face `eq' to FACE, call `face-remap-reset-base'
|
|
|
|
|
to use the normal definition of FACE as the base remapping; note that
|
|
|
|
|
this is different from SPECS containing a single value nil, which means
|
2012-03-21 07:02:13 +00:00
|
|
|
|
not to inherit from the global definition of FACE at all."
|
2022-02-23 11:50:07 +00:00
|
|
|
|
;; Simplify the specs in the case where it's just a single face (and
|
|
|
|
|
;; it's not a list with just a nil).
|
2008-06-20 08:55:22 +00:00
|
|
|
|
(while (and (consp specs) (not (null (car specs))) (null (cdr specs)))
|
|
|
|
|
(setq specs (car specs)))
|
2008-06-03 11:05:52 +00:00
|
|
|
|
(if (or (null specs)
|
2022-02-23 11:50:07 +00:00
|
|
|
|
(eq specs face)) ; default
|
2008-06-03 11:05:52 +00:00
|
|
|
|
;; Set entry back to default
|
2008-06-05 02:42:55 +00:00
|
|
|
|
(face-remap-reset-base face)
|
2008-06-03 11:05:52 +00:00
|
|
|
|
;; Set the base remapping
|
|
|
|
|
(make-local-variable 'face-remapping-alist)
|
|
|
|
|
(let ((entry (assq face face-remapping-alist)))
|
|
|
|
|
(if entry
|
|
|
|
|
(setcar (last entry) specs) ; overwrite existing base entry
|
2014-02-10 16:08:37 +00:00
|
|
|
|
(push (list face specs) face-remapping-alist)))
|
|
|
|
|
;; Force redisplay of this buffer.
|
|
|
|
|
(force-mode-line-update)))
|
2008-06-04 11:14:07 +00:00
|
|
|
|
|
2008-06-03 11:05:52 +00:00
|
|
|
|
|
|
|
|
|
;; ----------------------------------------------------------------
|
|
|
|
|
;; text-scale-mode
|
|
|
|
|
|
|
|
|
|
(defcustom text-scale-mode-step 1.2
|
|
|
|
|
"Scale factor used by `text-scale-mode'.
|
2022-06-19 23:26:05 +00:00
|
|
|
|
Each positive or negative step scales the size of the `default'
|
|
|
|
|
face's font by this amount."
|
2008-06-03 11:05:52 +00:00
|
|
|
|
:group 'display
|
2008-12-15 16:45:55 +00:00
|
|
|
|
:type 'number
|
|
|
|
|
:version "23.1")
|
2008-06-03 11:05:52 +00:00
|
|
|
|
|
Prefer defvar-local in remaining libraries
* lisp/align.el (align-mode-rules-list)
(align-mode-exclude-rules-list):
* lisp/bookmark.el (bookmark-current-bookmark)
(bookmark-annotation-name)
(bookmark--annotation-from-bookmark-list):
* lisp/calc/calc-embed.el (calc-embedded-all-active)
(calc-embedded-some-active):
* lisp/comint.el (comint-password-function):
* lisp/completion.el (completion-syntax-table):
* lisp/dframe.el (dframe-track-mouse-function)
(dframe-help-echo-function, dframe-mouse-click-function)
(dframe-mouse-position-function, dframe-timer)
(dframe-attached-frame, dframe-controlled):
* lisp/ehelp.el (electric-help-orig-major-mode):
* lisp/eshell/esh-util.el (eshell-path-env):
* lisp/expand.el (expand-pos, expand-index, expand-point):
* lisp/face-remap.el (text-scale-mode-remapping)
(text-scale-mode-lighter, text-scale-mode-amount)
(text-scale-remap-header-line, buffer-face-mode-remapping):
* lisp/ffap.el (ffap-menu-alist):
* lisp/files-x.el (connection-local-variables-alist):
* lisp/foldout.el (foldout-fold-list, foldout-mode-line-string):
* lisp/follow.el (follow-start-end-invalid):
* lisp/forms.el (forms--mode-setup):
* lisp/gnus/message.el (message-cross-post-old-target)
(message-options):
* lisp/help-mode.el (help-xref-stack, help-xref-forward-stack)
(help-xref-stack-item, help-xref-stack-forward-item):
* lisp/hexl.el (hexl-mode--old-var-vals, hexl-ascii-overlay):
* lisp/hilit-chg.el (hilit-chg-string):
* lisp/ido.el (ido-eoinput):
* lisp/imenu.el (imenu-generic-expression)
(imenu-create-index-function, imenu-default-goto-function)
(imenu-prev-index-position-function)
(imenu-extract-index-name-function, imenu-name-lookup-function)
(imenu-syntax-alist, imenu-case-fold-search):
* lisp/jka-compr.el (jka-compr-really-do-compress):
* lisp/language/ethio-util.el (ethio-prefer-ascii-space):
* lisp/leim/quail/hangul.el (hangul-input-method-help-text):
* lisp/leim/quail/japanese.el (quail-japanese-package-saved):
* lisp/linum.el (linum-overlays, linum-available):
* lisp/man.el (Man-original-frame, Man-arguments, Man--sections)
(Man--refpages, Man-page-list, Man-current-page)
(Man-page-mode-string):
* lisp/pcomplete.el (pcomplete-current-completions)
(pcomplete-last-completion-length)
(pcomplete-last-completion-stub, pcomplete-last-completion-raw)
(pcomplete-last-window-config, pcomplete-window-restore-timer):
* lisp/reveal.el (reveal-open-spots, reveal-last-tick):
* lisp/ruler-mode.el (ruler-mode):
* lisp/scroll-lock.el (scroll-lock-preserve-screen-pos-save):
* lisp/server.el (server-buffer-clients, server-existing-buffer):
* lisp/tab-line.el (tab-line-exclude):
* lisp/tar-mode.el (tar-data-buffer, tar-data-swapped):
* lisp/thumbs.el (thumbs-current-tmp-filename)
(thumbs-current-image-filename, thumbs-extra-images)
(thumbs-image-num, thumbs-buffer, thumbs-marked-list):
* lisp/tutorial.el (tutorial--point-before-chkeys)
(tutorial--point-after-chkeys, tutorial--lang):
* lisp/url/url-vars.el (url-current-object)
(url-current-mime-headers, url-current-lastloc):
* lisp/view.el (view-mode, view-old-buffer-read-only)
(view-old-Helper-return-blurb, view-page-size)
(view-half-page-size, view-last-regexp, view-return-to-alist)
(view-exit-action, view-overlay):
* lisp/wid-edit.el (widget-global-map, widget-field-new)
(widget-field-list, widget-field-last, widget-field-was):
* lisp/woman.el (woman-imenu-done): Prefer defvar-local.
2021-02-02 08:55:40 +00:00
|
|
|
|
(defvar-local text-scale-mode-remapping nil
|
2021-09-14 06:43:18 +00:00
|
|
|
|
"Current remapping cookie for `text-scale-mode'.")
|
2008-06-03 11:05:52 +00:00
|
|
|
|
|
Prefer defvar-local in remaining libraries
* lisp/align.el (align-mode-rules-list)
(align-mode-exclude-rules-list):
* lisp/bookmark.el (bookmark-current-bookmark)
(bookmark-annotation-name)
(bookmark--annotation-from-bookmark-list):
* lisp/calc/calc-embed.el (calc-embedded-all-active)
(calc-embedded-some-active):
* lisp/comint.el (comint-password-function):
* lisp/completion.el (completion-syntax-table):
* lisp/dframe.el (dframe-track-mouse-function)
(dframe-help-echo-function, dframe-mouse-click-function)
(dframe-mouse-position-function, dframe-timer)
(dframe-attached-frame, dframe-controlled):
* lisp/ehelp.el (electric-help-orig-major-mode):
* lisp/eshell/esh-util.el (eshell-path-env):
* lisp/expand.el (expand-pos, expand-index, expand-point):
* lisp/face-remap.el (text-scale-mode-remapping)
(text-scale-mode-lighter, text-scale-mode-amount)
(text-scale-remap-header-line, buffer-face-mode-remapping):
* lisp/ffap.el (ffap-menu-alist):
* lisp/files-x.el (connection-local-variables-alist):
* lisp/foldout.el (foldout-fold-list, foldout-mode-line-string):
* lisp/follow.el (follow-start-end-invalid):
* lisp/forms.el (forms--mode-setup):
* lisp/gnus/message.el (message-cross-post-old-target)
(message-options):
* lisp/help-mode.el (help-xref-stack, help-xref-forward-stack)
(help-xref-stack-item, help-xref-stack-forward-item):
* lisp/hexl.el (hexl-mode--old-var-vals, hexl-ascii-overlay):
* lisp/hilit-chg.el (hilit-chg-string):
* lisp/ido.el (ido-eoinput):
* lisp/imenu.el (imenu-generic-expression)
(imenu-create-index-function, imenu-default-goto-function)
(imenu-prev-index-position-function)
(imenu-extract-index-name-function, imenu-name-lookup-function)
(imenu-syntax-alist, imenu-case-fold-search):
* lisp/jka-compr.el (jka-compr-really-do-compress):
* lisp/language/ethio-util.el (ethio-prefer-ascii-space):
* lisp/leim/quail/hangul.el (hangul-input-method-help-text):
* lisp/leim/quail/japanese.el (quail-japanese-package-saved):
* lisp/linum.el (linum-overlays, linum-available):
* lisp/man.el (Man-original-frame, Man-arguments, Man--sections)
(Man--refpages, Man-page-list, Man-current-page)
(Man-page-mode-string):
* lisp/pcomplete.el (pcomplete-current-completions)
(pcomplete-last-completion-length)
(pcomplete-last-completion-stub, pcomplete-last-completion-raw)
(pcomplete-last-window-config, pcomplete-window-restore-timer):
* lisp/reveal.el (reveal-open-spots, reveal-last-tick):
* lisp/ruler-mode.el (ruler-mode):
* lisp/scroll-lock.el (scroll-lock-preserve-screen-pos-save):
* lisp/server.el (server-buffer-clients, server-existing-buffer):
* lisp/tab-line.el (tab-line-exclude):
* lisp/tar-mode.el (tar-data-buffer, tar-data-swapped):
* lisp/thumbs.el (thumbs-current-tmp-filename)
(thumbs-current-image-filename, thumbs-extra-images)
(thumbs-image-num, thumbs-buffer, thumbs-marked-list):
* lisp/tutorial.el (tutorial--point-before-chkeys)
(tutorial--point-after-chkeys, tutorial--lang):
* lisp/url/url-vars.el (url-current-object)
(url-current-mime-headers, url-current-lastloc):
* lisp/view.el (view-mode, view-old-buffer-read-only)
(view-old-Helper-return-blurb, view-page-size)
(view-half-page-size, view-last-regexp, view-return-to-alist)
(view-exit-action, view-overlay):
* lisp/wid-edit.el (widget-global-map, widget-field-new)
(widget-field-list, widget-field-last, widget-field-was):
* lisp/woman.el (woman-imenu-done): Prefer defvar-local.
2021-02-02 08:55:40 +00:00
|
|
|
|
(defvar-local text-scale-mode-lighter "+0"
|
2021-09-14 06:43:18 +00:00
|
|
|
|
"Lighter displayed for `text-scale-mode' in mode-line minor-mode list.")
|
2008-06-03 11:05:52 +00:00
|
|
|
|
|
Prefer defvar-local in remaining libraries
* lisp/align.el (align-mode-rules-list)
(align-mode-exclude-rules-list):
* lisp/bookmark.el (bookmark-current-bookmark)
(bookmark-annotation-name)
(bookmark--annotation-from-bookmark-list):
* lisp/calc/calc-embed.el (calc-embedded-all-active)
(calc-embedded-some-active):
* lisp/comint.el (comint-password-function):
* lisp/completion.el (completion-syntax-table):
* lisp/dframe.el (dframe-track-mouse-function)
(dframe-help-echo-function, dframe-mouse-click-function)
(dframe-mouse-position-function, dframe-timer)
(dframe-attached-frame, dframe-controlled):
* lisp/ehelp.el (electric-help-orig-major-mode):
* lisp/eshell/esh-util.el (eshell-path-env):
* lisp/expand.el (expand-pos, expand-index, expand-point):
* lisp/face-remap.el (text-scale-mode-remapping)
(text-scale-mode-lighter, text-scale-mode-amount)
(text-scale-remap-header-line, buffer-face-mode-remapping):
* lisp/ffap.el (ffap-menu-alist):
* lisp/files-x.el (connection-local-variables-alist):
* lisp/foldout.el (foldout-fold-list, foldout-mode-line-string):
* lisp/follow.el (follow-start-end-invalid):
* lisp/forms.el (forms--mode-setup):
* lisp/gnus/message.el (message-cross-post-old-target)
(message-options):
* lisp/help-mode.el (help-xref-stack, help-xref-forward-stack)
(help-xref-stack-item, help-xref-stack-forward-item):
* lisp/hexl.el (hexl-mode--old-var-vals, hexl-ascii-overlay):
* lisp/hilit-chg.el (hilit-chg-string):
* lisp/ido.el (ido-eoinput):
* lisp/imenu.el (imenu-generic-expression)
(imenu-create-index-function, imenu-default-goto-function)
(imenu-prev-index-position-function)
(imenu-extract-index-name-function, imenu-name-lookup-function)
(imenu-syntax-alist, imenu-case-fold-search):
* lisp/jka-compr.el (jka-compr-really-do-compress):
* lisp/language/ethio-util.el (ethio-prefer-ascii-space):
* lisp/leim/quail/hangul.el (hangul-input-method-help-text):
* lisp/leim/quail/japanese.el (quail-japanese-package-saved):
* lisp/linum.el (linum-overlays, linum-available):
* lisp/man.el (Man-original-frame, Man-arguments, Man--sections)
(Man--refpages, Man-page-list, Man-current-page)
(Man-page-mode-string):
* lisp/pcomplete.el (pcomplete-current-completions)
(pcomplete-last-completion-length)
(pcomplete-last-completion-stub, pcomplete-last-completion-raw)
(pcomplete-last-window-config, pcomplete-window-restore-timer):
* lisp/reveal.el (reveal-open-spots, reveal-last-tick):
* lisp/ruler-mode.el (ruler-mode):
* lisp/scroll-lock.el (scroll-lock-preserve-screen-pos-save):
* lisp/server.el (server-buffer-clients, server-existing-buffer):
* lisp/tab-line.el (tab-line-exclude):
* lisp/tar-mode.el (tar-data-buffer, tar-data-swapped):
* lisp/thumbs.el (thumbs-current-tmp-filename)
(thumbs-current-image-filename, thumbs-extra-images)
(thumbs-image-num, thumbs-buffer, thumbs-marked-list):
* lisp/tutorial.el (tutorial--point-before-chkeys)
(tutorial--point-after-chkeys, tutorial--lang):
* lisp/url/url-vars.el (url-current-object)
(url-current-mime-headers, url-current-lastloc):
* lisp/view.el (view-mode, view-old-buffer-read-only)
(view-old-Helper-return-blurb, view-page-size)
(view-half-page-size, view-last-regexp, view-return-to-alist)
(view-exit-action, view-overlay):
* lisp/wid-edit.el (widget-global-map, widget-field-new)
(widget-field-list, widget-field-last, widget-field-was):
* lisp/woman.el (woman-imenu-done): Prefer defvar-local.
2021-02-02 08:55:40 +00:00
|
|
|
|
(defvar-local text-scale-mode-amount 0
|
2021-09-14 06:43:18 +00:00
|
|
|
|
"Number of steps that `text-scale-mode' will increase/decrease text height.")
|
2008-06-03 11:05:52 +00:00
|
|
|
|
|
Prefer defvar-local in remaining libraries
* lisp/align.el (align-mode-rules-list)
(align-mode-exclude-rules-list):
* lisp/bookmark.el (bookmark-current-bookmark)
(bookmark-annotation-name)
(bookmark--annotation-from-bookmark-list):
* lisp/calc/calc-embed.el (calc-embedded-all-active)
(calc-embedded-some-active):
* lisp/comint.el (comint-password-function):
* lisp/completion.el (completion-syntax-table):
* lisp/dframe.el (dframe-track-mouse-function)
(dframe-help-echo-function, dframe-mouse-click-function)
(dframe-mouse-position-function, dframe-timer)
(dframe-attached-frame, dframe-controlled):
* lisp/ehelp.el (electric-help-orig-major-mode):
* lisp/eshell/esh-util.el (eshell-path-env):
* lisp/expand.el (expand-pos, expand-index, expand-point):
* lisp/face-remap.el (text-scale-mode-remapping)
(text-scale-mode-lighter, text-scale-mode-amount)
(text-scale-remap-header-line, buffer-face-mode-remapping):
* lisp/ffap.el (ffap-menu-alist):
* lisp/files-x.el (connection-local-variables-alist):
* lisp/foldout.el (foldout-fold-list, foldout-mode-line-string):
* lisp/follow.el (follow-start-end-invalid):
* lisp/forms.el (forms--mode-setup):
* lisp/gnus/message.el (message-cross-post-old-target)
(message-options):
* lisp/help-mode.el (help-xref-stack, help-xref-forward-stack)
(help-xref-stack-item, help-xref-stack-forward-item):
* lisp/hexl.el (hexl-mode--old-var-vals, hexl-ascii-overlay):
* lisp/hilit-chg.el (hilit-chg-string):
* lisp/ido.el (ido-eoinput):
* lisp/imenu.el (imenu-generic-expression)
(imenu-create-index-function, imenu-default-goto-function)
(imenu-prev-index-position-function)
(imenu-extract-index-name-function, imenu-name-lookup-function)
(imenu-syntax-alist, imenu-case-fold-search):
* lisp/jka-compr.el (jka-compr-really-do-compress):
* lisp/language/ethio-util.el (ethio-prefer-ascii-space):
* lisp/leim/quail/hangul.el (hangul-input-method-help-text):
* lisp/leim/quail/japanese.el (quail-japanese-package-saved):
* lisp/linum.el (linum-overlays, linum-available):
* lisp/man.el (Man-original-frame, Man-arguments, Man--sections)
(Man--refpages, Man-page-list, Man-current-page)
(Man-page-mode-string):
* lisp/pcomplete.el (pcomplete-current-completions)
(pcomplete-last-completion-length)
(pcomplete-last-completion-stub, pcomplete-last-completion-raw)
(pcomplete-last-window-config, pcomplete-window-restore-timer):
* lisp/reveal.el (reveal-open-spots, reveal-last-tick):
* lisp/ruler-mode.el (ruler-mode):
* lisp/scroll-lock.el (scroll-lock-preserve-screen-pos-save):
* lisp/server.el (server-buffer-clients, server-existing-buffer):
* lisp/tab-line.el (tab-line-exclude):
* lisp/tar-mode.el (tar-data-buffer, tar-data-swapped):
* lisp/thumbs.el (thumbs-current-tmp-filename)
(thumbs-current-image-filename, thumbs-extra-images)
(thumbs-image-num, thumbs-buffer, thumbs-marked-list):
* lisp/tutorial.el (tutorial--point-before-chkeys)
(tutorial--point-after-chkeys, tutorial--lang):
* lisp/url/url-vars.el (url-current-object)
(url-current-mime-headers, url-current-lastloc):
* lisp/view.el (view-mode, view-old-buffer-read-only)
(view-old-Helper-return-blurb, view-page-size)
(view-half-page-size, view-last-regexp, view-return-to-alist)
(view-exit-action, view-overlay):
* lisp/wid-edit.el (widget-global-map, widget-field-new)
(widget-field-list, widget-field-last, widget-field-was):
* lisp/woman.el (woman-imenu-done): Prefer defvar-local.
2021-02-02 08:55:40 +00:00
|
|
|
|
(defvar-local text-scale-remap-header-line nil
|
2020-11-25 02:03:48 +00:00
|
|
|
|
"If non-nil, text scaling may change font size of header lines too.")
|
|
|
|
|
|
|
|
|
|
(defun face-remap--clear-remappings ()
|
|
|
|
|
(dolist (remapping
|
|
|
|
|
;; This is a bit messy to stay backwards compatible.
|
|
|
|
|
;; In the future, this can be simplified to just use
|
|
|
|
|
;; `text-scale-mode-remapping'.
|
|
|
|
|
(if (consp (car-safe text-scale-mode-remapping))
|
|
|
|
|
text-scale-mode-remapping
|
|
|
|
|
(list text-scale-mode-remapping)))
|
|
|
|
|
(face-remap-remove-relative remapping))
|
|
|
|
|
(setq text-scale-mode-remapping nil))
|
|
|
|
|
|
|
|
|
|
(defun face-remap--remap-face (sym)
|
|
|
|
|
(push (face-remap-add-relative sym
|
|
|
|
|
:height
|
|
|
|
|
(expt text-scale-mode-step
|
|
|
|
|
text-scale-mode-amount))
|
|
|
|
|
text-scale-mode-remapping))
|
|
|
|
|
|
2008-06-03 11:05:52 +00:00
|
|
|
|
(define-minor-mode text-scale-mode
|
Fix minor mode docstrings for the new meaning of a nil ARG.
* abbrev.el (abbrev-mode):
* allout.el (allout-mode):
* autoinsert.el (auto-insert-mode):
* autoarg.el (autoarg-mode, autoarg-kp-mode):
* autorevert.el (auto-revert-mode, auto-revert-tail-mode)
(global-auto-revert-mode):
* battery.el (display-battery-mode):
* composite.el (global-auto-composition-mode)
(auto-composition-mode):
* delsel.el (delete-selection-mode):
* desktop.el (desktop-save-mode):
* dired-x.el (dired-omit-mode):
* dirtrack.el (dirtrack-mode):
* doc-view.el (doc-view-minor-mode):
* double.el (double-mode):
* electric.el (electric-indent-mode, electric-pair-mode):
* emacs-lock.el (emacs-lock-mode):
* epa-hook.el (auto-encryption-mode):
* follow.el (follow-mode):
* font-core.el (font-lock-mode):
* frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode):
* help.el (temp-buffer-resize-mode):
* hilit-chg.el (highlight-changes-mode)
(highlight-changes-visible-mode):
* hi-lock.el (hi-lock-mode):
* hl-line.el (hl-line-mode, global-hl-line-mode):
* icomplete.el (icomplete-mode):
* ido.el (ido-everywhere):
* image-file.el (auto-image-file-mode):
* image-mode.el (image-minor-mode):
* iswitchb.el (iswitchb-mode):
* jka-cmpr-hook.el (auto-compression-mode):
* linum.el (linum-mode):
* longlines.el (longlines-mode):
* master.el (master-mode):
* mb-depth.el (minibuffer-depth-indicate-mode):
* menu-bar.el (menu-bar-mode):
* minibuf-eldef.el (minibuffer-electric-default-mode):
* mouse-sel.el (mouse-sel-mode):
* msb.el (msb-mode):
* mwheel.el (mouse-wheel-mode):
* outline.el (outline-minor-mode):
* paren.el (show-paren-mode):
* recentf.el (recentf-mode):
* reveal.el (reveal-mode, global-reveal-mode):
* rfn-eshadow.el (file-name-shadow-mode):
* ruler-mode.el (ruler-mode):
* savehist.el (savehist-mode):
* scroll-all.el (scroll-all-mode):
* scroll-bar.el (scroll-bar-mode):
* server.el (server-mode):
* shell.el (shell-dirtrack-mode):
* simple.el (auto-fill-mode, transient-mark-mode)
(visual-line-mode, overwrite-mode, binary-overwrite-mode)
(line-number-mode, column-number-mode, size-indication-mode)
(auto-save-mode, normal-erase-is-backspace-mode, visible-mode):
* strokes.el (strokes-mode):
* time.el (display-time-mode):
* t-mouse.el (gpm-mouse-mode):
* tool-bar.el (tool-bar-mode):
* tooltip.el (tooltip-mode):
* type-break.el (type-break-mode-line-message-mode)
(type-break-query-mode):
* view.el (view-mode):
* whitespace.el (whitespace-mode, whitespace-newline-mode)
(global-whitespace-mode, global-whitespace-newline-mode):
* xt-mouse.el (xterm-mouse-mode): Doc fix.
* emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix
autogenerated docstring.
2011-10-19 12:54:24 +00:00
|
|
|
|
"Minor mode for displaying buffer text in a larger/smaller font.
|
2008-06-03 11:05:52 +00:00
|
|
|
|
|
|
|
|
|
The amount of scaling is determined by the variable
|
2008-06-04 11:14:07 +00:00
|
|
|
|
`text-scale-mode-amount': one step scales the global default
|
|
|
|
|
face size by the value of the variable `text-scale-mode-step'
|
|
|
|
|
\(a negative amount shrinks the text).
|
|
|
|
|
|
2009-06-23 08:27:58 +00:00
|
|
|
|
The `text-scale-increase', `text-scale-decrease', and
|
|
|
|
|
`text-scale-set' functions may be used to interactively modify
|
|
|
|
|
the variable `text-scale-mode-amount' (they also enable or
|
2020-11-25 02:03:48 +00:00
|
|
|
|
disable `text-scale-mode' as necessary).
|
|
|
|
|
|
|
|
|
|
If `text-scale-remap-header-line' is non-nil, also change
|
|
|
|
|
the font size of the header line."
|
2008-06-03 11:05:52 +00:00
|
|
|
|
:lighter (" " text-scale-mode-lighter)
|
2020-11-25 02:03:48 +00:00
|
|
|
|
(face-remap--clear-remappings)
|
2008-06-03 11:05:52 +00:00
|
|
|
|
(setq text-scale-mode-lighter
|
|
|
|
|
(format (if (>= text-scale-mode-amount 0) "+%d" "%d")
|
|
|
|
|
text-scale-mode-amount))
|
2020-11-25 02:03:48 +00:00
|
|
|
|
(when text-scale-mode
|
|
|
|
|
(face-remap--remap-face 'default)
|
|
|
|
|
(when text-scale-remap-header-line
|
|
|
|
|
(face-remap--remap-face 'header-line)))
|
2008-06-03 11:05:52 +00:00
|
|
|
|
(force-window-update (current-buffer)))
|
|
|
|
|
|
2020-11-25 05:29:10 +00:00
|
|
|
|
(defun text-scale--refresh (symbol newval operation where)
|
|
|
|
|
"Watcher for `text-scale-remap-header-line'.
|
|
|
|
|
See `add-variable-watcher'."
|
|
|
|
|
(when (and (eq symbol 'text-scale-remap-header-line)
|
|
|
|
|
(eq operation 'set)
|
|
|
|
|
text-scale-mode)
|
|
|
|
|
(with-current-buffer where
|
|
|
|
|
(let ((text-scale-remap-header-line newval))
|
|
|
|
|
(text-scale-mode 1)))))
|
|
|
|
|
(add-variable-watcher 'text-scale-remap-header-line #'text-scale--refresh)
|
|
|
|
|
|
2016-04-10 16:50:39 +00:00
|
|
|
|
(defun text-scale-min-amount ()
|
|
|
|
|
"Return the minimum amount of text-scaling we allow."
|
|
|
|
|
;; When the resulting pixel-height of characters will become smaller
|
|
|
|
|
;; than 1 pixel, we can expect trouble from the display engine.
|
|
|
|
|
;; E.g., it requires that the character glyph's ascent is
|
|
|
|
|
;; non-negative.
|
|
|
|
|
(log (/ 1.0 (frame-char-height)) text-scale-mode-step))
|
|
|
|
|
|
|
|
|
|
(defun text-scale-max-amount ()
|
|
|
|
|
"Return the maximum amount of text-scaling we allow."
|
|
|
|
|
;; The display engine uses a 16-bit short for pixel-width of
|
|
|
|
|
;; characters, thus the 0xffff limitation. It also makes no sense
|
|
|
|
|
;; to have characters wider than the display.
|
|
|
|
|
(log (/ (min (display-pixel-width) #xffff)
|
|
|
|
|
(frame-char-width))
|
|
|
|
|
text-scale-mode-step))
|
|
|
|
|
|
2009-06-23 08:27:58 +00:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun text-scale-set (level)
|
|
|
|
|
"Set the scale factor of the default face in the current buffer to LEVEL.
|
|
|
|
|
If LEVEL is non-zero, `text-scale-mode' is enabled, otherwise it is disabled.
|
|
|
|
|
|
|
|
|
|
LEVEL is a number of steps, with 0 representing the default size.
|
|
|
|
|
Each step scales the height of the default face by the variable
|
|
|
|
|
`text-scale-mode-step' (a negative number decreases the height by
|
|
|
|
|
the same amount)."
|
|
|
|
|
(interactive "p")
|
2016-04-10 16:50:39 +00:00
|
|
|
|
(setq text-scale-mode-amount
|
|
|
|
|
(max (min level (text-scale-max-amount)) (text-scale-min-amount)))
|
2009-06-23 08:27:58 +00:00
|
|
|
|
(text-scale-mode (if (zerop text-scale-mode-amount) -1 1)))
|
|
|
|
|
|
2008-06-03 11:05:52 +00:00
|
|
|
|
;;;###autoload
|
2008-10-27 10:37:41 +00:00
|
|
|
|
(defun text-scale-increase (inc)
|
2022-06-19 23:26:05 +00:00
|
|
|
|
"Increase the font size of the default face in current buffer by INC steps.
|
2008-06-03 11:05:52 +00:00
|
|
|
|
If the new height is other than the default, `text-scale-mode' is enabled.
|
|
|
|
|
|
|
|
|
|
Each step scales the height of the default face by the variable
|
|
|
|
|
`text-scale-mode-step' (a negative number of steps decreases the
|
|
|
|
|
height by the same amount). As a special case, an argument of 0
|
|
|
|
|
will remove any scaling currently active."
|
2008-06-04 05:38:04 +00:00
|
|
|
|
(interactive "p")
|
2016-04-10 16:50:39 +00:00
|
|
|
|
(let* ((current-value (if text-scale-mode text-scale-mode-amount 0))
|
|
|
|
|
(new-value (if (= inc 0) 0 (+ current-value inc))))
|
|
|
|
|
(if (or (> new-value (text-scale-max-amount))
|
|
|
|
|
(< new-value (text-scale-min-amount)))
|
2022-06-19 23:26:05 +00:00
|
|
|
|
(user-error "Cannot %s the font size any further"
|
2016-04-10 16:50:39 +00:00
|
|
|
|
(if (> inc 0) "increase" "decrease")))
|
|
|
|
|
(setq text-scale-mode-amount new-value))
|
2008-06-03 11:05:52 +00:00
|
|
|
|
(text-scale-mode (if (zerop text-scale-mode-amount) -1 1)))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2008-10-27 10:37:41 +00:00
|
|
|
|
(defun text-scale-decrease (dec)
|
2022-06-19 23:26:05 +00:00
|
|
|
|
"Decrease the font size of the default face in the current buffer by DEC steps.
|
2008-06-05 02:42:55 +00:00
|
|
|
|
See `text-scale-increase' for more details."
|
2008-06-04 05:38:04 +00:00
|
|
|
|
(interactive "p")
|
2008-06-05 02:42:55 +00:00
|
|
|
|
(text-scale-increase (- dec)))
|
2008-06-03 11:05:52 +00:00
|
|
|
|
|
2008-06-05 02:42:55 +00:00
|
|
|
|
;;;###autoload (define-key ctl-x-map [(control ?+)] 'text-scale-adjust)
|
|
|
|
|
;;;###autoload (define-key ctl-x-map [(control ?-)] 'text-scale-adjust)
|
|
|
|
|
;;;###autoload (define-key ctl-x-map [(control ?=)] 'text-scale-adjust)
|
|
|
|
|
;;;###autoload (define-key ctl-x-map [(control ?0)] 'text-scale-adjust)
|
2008-06-04 05:38:04 +00:00
|
|
|
|
;;;###autoload
|
2008-10-27 10:37:41 +00:00
|
|
|
|
(defun text-scale-adjust (inc)
|
2022-06-19 23:26:05 +00:00
|
|
|
|
"Adjust the font size in the current buffer by INC steps.
|
2022-11-13 06:56:35 +00:00
|
|
|
|
Interactively, INC is the prefix numeric argument, and defaults to 1.
|
2008-06-04 05:38:04 +00:00
|
|
|
|
|
|
|
|
|
The actual adjustment made depends on the final component of the
|
2021-09-14 06:43:18 +00:00
|
|
|
|
keybinding used to invoke the command, with all modifiers removed:
|
2008-06-04 05:38:04 +00:00
|
|
|
|
|
2022-07-04 14:54:38 +00:00
|
|
|
|
\\`+', \\`=' Increase font size in current buffer by one step
|
|
|
|
|
\\`-' Decrease font size in current buffer by one step
|
|
|
|
|
\\`0' Reset the font size to the global default
|
2008-06-04 05:38:04 +00:00
|
|
|
|
|
2013-10-13 05:17:42 +00:00
|
|
|
|
After adjusting, continue to read input events and further adjust
|
2022-11-13 06:56:35 +00:00
|
|
|
|
the font size as long as the input event (with all modifiers removed)
|
|
|
|
|
is one of the above characters.
|
2008-06-04 05:38:04 +00:00
|
|
|
|
|
2022-11-13 06:56:35 +00:00
|
|
|
|
Each step scales the height of the default face by the factor that
|
|
|
|
|
is the value of `text-scale-mode-step' (a negative number of steps
|
|
|
|
|
decreases the height by that factor). As a special case, an argument
|
|
|
|
|
of 0 will remove any scaling currently active, thus resetting the
|
|
|
|
|
font size to the original value.
|
2008-06-04 05:38:04 +00:00
|
|
|
|
|
|
|
|
|
This command is a special-purpose wrapper around the
|
2008-06-05 02:42:55 +00:00
|
|
|
|
`text-scale-increase' command which makes repetition convenient
|
|
|
|
|
even when it is bound in a non-top-level keymap. For binding in
|
|
|
|
|
a top-level keymap, `text-scale-increase' or
|
2022-06-19 23:26:05 +00:00
|
|
|
|
`text-scale-decrease' may be more appropriate.
|
|
|
|
|
|
|
|
|
|
Most faces are affected by these font size changes, but not faces
|
|
|
|
|
that have an explicit `:height' setting. The two exceptions to
|
2022-06-20 13:05:05 +00:00
|
|
|
|
this are the `default' and `header-line' faces: they will both be
|
2022-07-02 13:40:45 +00:00
|
|
|
|
scaled even if they have an explicit `:height' setting.
|
|
|
|
|
|
2022-11-19 15:46:46 +00:00
|
|
|
|
See also the related command `global-text-scale-adjust'. Unlike
|
|
|
|
|
that command, which scales the font size with a increment,
|
|
|
|
|
`text-scale-adjust' scales the font size with a factor,
|
|
|
|
|
`text-scale-mode-step'. With a small `text-scale-mode-step'
|
|
|
|
|
factor, the two commands behave similarly."
|
2008-06-04 05:38:04 +00:00
|
|
|
|
(interactive "p")
|
2012-10-26 17:07:35 +00:00
|
|
|
|
(let ((ev last-command-event)
|
2008-06-21 14:54:29 +00:00
|
|
|
|
(echo-keystrokes nil))
|
2012-05-05 02:50:20 +00:00
|
|
|
|
(let* ((base (event-basic-type ev))
|
|
|
|
|
(step
|
|
|
|
|
(pcase base
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
|
((or ?+ ?=) inc)
|
|
|
|
|
(?- (- inc))
|
|
|
|
|
(?0 0)
|
2015-06-17 00:04:35 +00:00
|
|
|
|
(_ inc))))
|
2012-05-05 02:50:20 +00:00
|
|
|
|
(text-scale-increase step)
|
2013-12-23 03:59:10 +00:00
|
|
|
|
(set-transient-map
|
2012-05-05 02:50:20 +00:00
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(dolist (mods '(() (control)))
|
2022-07-06 17:39:41 +00:00
|
|
|
|
(dolist (key '(?+ ?= ?- ?0)) ;; = is often unshifted +.
|
2012-10-26 17:07:35 +00:00
|
|
|
|
(define-key map (vector (append mods (list key)))
|
|
|
|
|
(lambda () (interactive) (text-scale-adjust (abs inc))))))
|
2022-02-08 06:33:24 +00:00
|
|
|
|
map)
|
2022-07-06 17:39:41 +00:00
|
|
|
|
nil nil
|
|
|
|
|
"Use %k for further adjustment"))))
|
2008-06-04 05:38:04 +00:00
|
|
|
|
|
2021-12-26 05:47:23 +00:00
|
|
|
|
(defvar-local text-scale--pinch-start-scale 0
|
|
|
|
|
"The text scale at the start of a pinch sequence.")
|
|
|
|
|
|
|
|
|
|
;;;###autoload (define-key global-map [pinch] 'text-scale-pinch)
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun text-scale-pinch (event)
|
2021-12-26 10:13:53 +00:00
|
|
|
|
"Adjust the height of the default face by the scale in the pinch event EVENT."
|
2021-12-26 05:47:23 +00:00
|
|
|
|
(interactive "e")
|
2021-12-26 10:13:53 +00:00
|
|
|
|
(when (not (eq (event-basic-type event) 'pinch))
|
|
|
|
|
(error "`text-scale-pinch' bound to bad event type"))
|
2021-12-26 05:47:23 +00:00
|
|
|
|
(let ((window (posn-window (nth 1 event)))
|
|
|
|
|
(scale (nth 4 event))
|
|
|
|
|
(dx (nth 2 event))
|
|
|
|
|
(dy (nth 3 event))
|
|
|
|
|
(angle (nth 5 event)))
|
|
|
|
|
(with-selected-window window
|
|
|
|
|
(when (and (zerop dx)
|
|
|
|
|
(zerop dy)
|
2021-12-28 06:05:32 +00:00
|
|
|
|
(zerop angle))
|
2021-12-26 05:47:23 +00:00
|
|
|
|
(setq text-scale--pinch-start-scale
|
|
|
|
|
(if text-scale-mode text-scale-mode-amount 0)))
|
|
|
|
|
(text-scale-set
|
|
|
|
|
(+ text-scale--pinch-start-scale
|
|
|
|
|
(round (log scale text-scale-mode-step)))))))
|
|
|
|
|
|
2022-07-02 13:40:45 +00:00
|
|
|
|
(defcustom global-text-scale-adjust-resizes-frames nil
|
|
|
|
|
"Whether `global-text-scale-adjust' resizes the frames."
|
|
|
|
|
:type '(choice (const :tag "Off" nil)
|
|
|
|
|
(const :tag "On" t))
|
|
|
|
|
:group 'display
|
2022-07-02 14:52:23 +00:00
|
|
|
|
:version "29.1")
|
2022-07-02 13:40:45 +00:00
|
|
|
|
|
|
|
|
|
(defcustom global-text-scale-adjust-limits '(10 . 500)
|
|
|
|
|
"Min/max values for `global-text-scale-adjust'.
|
|
|
|
|
This is a cons cell where the `car' has the minimum font size and
|
2022-07-02 14:52:23 +00:00
|
|
|
|
the `cdr' has the maximum font size, in units of 1/10 pt."
|
2022-07-02 13:40:45 +00:00
|
|
|
|
:version "29.1"
|
|
|
|
|
:group 'display
|
|
|
|
|
:type '(cons (integer :tag "Min")
|
|
|
|
|
(integer :tag "Max")))
|
|
|
|
|
|
|
|
|
|
(defvar global-text-scale-adjust--default-height nil)
|
|
|
|
|
|
2022-11-19 15:46:46 +00:00
|
|
|
|
(defvar global-text-scale-adjust--increment-factor 5)
|
|
|
|
|
|
2022-07-02 13:40:45 +00:00
|
|
|
|
;;;###autoload (define-key ctl-x-map [(control meta ?+)] 'global-text-scale-adjust)
|
|
|
|
|
;;;###autoload (define-key ctl-x-map [(control meta ?=)] 'global-text-scale-adjust)
|
|
|
|
|
;;;###autoload (define-key ctl-x-map [(control meta ?-)] 'global-text-scale-adjust)
|
|
|
|
|
;;;###autoload (define-key ctl-x-map [(control meta ?0)] 'global-text-scale-adjust)
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun global-text-scale-adjust (increment)
|
2022-11-13 06:56:35 +00:00
|
|
|
|
"Change (a.k.a. \"adjust\") the font size of all faces by INCREMENT.
|
2022-07-02 13:40:45 +00:00
|
|
|
|
|
2022-11-13 06:56:35 +00:00
|
|
|
|
Interactively, INCREMENT is the prefix numeric argument, and defaults
|
|
|
|
|
to 1. Positive values of INCREMENT increase the font size, negative
|
|
|
|
|
values decrease it.
|
2022-07-02 13:40:45 +00:00
|
|
|
|
|
2022-11-13 06:56:35 +00:00
|
|
|
|
When you invoke this command, it performs the initial change of the
|
|
|
|
|
font size, and after that allows further changes by typing one of the
|
|
|
|
|
following keys immediately after invoking the command:
|
2022-07-02 13:40:45 +00:00
|
|
|
|
|
2022-07-04 14:54:38 +00:00
|
|
|
|
\\`+', \\`=' Globally increase the height of the default face
|
|
|
|
|
\\`-' Globally decrease the height of the default face
|
|
|
|
|
\\`0' Globally reset the height of the default face
|
2022-07-02 13:40:45 +00:00
|
|
|
|
|
2022-11-13 06:56:35 +00:00
|
|
|
|
(The change of the font size produced by these keys depends on the
|
|
|
|
|
final component of the key sequence, with all modifiers removed.)
|
2022-07-02 13:40:45 +00:00
|
|
|
|
|
2022-07-14 10:43:52 +00:00
|
|
|
|
Buffer-local face adjustments have higher priority than global
|
2022-07-02 13:40:45 +00:00
|
|
|
|
face adjustments.
|
|
|
|
|
|
|
|
|
|
The variable `global-text-scale-adjust-resizes-frames' controls
|
|
|
|
|
whether the frames are resized to keep the same number of lines
|
|
|
|
|
and characters per line when the font size is adjusted.
|
|
|
|
|
|
2022-11-19 15:46:46 +00:00
|
|
|
|
See also the related command `text-scale-adjust'. Unlike that
|
|
|
|
|
command, which scales the font size with a factor,
|
|
|
|
|
`global-text-scale-adjust' scales the font size with an
|
|
|
|
|
increment."
|
2022-07-02 13:40:45 +00:00
|
|
|
|
(interactive "p")
|
|
|
|
|
(when (display-graphic-p)
|
|
|
|
|
(unless global-text-scale-adjust--default-height
|
|
|
|
|
(setq global-text-scale-adjust--default-height
|
|
|
|
|
(face-attribute 'default :height)))
|
|
|
|
|
(let* ((key (event-basic-type last-command-event))
|
|
|
|
|
(echo-keystrokes nil)
|
|
|
|
|
(cur (face-attribute 'default :height))
|
|
|
|
|
(inc
|
|
|
|
|
(pcase key
|
2022-11-19 15:46:46 +00:00
|
|
|
|
(?- (* (- increment)
|
|
|
|
|
global-text-scale-adjust--increment-factor))
|
2022-07-02 13:40:45 +00:00
|
|
|
|
(?0 (- global-text-scale-adjust--default-height cur))
|
2022-11-19 15:46:46 +00:00
|
|
|
|
(_ (* increment
|
|
|
|
|
global-text-scale-adjust--increment-factor))))
|
2022-07-02 13:40:45 +00:00
|
|
|
|
(new (+ cur inc)))
|
|
|
|
|
(when (< (car global-text-scale-adjust-limits)
|
|
|
|
|
new
|
|
|
|
|
(cdr global-text-scale-adjust-limits))
|
|
|
|
|
(let ((frame-inhibit-implied-resize
|
|
|
|
|
(not global-text-scale-adjust-resizes-frames)))
|
2022-11-19 15:46:46 +00:00
|
|
|
|
(set-face-attribute 'default nil :height new)
|
|
|
|
|
(redisplay 'force)
|
|
|
|
|
(when (and (not (and (characterp key) (= key ?0)))
|
|
|
|
|
(= cur (face-attribute 'default :height)))
|
|
|
|
|
(setq global-text-scale-adjust--increment-factor
|
|
|
|
|
(1+ global-text-scale-adjust--increment-factor))
|
|
|
|
|
(global-text-scale-adjust increment))))
|
2022-07-02 13:40:45 +00:00
|
|
|
|
(when (characterp key)
|
|
|
|
|
(set-transient-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(dolist (mod '(() (control meta)))
|
|
|
|
|
(dolist (key '(?+ ?= ?- ?0))
|
|
|
|
|
(define-key map (vector (append mod (list key)))
|
|
|
|
|
'global-text-scale-adjust)))
|
2022-07-06 17:39:41 +00:00
|
|
|
|
map)
|
|
|
|
|
nil nil
|
|
|
|
|
"Use %k for further adjustment")))))
|
2022-07-02 13:40:45 +00:00
|
|
|
|
|
2008-06-03 11:05:52 +00:00
|
|
|
|
|
|
|
|
|
;; ----------------------------------------------------------------
|
2008-06-17 11:27:51 +00:00
|
|
|
|
;; buffer-face-mode
|
2008-06-03 11:05:52 +00:00
|
|
|
|
|
2008-06-17 11:27:51 +00:00
|
|
|
|
(defcustom buffer-face-mode-face 'variable-pitch
|
|
|
|
|
"The face specification used by `buffer-face-mode'.
|
|
|
|
|
It may contain any value suitable for a `face' text property,
|
2021-09-22 18:26:40 +00:00
|
|
|
|
including a face name, a list of face names, a face attribute
|
2008-06-17 11:27:51 +00:00
|
|
|
|
plist, etc."
|
2013-12-28 08:21:33 +00:00
|
|
|
|
:type '(choice (face)
|
|
|
|
|
(repeat :tag "List of faces" face)
|
|
|
|
|
(plist :tag "Face property list"))
|
2008-12-15 16:45:55 +00:00
|
|
|
|
:group 'display
|
|
|
|
|
:version "23.1")
|
2008-06-03 11:05:52 +00:00
|
|
|
|
|
2008-06-17 11:27:51 +00:00
|
|
|
|
;; current remapping cookie for buffer-face-mode
|
Prefer defvar-local in remaining libraries
* lisp/align.el (align-mode-rules-list)
(align-mode-exclude-rules-list):
* lisp/bookmark.el (bookmark-current-bookmark)
(bookmark-annotation-name)
(bookmark--annotation-from-bookmark-list):
* lisp/calc/calc-embed.el (calc-embedded-all-active)
(calc-embedded-some-active):
* lisp/comint.el (comint-password-function):
* lisp/completion.el (completion-syntax-table):
* lisp/dframe.el (dframe-track-mouse-function)
(dframe-help-echo-function, dframe-mouse-click-function)
(dframe-mouse-position-function, dframe-timer)
(dframe-attached-frame, dframe-controlled):
* lisp/ehelp.el (electric-help-orig-major-mode):
* lisp/eshell/esh-util.el (eshell-path-env):
* lisp/expand.el (expand-pos, expand-index, expand-point):
* lisp/face-remap.el (text-scale-mode-remapping)
(text-scale-mode-lighter, text-scale-mode-amount)
(text-scale-remap-header-line, buffer-face-mode-remapping):
* lisp/ffap.el (ffap-menu-alist):
* lisp/files-x.el (connection-local-variables-alist):
* lisp/foldout.el (foldout-fold-list, foldout-mode-line-string):
* lisp/follow.el (follow-start-end-invalid):
* lisp/forms.el (forms--mode-setup):
* lisp/gnus/message.el (message-cross-post-old-target)
(message-options):
* lisp/help-mode.el (help-xref-stack, help-xref-forward-stack)
(help-xref-stack-item, help-xref-stack-forward-item):
* lisp/hexl.el (hexl-mode--old-var-vals, hexl-ascii-overlay):
* lisp/hilit-chg.el (hilit-chg-string):
* lisp/ido.el (ido-eoinput):
* lisp/imenu.el (imenu-generic-expression)
(imenu-create-index-function, imenu-default-goto-function)
(imenu-prev-index-position-function)
(imenu-extract-index-name-function, imenu-name-lookup-function)
(imenu-syntax-alist, imenu-case-fold-search):
* lisp/jka-compr.el (jka-compr-really-do-compress):
* lisp/language/ethio-util.el (ethio-prefer-ascii-space):
* lisp/leim/quail/hangul.el (hangul-input-method-help-text):
* lisp/leim/quail/japanese.el (quail-japanese-package-saved):
* lisp/linum.el (linum-overlays, linum-available):
* lisp/man.el (Man-original-frame, Man-arguments, Man--sections)
(Man--refpages, Man-page-list, Man-current-page)
(Man-page-mode-string):
* lisp/pcomplete.el (pcomplete-current-completions)
(pcomplete-last-completion-length)
(pcomplete-last-completion-stub, pcomplete-last-completion-raw)
(pcomplete-last-window-config, pcomplete-window-restore-timer):
* lisp/reveal.el (reveal-open-spots, reveal-last-tick):
* lisp/ruler-mode.el (ruler-mode):
* lisp/scroll-lock.el (scroll-lock-preserve-screen-pos-save):
* lisp/server.el (server-buffer-clients, server-existing-buffer):
* lisp/tab-line.el (tab-line-exclude):
* lisp/tar-mode.el (tar-data-buffer, tar-data-swapped):
* lisp/thumbs.el (thumbs-current-tmp-filename)
(thumbs-current-image-filename, thumbs-extra-images)
(thumbs-image-num, thumbs-buffer, thumbs-marked-list):
* lisp/tutorial.el (tutorial--point-before-chkeys)
(tutorial--point-after-chkeys, tutorial--lang):
* lisp/url/url-vars.el (url-current-object)
(url-current-mime-headers, url-current-lastloc):
* lisp/view.el (view-mode, view-old-buffer-read-only)
(view-old-Helper-return-blurb, view-page-size)
(view-half-page-size, view-last-regexp, view-return-to-alist)
(view-exit-action, view-overlay):
* lisp/wid-edit.el (widget-global-map, widget-field-new)
(widget-field-list, widget-field-last, widget-field-was):
* lisp/woman.el (woman-imenu-done): Prefer defvar-local.
2021-02-02 08:55:40 +00:00
|
|
|
|
(defvar-local buffer-face-mode-remapping nil)
|
2008-06-03 11:05:52 +00:00
|
|
|
|
|
2008-06-05 00:11:16 +00:00
|
|
|
|
;;;###autoload
|
2008-06-17 11:27:51 +00:00
|
|
|
|
(define-minor-mode buffer-face-mode
|
|
|
|
|
"Minor mode for a buffer-specific default face.
|
2018-07-02 03:34:53 +00:00
|
|
|
|
|
|
|
|
|
When enabled, the face specified by the variable
|
|
|
|
|
`buffer-face-mode-face' is used to display the buffer text."
|
2008-06-17 11:27:51 +00:00
|
|
|
|
:lighter " BufFace"
|
|
|
|
|
(when buffer-face-mode-remapping
|
|
|
|
|
(face-remap-remove-relative buffer-face-mode-remapping))
|
|
|
|
|
(setq buffer-face-mode-remapping
|
|
|
|
|
(and buffer-face-mode
|
|
|
|
|
(face-remap-add-relative 'default buffer-face-mode-face)))
|
2008-06-03 11:05:52 +00:00
|
|
|
|
(force-window-update (current-buffer)))
|
|
|
|
|
|
2008-06-17 11:27:51 +00:00
|
|
|
|
;;;###autoload
|
2008-06-20 08:55:22 +00:00
|
|
|
|
(defun buffer-face-set (&rest specs)
|
|
|
|
|
"Enable `buffer-face-mode', using face specs SPECS.
|
2012-06-09 06:26:46 +00:00
|
|
|
|
Each argument in SPECS should be a face, i.e. either a face name
|
|
|
|
|
or a property list of face attributes and values. If more than
|
|
|
|
|
one face is listed, that specifies an aggregate face, like in a
|
|
|
|
|
`face' text property. If SPECS is nil or omitted, disable
|
|
|
|
|
`buffer-face-mode'.
|
|
|
|
|
|
|
|
|
|
This function makes the variable `buffer-face-mode-face' buffer
|
|
|
|
|
local, and sets it to FACE."
|
2013-04-13 01:10:09 +00:00
|
|
|
|
(interactive (list (read-face-name "Set buffer face" (face-at-point t))))
|
2008-06-20 08:55:22 +00:00
|
|
|
|
(while (and (consp specs) (null (cdr specs)))
|
|
|
|
|
(setq specs (car specs)))
|
|
|
|
|
(if (null specs)
|
2008-06-17 11:27:51 +00:00
|
|
|
|
(buffer-face-mode 0)
|
2020-12-09 08:44:38 +00:00
|
|
|
|
(setq-local buffer-face-mode-face specs)
|
2008-06-17 11:27:51 +00:00
|
|
|
|
(buffer-face-mode t)))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2008-06-20 08:55:22 +00:00
|
|
|
|
(defun buffer-face-toggle (&rest specs)
|
|
|
|
|
"Toggle `buffer-face-mode', using face specs SPECS.
|
2012-06-09 06:26:46 +00:00
|
|
|
|
Each argument in SPECS should be a face, i.e. either a face name
|
|
|
|
|
or a property list of face attributes and values. If more than
|
|
|
|
|
one face is listed, that specifies an aggregate face, like in a
|
|
|
|
|
`face' text property.
|
2008-06-17 11:27:51 +00:00
|
|
|
|
|
|
|
|
|
If `buffer-face-mode' is already enabled, and is currently using
|
2013-06-18 10:52:07 +00:00
|
|
|
|
the face specs SPECS, then it is disabled; if `buffer-face-mode'
|
|
|
|
|
is disabled, or is enabled and currently displaying some other
|
|
|
|
|
face, then is left enabled, but the face changed to reflect SPECS.
|
2008-06-20 08:55:22 +00:00
|
|
|
|
|
|
|
|
|
This function will make the variable `buffer-face-mode-face'
|
|
|
|
|
buffer local, and set it to SPECS."
|
2008-06-17 11:27:51 +00:00
|
|
|
|
(interactive (list buffer-face-mode-face))
|
2008-06-20 08:55:22 +00:00
|
|
|
|
(while (and (consp specs) (null (cdr specs)))
|
|
|
|
|
(setq specs (car specs)))
|
|
|
|
|
(if (or (null specs)
|
|
|
|
|
(and buffer-face-mode (equal buffer-face-mode-face specs)))
|
2008-06-17 11:27:51 +00:00
|
|
|
|
(buffer-face-mode 0)
|
2020-12-09 08:44:38 +00:00
|
|
|
|
(setq-local buffer-face-mode-face specs)
|
2008-06-17 11:27:51 +00:00
|
|
|
|
(buffer-face-mode t)))
|
|
|
|
|
|
2008-06-20 08:55:22 +00:00
|
|
|
|
(defun buffer-face-mode-invoke (specs arg &optional interactive)
|
2013-06-18 10:52:07 +00:00
|
|
|
|
"Enable or disable `buffer-face-mode' using face specs SPECS.
|
2008-06-20 08:55:22 +00:00
|
|
|
|
ARG controls whether the mode is enabled or disabled, and is
|
|
|
|
|
interpreted in the usual manner for minor-mode commands.
|
|
|
|
|
|
2012-06-09 06:26:46 +00:00
|
|
|
|
SPECS can be any value suitable for a `face' text property,
|
2013-06-18 10:52:07 +00:00
|
|
|
|
including a face name, a plist of face attributes and values,
|
|
|
|
|
or a list of faces.
|
2008-06-20 08:55:22 +00:00
|
|
|
|
|
2012-06-09 06:26:46 +00:00
|
|
|
|
If INTERACTIVE is non-nil, display a message describing the
|
|
|
|
|
result.
|
2008-06-20 08:55:22 +00:00
|
|
|
|
|
2008-06-21 06:51:23 +00:00
|
|
|
|
This is a wrapper function which calls `buffer-face-set' or
|
2008-06-20 08:55:22 +00:00
|
|
|
|
`buffer-face-toggle' (depending on ARG), and prints a status
|
|
|
|
|
message in the echo area. In many cases one of those functions
|
|
|
|
|
may be more appropriate."
|
2008-06-17 11:27:51 +00:00
|
|
|
|
(let ((last-message (current-message)))
|
|
|
|
|
(if (or (eq arg 'toggle) (not arg))
|
2008-06-20 09:00:52 +00:00
|
|
|
|
(buffer-face-toggle specs)
|
|
|
|
|
(buffer-face-set (and (> (prefix-numeric-value arg) 0) specs)))
|
2008-06-17 11:27:51 +00:00
|
|
|
|
(when interactive
|
|
|
|
|
(unless (and (current-message)
|
|
|
|
|
(not (equal last-message (current-message))))
|
|
|
|
|
(message "Buffer-Face mode %sabled"
|
|
|
|
|
(if buffer-face-mode "en" "dis"))))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; ----------------------------------------------------------------
|
|
|
|
|
;; variable-pitch-mode
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun variable-pitch-mode (&optional arg)
|
|
|
|
|
"Variable-pitch default-face mode.
|
|
|
|
|
An interface to `buffer-face-mode' which uses the `variable-pitch' face.
|
|
|
|
|
Besides the choice of face, it is the same as `buffer-face-mode'."
|
|
|
|
|
(interactive (list (or current-prefix-arg 'toggle)))
|
2019-10-09 01:55:09 +00:00
|
|
|
|
(buffer-face-mode-invoke 'variable-pitch (or arg t)
|
2009-10-02 03:48:36 +00:00
|
|
|
|
(called-interactively-p 'interactive)))
|
2008-06-17 11:27:51 +00:00
|
|
|
|
|
2008-06-03 11:05:52 +00:00
|
|
|
|
|
|
|
|
|
(provide 'face-remap)
|
|
|
|
|
|
|
|
|
|
;;; face-remap.el ends here
|