[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/logos f2a4d5dbca 4/6: Give more descriptive names to fu
From: |
ELPA Syncer |
Subject: |
[elpa] externals/logos f2a4d5dbca 4/6: Give more descriptive names to functions that set state |
Date: |
Tue, 20 Jun 2023 09:59:21 -0400 (EDT) |
branch: externals/logos
commit f2a4d5dbcab0e157c258ce0fa31dae19b0ee9bf2
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Give more descriptive names to functions that set state
---
README.org | 12 ++++++------
logos.el | 33 ++++++++++++++++++++++-----------
2 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/README.org b/README.org
index fda7cdeee3..c0dfb45d3b 100644
--- a/README.org
+++ b/README.org
@@ -511,8 +511,8 @@ functionality of ~logos-focus-mode~ at the user level
([[#h:a2540f2f-1159-4e5c-a
(when my-logos-org-indent
;; Disable `org-indent-mode' when `logos-focus-mode' is enabled and
;; restore it when `logos-focus-mode' is disabled. The
- ;; `logos--mode' function takes care of the technicalities.
- (logos--mode 'org-indent-mode -1)))
+ ;; `logos-set-mode-arg' function takes care of the technicalities.
+ (logos-set-mode-arg 'org-indent-mode -1)))
(add-hook 'logos-focus-mode-hook #'my-logos-org-indent)
#+end_src
@@ -526,8 +526,8 @@ not needed, the following will suffice:
"Set `my-logos-org-indent' in `logos-focus-mode'."
;; Disable `org-indent-mode' when `logos-focus-mode' is enabled and
;; restore it when `logos-focus-mode' is disabled. The
- ;; `logos--mode' function takes care of the technicalities.
- (logos--mode 'org-indent-mode -1))
+ ;; `logos-set-mode-arg' function takes care of the technicalities.
+ (logos-set-mode-arg 'org-indent-mode -1))
(add-hook 'logos-focus-mode-hook #'my-logos-org-indent)
#+end_src
@@ -544,13 +544,13 @@ to disable the ~menu-bar-mode~ and ~tool-bar-mode~ when
activating the
#+begin_src emacs-lisp
;; Assuming the `menu-bar-mode' is enabled by default...
(defun my-logos-hide-menu-bar ()
- (logos--mode 'menu-bar-mode -1))
+ (logos-set-mode-arg 'menu-bar-mode -1))
(add-hook 'logos-focus-mode-hook #'my-logos-hide-menu-bar)
;; Assuming the `tool-bar-mode' is enabled by default...
(defun my-logos-hide-tool-bar ()
- (logos--mode 'tool-bar-mode -1))
+ (logos-set-mode-arg 'tool-bar-mode -1))
(add-hook 'logos-focus-mode-hook #'my-logos-hide-tool-bar)
#+end_src
diff --git a/logos.el b/logos.el
index 5f17a89363..e6b3303d9c 100644
--- a/logos.el
+++ b/logos.el
@@ -406,11 +406,17 @@ If narrowing is in effect, widen the view."
;;;; Optional "focus mode" and utilities
-;; I learnt about the method of using `logos--mode' and `logos--set'
-;; from Daniel Mendler: <https://github.com/minad>.
+;; I learnt about the method of using `logos-set-mode-arg' and
+;; `logos-set-buffer-local-value' from Daniel Mendler:
+;; <https://github.com/minad>.
(defvar-local logos--restore nil)
-(defun logos--mode (mode arg)
+(define-obsolete-function-alias
+ 'logos--mode
+ 'logos-set-mode-arg
+ "1.1.0")
+
+(defun logos-set-mode-arg (mode arg)
"Set MODE to ARG.
ARG is either 1 or -1. The current value changes to its
alternate, thus toggling MODE."
@@ -419,7 +425,12 @@ alternate, thus toggling MODE."
(push (lambda () (funcall mode old)) logos--restore)
(funcall mode arg))))
-(defun logos--set (var val)
+(define-obsolete-function-alias
+ 'logos--set
+ 'logos-set-buffer-local-value
+ "1.1.0")
+
+(defun logos-set-buffer-local-value (var val)
"Set VAR to buffer-local VAL."
(let ((old (and (boundp var) (symbol-value var))))
(unless (equal old val)
@@ -478,22 +489,22 @@ options: `logos-scroll-lock', `logos-variable-pitch',
(defun logos--variable-pitch ()
"Set `logos-variable-pitch'."
(when (and logos-variable-pitch (not (derived-mode-p 'prog-mode)))
- (logos--mode 'variable-pitch-mode 1)))
+ (logos-set-mode-arg 'variable-pitch-mode 1)))
(defun logos--scroll-lock ()
"Set `logos-scroll-lock'."
(when logos-scroll-lock
- (logos--mode 'scroll-lock-mode 1)))
+ (logos-set-mode-arg 'scroll-lock-mode 1)))
(defun logos--indicate-buffer-boundaries ()
"Set `logos-hide-buffer-boundaries'."
(when logos-hide-buffer-boundaries
- (logos--set 'indicate-buffer-boundaries nil)))
+ (logos-set-buffer-local-value 'indicate-buffer-boundaries nil)))
(defun logos--hide-cursor ()
"Set `logos-hide-cursor'."
(when logos-hide-cursor
- (logos--set 'cursor-type nil)))
+ (logos-set-buffer-local-value 'cursor-type nil)))
;; FIXME 2022-03-13: The mode line is not redrawn properly. Not even
;; with `force-mode-line-update', unless something happens like
@@ -509,17 +520,17 @@ options: `logos-scroll-lock', `logos-variable-pitch',
(defun logos--hide-mode-line ()
"Set `logos-hide-mode-line'."
(when logos-hide-mode-line
- (logos--set 'mode-line-format nil)))
+ (logos-set-buffer-local-value 'mode-line-format nil)))
(defun logos--buffer-read-only ()
"Set `logos-buffer-read-only'."
(when logos-buffer-read-only
- (logos--set 'buffer-read-only t)))
+ (logos-set-buffer-local-value 'buffer-read-only t)))
(defun logos--olivetti ()
"Set `logos-olivetti'."
(when (and logos-olivetti (require 'olivetti nil t))
- (logos--mode 'olivetti-mode 1)))
+ (logos-set-mode-arg 'olivetti-mode 1)))
(defvar-local logos--fringe-remap-cookie nil
"Cookie of remapped `fringe' face.")
- [elpa] externals/logos updated (273464accc -> 88beb0aa7b), ELPA Syncer, 2023/06/20
- [elpa] externals/logos 6fbba45fa0 1/6: Rename logos-focus-mode-hook for correctness, ELPA Syncer, 2023/06/20
- [elpa] externals/logos f2a4d5dbca 4/6: Give more descriptive names to functions that set state,
ELPA Syncer <=
- [elpa] externals/logos 3ccd6b6cf5 5/6: Rephrase some statements in the manual, ELPA Syncer, 2023/06/20
- [elpa] externals/logos af64c193a9 2/6: Remove some needless private function notation from the manual, ELPA Syncer, 2023/06/20
- [elpa] externals/logos fcc13bf490 3/6: Make logos-page-delimiter function and variable public, ELPA Syncer, 2023/06/20
- [elpa] externals/logos 88beb0aa7b 6/6: Update to version 1.1.0, ELPA Syncer, 2023/06/20