Skip to content

Commit

Permalink
better :mode example
Browse files Browse the repository at this point in the history
  • Loading branch information
licht1stein committed May 4, 2024
1 parent 9421a4c commit 4623a39
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,18 @@ The following example runs the transient if current buffer name is `*scratch*`:
This will check if the built-in project.el project name is equal to this. Same as `:buffer` or `:repo` — just pass a project name as a string.

### Major mode context (`:mode`)
Checks if the current major-mode is this. Note, you need to provided the major mode as a quoted symbol, and not as a string:
Checks if the current major-mode is this. Note, you need to provided the major mode as a quoted symbol, and not as a string. Here's an example of a menu for editing subtitles:

```elisp
(context-transient-define
dired-transient
:doc "My Dired Transient"
:mode 'dired-mode
:menu
[["Dired"
("d" "Dired mode" (lambda () (interactive) (message "This is dired!")))]])
(context-transient-define subed-transient
:doc "Transient for working with subtitles"
:mode 'subed-srt-mode
:menu
["MPV"
("o" "Open video file" subed-mpv-play-from-file)
("O" "Open video url" subed-mpv-play-from-url)
("s" "Toggle sync subs -> player" subed-toggle-sync-player-to-point)
("p" "Toggle sync player -> subs" subed-toggle-sync-point-to-player)])
```

### Any expression context (`:context`)
Expand Down

0 comments on commit 4623a39

Please sign in to comment.