Skip to content

Commit

Permalink
Merge branch 'main' into fix/zk-id-regexp-match-group-references
Browse files Browse the repository at this point in the history
  • Loading branch information
localauthor authored Jan 19, 2025
2 parents a99dfc5 + 2bd80f7 commit e77c675
Show file tree
Hide file tree
Showing 11 changed files with 235 additions and 217 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/melpazoid-zk-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v1
with: { python-version: 3.9 }
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install
run: |
python -m pip install --upgrade pip
Expand All @@ -24,7 +25,7 @@ jobs:
env:
LOCAL_REPO: ${{ github.workspace }}
# RECIPE is your recipe as written for MELPA:
RECIPE: (zk-desktop :repo "localauthor/zk" :fetcher github :files ("zk-desktop.el"))
RECIPE: (zk-desktop :fetcher github :repo "localauthor/zk" :files ("zk-desktop.el"))
# set this to false (or remove it) if the package isn't on MELPA:
EXIST_OK: false
EXIST_OK: true
run: echo $GITHUB_REF && make -C ~/melpazoid
11 changes: 6 additions & 5 deletions .github/workflows/melpazoid-zk-index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v1
with: { python-version: 3.9 }
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install
run: |
python -m pip install --upgrade pip
Expand All @@ -24,7 +25,7 @@ jobs:
env:
LOCAL_REPO: ${{ github.workspace }}
# RECIPE is your recipe as written for MELPA:
RECIPE: (zk-index :repo "localauthor/zk" :fetcher github :files ("zk-index.el"))
RECIPE: (zk-index :fetcher github :repo "localauthor/zk" :files ("zk-index.el"))
# set this to false (or remove it) if the package isn't on MELPA:
EXIST_OK: true
run: echo $GITHUB_REF && make -C ~/melpazoid
11 changes: 6 additions & 5 deletions .github/workflows/melpazoid-zk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v1
with: { python-version: 3.9 }
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install
run: |
python -m pip install --upgrade pip
Expand All @@ -24,7 +25,7 @@ jobs:
env:
LOCAL_REPO: ${{ github.workspace }}
# RECIPE is your recipe as written for MELPA:
RECIPE: (zk :repo "localauthor/zk" :fetcher github :files ("zk.el"))
RECIPE: (zk :fetcher github :repo "localauthor/zk" :files ("zk.el"))
# set this to false (or remove it) if the package isn't on MELPA:
EXIST_OK: true
run: echo $GITHUB_REF && make -C ~/melpazoid
2 changes: 1 addition & 1 deletion README.org
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ with no subdirectories.

Each note is a separate file, named as follows: a unique ID number followed
by the title of the note followed by the file extension (set in the variable
=zk-extension=), e.g. "202012091130 On the origin of species.txt".
=zk-file-extension=), e.g. "202012091130 On the origin of species.txt".

** IDs and Links

Expand Down
29 changes: 14 additions & 15 deletions zk-citar.el
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
;;; zk-citar.el --- Citar integration for zk -*- lexical-binding: t; -*-

;; Copyright (C) 2022-2023 Grant Rosson
;; Copyright (C) 2022-2024 Grant Rosson

;; Author: Grant Rosson <https://github.com/localauthor>
;; Created: July 7, 2022
;; License: GPL-3.0-or-later
;; Version: 0.1
;; Homepage: https://github.com/localauthor/zk
;; URL: https://github.com/localauthor/zk
;; Package-Requires: ((emacs "27.1") (citar "0.9.7") (zk "0.4"))
;; Keywords: tools, extensions

Expand Down Expand Up @@ -78,12 +78,11 @@ Must include \"${=key=}\"."
(let* ((files (make-hash-table :test 'equal))
(key-string (string-join keys "\\|"))
(filematch (or key-string zk-citar-citekey-regexp)))
(prog1 files
(dolist (file (zk--directory-files t filematch))
(let ((key (or (car keys)
(and (string-match zk-citar-citekey-regexp file)
(match-string 0 file)))))
(push file (gethash key files)))))))
(dolist (file (zk--directory-files t filematch) files)
(let ((key (or (car keys)
(and (string-match zk-citar-citekey-regexp file)
(match-string 0 file)))))
(push file (gethash key files))))))


