Fix several linting errors (#68)

Also add @alphapapa's makem scripts
This commit is contained in:
Jethro Kuan
2020-02-13 13:20:48 +08:00
committed by GitHub
parent ede33d7411
commit 1cfd71f5a8
4 changed files with 1147 additions and 11 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/.sandbox/

56
Makefile Normal file
View File

@ -0,0 +1,56 @@
# * makem.sh/Makefile --- Script to aid building and testing Emacs Lisp packages
# This Makefile is from the makem.sh repo: <https://github.com/alphapapa/makem.sh>.
# * Arguments
# For consistency, we use only var=val options, not hyphen-prefixed options.
# NOTE: I don't like duplicating the arguments here and in makem.sh,
# but I haven't been able to find a way to pass arguments which
# conflict with Make's own arguments through Make to the script.
# Using -- doesn't seem to do it.
ifdef install-deps
INSTALL_DEPS = "--install-deps"
endif
ifdef install-linters
INSTALL_LINTERS = "--install-linters"
endif
ifdef sandbox
ifeq ($(sandbox), t)
SANDBOX = --sandbox
else
SANDBOX = --sandbox $(sandbox)
endif
endif
ifdef debug
DEBUG = "--debug"
endif
# ** Verbosity
# Since the "-v" in "make -v" gets intercepted by Make itself, we have
# to use a variable.
verbose = $(v)
ifneq (,$(findstring vv,$(verbose)))
VERBOSE = "-vv"
else ifneq (,$(findstring v,$(verbose)))
VERBOSE = "-v"
endif
# * Rules
# TODO: Handle cases in which "test" or "tests" are called and a
# directory by that name exists, which can confuse Make.
%:
@./makem.sh $(DEBUG) $(VERBOSE) $(SANDBOX) $(INSTALL_DEPS) $(INSTALL_LINTERS) $(@)
.DEFAULT: init
init:
@./makem.sh $(DEBUG) $(VERBOSE) $(SANDBOX) $(INSTALL_DEPS) $(INSTALL_LINTERS)

1079
makem.sh Executable file

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@
;; URL: https://github.com/jethrokuan/org-roam
;; Keywords: org-mode, roam, convenience
;; Version: 0.1.0
;; Package-Requires: ((emacs "25.1"))
;; Package-Requires: ((emacs "25.1") (dash "2.13") (f "0.17.2") (s "1.12.0") (async "1.9.4"))
;; This file is NOT part of GNU Emacs.
@ -78,7 +78,9 @@ Valid values are
:group 'org-roam)
(defcustom org-roam-use-timestamp-as-filename t
"Whether to use timestamp as a file name. If not true, prompt for a file name each time.")
"Whether to use timestamp as a file name. If not true, prompt for a file name each time."
:type 'boolean
:group 'org-roam)
(defcustom org-roam-autopopulate-title t "Whether to autopopulate the title."
:type 'boolean
@ -234,7 +236,7 @@ If not provided, derive the title from the file name."
(unless (string= "org" (file-name-extension file-path))
(setq file-path (concat file-path ".org")))
(if (file-exists-p file-path)
(error (format "Aborting, file already exists at " file-path))
(error (format "Aborting, file already exists at %s" file-path))
(if org-roam-autopopulate-title
(org-roam--populate-title file-path title)
(make-empty-file file-path))))
@ -657,19 +659,17 @@ This needs to be quick/infrequent, because this is run at
(org-roam--ensure-cache-built)
(with-temp-buffer
(insert "digraph {\n")
(mapcar (lambda (file)
(insert
(format " \"%s\" [URL=\"roam://%s\"];\n"
(org-roam--get-title-or-slug file)
file)))
(org-roam--find-all-files))
(dolist (file (org-roam--find-all-files))
(insert
(format " \"%s\" [URL=\"roam://%s\"];\n"
(org-roam--get-title-or-slug file)
file)))
(maphash
(lambda (from-link to-links)
(dolist (to-link to-links)
(insert (format " \"%s\" -> \"%s\";\n"
(org-roam--get-title-or-slug from-link)
(org-roam--get-title-or-slug to-link))))
)
(org-roam--get-title-or-slug to-link)))))
org-roam-forward-links-cache)
(insert "}")
(buffer-string)))