Skip to content

Gracefully handle missing memy binary and directory in memy-note.lua#3

Merged
andrewferrier merged 2 commits into
mainfrom
copilot/issue-warning-if-memy-not-installed
Jun 12, 2026
Merged

Gracefully handle missing memy binary and directory in memy-note.lua#3
andrewferrier merged 2 commits into
mainfrom
copilot/issue-warning-if-memy-not-installed

Conversation

Copilot AI commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Previously, if memy wasn't installed, the plugin would silently fail or error when trying to run memy hook neovim.lua. This adds an upfront check that warns and exits early instead.

Changes

  • Added a guard at the top of memy-note.lua that checks both vim.fn.executable("memy") and the presence of ~/memy
  • Emits a WARN-level vim.notify only when both the memy binary is missing from $PATH and the ~/memy directory does not exist
  • Returns immediately in that case, skipping all note-taking setup
  • If ~/memy is checked out locally (without a global memy binary), the plugin proceeds as normal
local MEMY_DIR = vim.fn.expand("~/memy")

if vim.fn.executable("memy") == 0 and vim.fn.isdirectory(MEMY_DIR) == 0 then
    vim.notify("memy is not installed; memy note-taking disabled", vim.log.levels.WARN)
    return
end

@andrewferrier

Copy link
Copy Markdown
Owner

@copilot we should also check for presence of ~/memy dir since technically that could be checked out and memy is not installed globally

Copilot AI commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot we should also check for presence of ~/memy dir since technically that could be checked out and memy is not installed globally

Done — the guard now checks both conditions. Noting is only disabled (with a warning) when neither memy is on $PATH nor ~/memy exists. If ~/memy is checked out without a global memy binary, the plugin proceeds as before. (commit: Also check for ~/memy dir presence before disabling memy noting)

Copilot AI changed the title Gracefully handle missing memy binary in memy-note.lua Gracefully handle missing memy binary and directory in memy-note.lua Jun 12, 2026
Copilot AI requested a review from andrewferrier June 12, 2026 08:56
@andrewferrier
andrewferrier marked this pull request as ready for review June 12, 2026 08:57
Copilot AI review requested due to automatic review settings June 12, 2026 08:57
@andrewferrier
andrewferrier merged commit e501a31 into main Jun 12, 2026
@andrewferrier
andrewferrier deleted the copilot/issue-warning-if-memy-not-installed branch June 12, 2026 08:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the Neovim memy-note plugin’s startup behavior by explicitly detecting when neither the memy binary nor a local ~/memy checkout is available, and then warning and exiting early to avoid failures when attempting to run memy hook neovim.lua.

Changes:

  • Added an upfront guard checking vim.fn.executable("memy") and vim.fn.isdirectory("~/memy").
  • Emits a WARN-level vim.notify and returns early only when both the binary and directory are missing.
  • Prevents the code path that shells out to memy hook neovim.lua from running when memy is unavailable.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants