spacemacs/layers/+spacemacs/spacemacs-editing-visual/funcs.el
duianto 96438694f4
[base] Add cl- prefix to letf and letf*
The cl package has been deprecated.

It had aliases for cl- prefixed commands without the cl- prefix.
Ex: letf or letf* instead of cl-letf or cl-letf*

On the `spacemacs-base` distribution, with the `ivy` layer.
When one tries to search with `SPC /`
(which calls `spacemacs/counsel-search`)

Then this error message is shown:
>spacemacs/counsel-search: Symbol’s function definition is void: letf*

It doesn't happen with the `helm` layer,
because it's search commands already has the `cl-` prefix.

There are also three instances of: `letf`
in the `spacemacs-editing-visual` layers functions:
- `spacemacs/toggle-centered-buffer` (`SPC w c c`)
- `spacemacs/toggle-distraction-free` (`SPC w c C`)
- `spacemacs/centered-buffer-transient-state` (`SPC w c .`)

Without the `cl-` prefix they show the error message:
>Symbol’s function definition is void: letf
2020-02-08 09:17:52 +00:00

35 lines
1.1 KiB
EmacsLisp

;;; funcs.el --- Spacemacs Editing Visual Layer functions File
;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;; TODO: Allow direct transition between centered and distraction free states.
(defun spacemacs/toggle-centered-buffer ()
"Toggle visual centering of the current buffer."
(interactive)
(cl-letf ((writeroom-maximize-window nil)
(writeroom-mode-line t))
(call-interactively 'writeroom-mode)))
(defun spacemacs/toggle-distraction-free ()
"Toggle visual distraction free mode."
(interactive)
(cl-letf ((writeroom-maximize-window t)
(writeroom-mode-line nil))
(call-interactively 'writeroom-mode)))
(defun spacemacs/centered-buffer-transient-state ()
"Center buffer and enable centering transient state."
(interactive)
(cl-letf ((writeroom-maximize-window nil)
(writeroom-mode-line t))
(writeroom-mode 1)
(spacemacs/centered-buffer-mode-transient-state/body)))