Skip to content

Refactor status lighter#95

Open
Grimpper wants to merge 2 commits intopurcell:masterfrom
Grimpper:refactor-status-lighter
Open

Refactor status lighter#95
Grimpper wants to merge 2 commits intopurcell:masterfrom
Grimpper:refactor-status-lighter

Conversation

@Grimpper
Copy link
Contributor

@Grimpper Grimpper commented Jan 1, 2025

Hello!

This PR refactors the status lighter and relies on mode-line-misc-info instead. This goes in line with what other packages do, such as notmuch-indicator.

In addition to the new changes, it also includes a new state, denied. This states indicates that the environment has not being loaded due to an invocation of direnv deny that has blocked the directory.

This is how it looks:
image

If needed, checking if the envrc directory is allowed, can be implemented with
the following procedures:
```
(defun envrc--allowed-p (env-dir)
  "Return TRUE if ENV-DIR is blocked."
  (let ((allow-hash (envrc--find-allow-hash env-dir))
        (deny-path (concat (or (getenv "XDG_DATA_HOME")
                               (concat (getenv "HOME") "/.local/share"))
                           "/direnv/allow")))
      (locate-file allow-hash
                   (list deny-path))))

(defun envrc--allowed-p (env-dir)
  "Return TRUE if ENV-DIR is blocked."
  (let ((allow-hash (envrc--find-allow-hash env-dir))
        (deny-path (concat (or (getenv "XDG_DATA_HOME")
                               (concat (getenv "HOME") "/.local/share"))
                           "/direnv/allow")))
      (locate-file allow-hash
                   (list deny-path))))
```
@Grimpper Grimpper force-pushed the refactor-status-lighter branch from 3118603 to df9eaab Compare January 10, 2025 19:34
@Grimpper Grimpper mentioned this pull request Mar 12, 2026
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant