Skip to content

Commit

Permalink
Create auto mode rules lisp
Browse files Browse the repository at this point in the history
  • Loading branch information
danrobi11 authored Dec 19, 2021
1 parent 8073e9a commit cf0cb17
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions auto mode rules lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
;; List of auto-mode rules.
;; It is made to be easily readable and editable, but you still need to remember some things:
;;
;; Every rule starts on a new line and consists of one or more of the following elements:
;; - Condition for rule activation. It is either (match-domain ...),
;; (match-host ...), (match-regex ...) or a string.
;; - :included (optional) -- List of the modes to enable on condition.
;; - :excluded (optional) -- List of the modes to disable on condition.
;; - :exact-p (optional) -- Whether to enable only :included modes and disable
;; everything else (if :exact-p is t), or just add :included and exclude :excluded
;; modes from the current modes list (if :exact-p is nil or not present).
;;
;; Included modes is a list of mode symbols, or a list of lists in the form
;; of (MODE-SYMBOL INIT-ARGS), where init-args are passed to the mode when instantiated.
;;
;; Conditions work this way:
;; - match-domain matches the URL domains only.
;; Example: (match-domain "reddit.com") will work for all of Reddit.
;; - match-host is more specific -- it activates only on certain subdomains of the website.
;; Example: (match-host "old.reddit.com") will work on old Reddit only.
;; - match-regex works for any address that matches a given regex. You can add these manually,
;; but remember: with great regex comes great responsibility!
;; Example: (match-regex "https://github\.com/.*/.*") will activate only in repos on GitHub.
;; - String format matches the exact URL and nothing else
;; Example: "https://lispcookbook.github.io/cl-cookbook/pattern_matching.html"
;; will work on the Pattern Matching article of CL Cookbook, and nowhere else.
;;
;; You can write additional URLs in the bracketed conditions, to reuse the rule for other URL
;; Example: (match-host "reddit.com" "old.reddit.com" "www6.reddit.com")
(
((match-domain "github.com") :included (nowebgl-mode emacs-mode nosound-mode
reduce-tracking-mode
certificate-exception-mode) :exact-p t)
((match-host "old.reddit.com") :included (nowebgl-mode emacs-mode nosound-mode
reduce-tracking-mode
certificate-exception-mode) :exact-p t)
((match-host "discourse.atlas.engineer") :included (nowebgl-mode emacs-mode
nosound-mode
reduce-tracking-mode
certificate-exception-mode) :exact-p t)
((match-host "nyxt.atlas.engineer") :excluded (noscript-mode noscript-mode))
)

0 comments on commit cf0cb17

Please sign in to comment.