Skip to content

Commit fda3cf6

Browse files
committed
Check for visual wrap mode before attempting to activate
The following case can occur: A user records an expression with one mode active. On a later Emacs version or another user's Emacs, they have a diffent version of `visual-wrap' that contains or does not contain the same functions. These two modes do the equivalent thing. We do support the upgrade path, from adaptive-wrap-prefix mode to visual-wrap-prefix-mode, but not visa versa.
1 parent 4ae41f9 commit fda3cf6

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

NEWS.org

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
#+select_tags: latest
66
#+export_file_name: RELEASE.md
7-
#+options: toc:nil broken-links:nil num:nil
87

9-
* V0.6.1 Stabilizing 🤡 :latest:
8+
* v0.6.2 Insecticide 🐛 :latest:
9+
- Better checks for ~visual-wrap-prefix-mode~
10+
- Avoid warnings for faces
11+
* v0.6.1 Stabilizing 🤡
1012
We are beginning to tag releases. It's almost ready. It should be ready, but in case it is not, don't /just/ blame me. File issues.
1113
** Added 🦙
1214
- ~moc-frame-text-scale-mode~ and related commands

moc.el

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
;; Author: Positron Solutions <contact@positron.solutions>
66
;; Keywords: convenience, outline
7-
;; Version: 0.6.1
7+
;; Version: 0.6.2
88
;; Package-Requires: ((emacs "29.4") (hide-mode-line "1.0.3") (transient "0.7.2"))
99
;; Homepage: http://github.com/positron-solutions/moc
1010

@@ -1028,14 +1028,20 @@ another window will likely leave something to be desired."
10281028
(setq moc--focus-margin-left margin-cols)
10291029
(setq moc--focus-margin-right margin-cols))
10301030
(visual-line-mode 1)
1031-
(when (member 'adaptive-wrap-prefix-mode continuation)
1032-
(if (require 'visual-wrap nil t)
1033-
(visual-wrap-prefix-mode 1)
1034-
(when (fboundp 'adaptive-wrap-prefix-mode)
1035-
(adaptive-wrap-prefix-mode 1))))
1036-
(when (member 'visual-wrap-prefix-mode continuation)
1031+
(when (seq-intersection continuation '(visual-wrap-prefix-mode
1032+
adaptive-wrap-prefix-mode))
10371033
(when (require 'visual-wrap nil t)
1038-
(visual-wrap-prefix-mode 1))))
1034+
(cond ((fboundp 'visual-wrap-prefix-mode)
1035+
(visual-wrap-prefix-mode 1))
1036+
((fboundp 'adaptive-wrap-prefix-mode)
1037+
(adaptive-wrap-prefix-mode 1))
1038+
(t
1039+
(display-warning
1040+
'(moc moc-focus moc-focus-visual)
1041+
(format
1042+
"Could not activate all continuations: %s"
1043+
continuation)
1044+
:warning))))))
10391045
(t
10401046
(let ((margin-cols (1- (floor (/ margin-left
10411047
(frame-char-width))))))

0 commit comments

Comments
 (0)