;;;; hasitems
Expand All @@ -110,13 +109,13 @@ Must include \"${=key=}\"."

;;;; Register citar-note-source

(citar-register-notes-source 'zk '(:name "zk"
:category zk-file
:items zk-citar--get-notes
:hasitems zk-citar--has-notes
:open find-file
:create zk-citar--create-note
:transform file-name-nondirectory))
(citar-register-notes-source 'zk '( :name "zk"
:category zk-file
:items zk-citar--get-notes
:hasitems zk-citar--has-notes
:open find-file
:create zk-citar--create-note
:transform file-name-nondirectory))

(provide 'zk-citar)
;;; zk-citar.el ends here
35 changes: 18 additions & 17 deletions zk-consult.el
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
;;; zk-consult.el --- Consult integration for zk -*- lexical-binding: t; -*-

;; Copyright (C) 2022-2023 Grant Rosson
;; Copyright (C) 2022-2024 Grant Rosson

;; Author: Grant Rosson <https://github.com/localauthor>
;; Created: January 4, 2022
;; License: GPL-3.0-or-later
;; Version: 0.2
;; Homepage: https://github.com/localauthor/zk
;; URL: https://github.com/localauthor/zk
;; Package-Requires: ((emacs "27.1") (zk "0.4") (consult "0.14"))


Expand Down Expand Up @@ -107,21 +107,22 @@ Select TAG, with completion, from list of all tags in zk notes."
;;; Current Notes Consult Source

(defvar zk-consult-source
`(:name "zk"
:narrow (?z . "zk - current notes")
:hidden n
:category buffer
:history zk-history
:state ,#'consult--buffer-state
:items ,(lambda ()
(remq nil
(mapcar
(lambda (x)
(when
(and (buffer-file-name x)
(zk-file-p (buffer-file-name x)))
(buffer-name x)))
(buffer-list))))))
`( :name "zk"
:narrow (?z . "zk - current notes")
:category zk-file
:history zk-history
:new ,#'zk-new-note
:state ,#'consult--buffer-state
:items
,(lambda ()
(consult--buffer-query :sort 'visibility
:as #'consult--buffer-pair
:predicate
(lambda (buf)
(and (buffer-file-name buf)
(zk-file-p
(buffer-file-name buf))))))))


(defun zk-consult-current-notes ()
"Select a currently open note using `consult-buffer'.
Expand Down
13 changes: 6 additions & 7 deletions zk-desktop.el
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
;;; zk-desktop.el --- Desktop environment for zk -*- lexical-binding: t; -*-

;; Copyright (C) 2022-2023 Grant Rosson
;; Copyright (C) 2022-2024 Grant Rosson

;; Author: Grant Rosson <https://github.com/localauthor>
;; Created: November 4, 2022
;; License: GPL-3.0-or-later
;; Version: 0.1
;; Homepage: https://github.com/localauthor/zk
;; URL: https://github.com/localauthor/zk
;; Package-Requires: ((emacs "27.1")(zk "0.6")(zk-index "0.9"))

;; This program is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -253,9 +253,8 @@ To quickly change this setting, call `zk-desktop-add-toggle'."
(beginning-of-line)
(if new-title
(unless (string= title new-title)
(progn
(search-forward title end)
(replace-match new-title)))
(search-forward title end)
(replace-match new-title))
(progn
(search-forward title end)
(replace-match (propertize title 'face 'error))))
Expand Down Expand Up @@ -342,7 +341,7 @@ on zk-id at point."
(items
(cond
(arg (zk--formatted-string arg zk-index-format))
((eq major-mode 'zk-index-mode)
((derived-mode-p 'zk-index-mode)
(if (use-region-p)
(buffer-substring
(save-excursion
Expand Down Expand Up @@ -383,7 +382,7 @@ on zk-id at point."
(unless (bound-and-true-p truncate-lines)
(toggle-truncate-lines))
(zk-desktop-mode))
(if (eq major-mode 'zk-index-mode)
(if (derived-mode-p 'zk-index-mode)
(message "Sent to %s - press D to switch" buffer)
(message "Sent to %s" buffer))))

Expand Down
Loading

0 comments on commit e77c675

Please sign in to comment.