Compare commits

..

No commits in common. "726f3c19346f2d7df70993a9476aa6714626fe23" and "10b69ad9238739dc999f92ad2a1fe486436b86e7" have entirely different histories.

8 changed files with 450 additions and 512 deletions

1
.gitignore vendored
View File

@ -60,4 +60,3 @@
/projects /projects
/.lsp-session-v1 /.lsp-session-v1
/.cache/ /.cache/
.*.~undo-tree~

View File

@ -1,6 +1,6 @@
(define-package "dash" "20220417.2250" "A modern list library for Emacs" (define-package "dash" "20210826.1149" "A modern list library for Emacs"
'((emacs "24")) '((emacs "24"))
:commit "7fd71338dce041b352f84e7939f6966f4d379459" :authors :commit "39d067b9fbb2db65fc7a6938bfb21489ad990cb4" :authors
'(("Magnar Sveen" . "magnars@gmail.com")) '(("Magnar Sveen" . "magnars@gmail.com"))
:maintainer :maintainer
'("Magnar Sveen" . "magnars@gmail.com") '("Magnar Sveen" . "magnars@gmail.com")

View File

@ -613,9 +613,9 @@ For a side-effecting variant, see also `-each-indexed'."
(nreverse ,r)))) (nreverse ,r))))
(defun -map-when (pred rep list) (defun -map-when (pred rep list)
"Use PRED to conditionally apply REP to each item in LIST. "Return a new list where the elements in LIST that do not match the PRED function
Return a copy of LIST where the items for which PRED returns nil are unchanged, and where the elements in LIST that do match the PRED function are mapped
are unchanged, and the rest are mapped through the REP function. through the REP function.
Alias: `-replace-where' Alias: `-replace-where'
@ -626,9 +626,7 @@ See also: `-update-at'"
(defalias '--replace-where '--map-when) (defalias '--replace-where '--map-when)
(defun -map-first (pred rep list) (defun -map-first (pred rep list)
"Use PRED to determine the first item in LIST to call REP on. "Replace first item in LIST satisfying PRED with result of REP called on this item.
Return a copy of LIST where the first item for which PRED returns
non-nil is replaced with the result of calling REP on that item.
See also: `-map-when', `-replace-first'" See also: `-map-when', `-replace-first'"
(let (front) (let (front)
@ -645,9 +643,7 @@ See also: `-map-when', `-replace-first'"
`(-map-first (lambda (it) ,pred) (lambda (it) (ignore it) ,rep) ,list)) `(-map-first (lambda (it) ,pred) (lambda (it) (ignore it) ,rep) ,list))
(defun -map-last (pred rep list) (defun -map-last (pred rep list)
"Use PRED to determine the last item in LIST to call REP on. "Replace last item in LIST satisfying PRED with result of REP called on this item.
Return a copy of LIST where the last item for which PRED returns
non-nil is replaced with the result of calling REP on that item.
See also: `-map-when', `-replace-last'" See also: `-map-when', `-replace-last'"
(nreverse (-map-first pred rep (reverse list)))) (nreverse (-map-first pred rep (reverse list))))
@ -720,7 +716,7 @@ N is the length of the returned list."
(defun -flatten (l) (defun -flatten (l)
"Take a nested list L and return its contents as a single, flat list. "Take a nested list L and return its contents as a single, flat list.
Note that because nil represents a list of zero elements (an Note that because `nil' represents a list of zero elements (an
empty list), any mention of nil in L will disappear after empty list), any mention of nil in L will disappear after
flattening. If you need to preserve nils, consider `-flatten-n' flattening. If you need to preserve nils, consider `-flatten-n'
or map them to some unique symbol and then map them back. or map them to some unique symbol and then map them back.
@ -743,7 +739,10 @@ See also: `-flatten'"
(setq list (apply #'append (mapcar #'-list list)))) (setq list (apply #'append (mapcar #'-list list))))
list) list)
(defalias '-concat #'append) (defun -concat (&rest lists)
"Return a new list with the concatenation of the elements in the supplied LISTS."
(declare (pure t) (side-effect-free t))
(apply 'append lists))
(defalias '-copy 'copy-sequence (defalias '-copy 'copy-sequence
"Create a shallow copy of LIST. "Create a shallow copy of LIST.
@ -803,7 +802,7 @@ is a dotted list. With no ARGS, return nil."
This is like `cons', but operates on the end of list. This is like `cons', but operates on the end of list.
If any ELEMENTS are given, append them to the list as well." If ELEMENTS is non nil, append these to the list as well."
(-concat list (list elem) elements)) (-concat list (list elem) elements))
(defmacro --first (form list) (defmacro --first (form list)
@ -983,7 +982,7 @@ See also: `-last-item'."
`(and (--some ,form ,list) t)) `(and (--some ,form ,list) t))
(defun -any? (pred list) (defun -any? (pred list)
"Return t if (PRED X) is non-nil for any X in LIST, else nil. "Return t if (PRED x) is non-nil for any x in LIST, else nil.
Alias: `-any-p', `-some?', `-some-p'" Alias: `-any-p', `-some?', `-some-p'"
(--any? (funcall pred it) list)) (--any? (funcall pred it) list))
@ -1039,7 +1038,7 @@ This function's anaphoric counterpart is `--all?'."
`(--all? (not ,form) ,list)) `(--all? (not ,form) ,list))
(defun -none? (pred list) (defun -none? (pred list)
"Return t if (PRED X) is nil for all X in LIST, else nil. "Return t if (PRED x) is nil for all x in LIST, else nil.
Alias: `-none-p'" Alias: `-none-p'"
(--none? (funcall pred it) list)) (--none? (funcall pred it) list))
@ -1058,10 +1057,8 @@ Alias: `-none-p'"
(---truthy? (and ,y ,n))))) (---truthy? (and ,y ,n)))))
(defun -only-some? (pred list) (defun -only-some? (pred list)
"Return t if different LIST items both satisfy and do not satisfy PRED. "Return `t` if at least one item of LIST matches PRED and at least one item of LIST does not match PRED.
That is, if PRED returns both nil for at least one item, and Return `nil` both if all items match the predicate or if none of the items match the predicate.
non-nil for at least one other item in LIST. Return nil if all
items satisfy the predicate or none of them do.
Alias: `-only-some-p'" Alias: `-only-some-p'"
(--only-some? (funcall pred it) list)) (--only-some? (funcall pred it) list))
@ -1220,15 +1217,11 @@ See also: `-replace'"
(nconc (car split-list) (cons x (cdr (cadr split-list)))))) (nconc (car split-list) (cons x (cdr (cadr split-list))))))
(defun -update-at (n func list) (defun -update-at (n func list)
"Use FUNC to update the Nth element of LIST. "Return a list with element at Nth position in LIST replaced with `(func (nth n list))`.
Return a copy of LIST where the Nth element is replaced with the
result of calling FUNC on it.
See also: `-map-when'" See also: `-map-when'"
(let ((split-list (-split-at n list))) (let ((split-list (-split-at n list)))
(nconc (car split-list) (nconc (car split-list) (cons (funcall func (car (cadr split-list))) (cdr (cadr split-list))))))
(cons (funcall func (car (cadr split-list)))
(cdr (cadr split-list))))))
(defmacro --update-at (n form list) (defmacro --update-at (n form list)
"Anaphoric version of `-update-at'." "Anaphoric version of `-update-at'."
@ -1277,14 +1270,7 @@ See also: `-remove-at', `-remove'"
(list (nreverse ,r) ,l)))) (list (nreverse ,r) ,l))))
(defun -split-with (pred list) (defun -split-with (pred list)
"Split LIST into a prefix satisfying PRED, and the rest. "Return a list of ((-take-while PRED LIST) (-drop-while PRED LIST)), in no more than one pass through the list."
The first sublist is the prefix of LIST with successive elements
satisfying PRED, and the second sublist is the remaining elements
that do not. The result is like performing
((-take-while PRED LIST) (-drop-while PRED LIST))
but in no more than a single pass through LIST."
(--split-with (funcall pred it) list)) (--split-with (funcall pred it) list))
(defmacro -split-on (item list) (defmacro -split-on (item list)
@ -1332,16 +1318,11 @@ This function can be thought of as a generalization of
(list (nreverse ,y) (nreverse ,n))))) (list (nreverse ,y) (nreverse ,n)))))
(defun -separate (pred list) (defun -separate (pred list)
"Split LIST into two sublists based on whether items satisfy PRED. "Return a list of ((-filter PRED LIST) (-remove PRED LIST)), in one pass through the list."
The result is like performing
((-filter PRED LIST) (-remove PRED LIST))
but in a single pass through LIST."
(--separate (funcall pred it) list)) (--separate (funcall pred it) list))
(defun dash--partition-all-in-steps-reversed (n step list) (defun dash--partition-all-in-steps-reversed (n step list)
"Like `-partition-all-in-steps', but the result is reversed." "Used by `-partition-all-in-steps' and `-partition-in-steps'."
(when (< step 1) (when (< step 1)
(signal 'wrong-type-argument (signal 'wrong-type-argument
`("Step size < 1 results in juicy infinite loops" ,step))) `("Step size < 1 results in juicy infinite loops" ,step)))
@ -1352,20 +1333,19 @@ but in a single pass through LIST."
result)) result))
(defun -partition-all-in-steps (n step list) (defun -partition-all-in-steps (n step list)
"Partition LIST into sublists of length N that are STEP items apart. "Return a new list with the items in LIST grouped into N-sized sublists at offsets STEP apart.
Adjacent groups may overlap if N exceeds the STEP stride. The last groups may contain less than N items."
Trailing groups may contain less than N items."
(declare (pure t) (side-effect-free t)) (declare (pure t) (side-effect-free t))
(nreverse (dash--partition-all-in-steps-reversed n step list))) (nreverse (dash--partition-all-in-steps-reversed n step list)))
(defun -partition-in-steps (n step list) (defun -partition-in-steps (n step list)
"Partition LIST into sublists of length N that are STEP items apart. "Return a new list with the items in LIST grouped into N-sized sublists at offsets STEP apart.
Like `-partition-all-in-steps', but if there are not enough items If there are not enough items to make the last group N-sized,
to make the last group N-sized, those items are discarded." those items are discarded."
(declare (pure t) (side-effect-free t)) (declare (pure t) (side-effect-free t))
(let ((result (dash--partition-all-in-steps-reversed n step list))) (let ((result (dash--partition-all-in-steps-reversed n step list)))
(while (and result (< (length (car result)) n)) (while (and result (< (length (car result)) n))
(pop result)) (!cdr result))
(nreverse result))) (nreverse result)))
(defun -partition-all (n list) (defun -partition-all (n list)
@ -1543,8 +1523,7 @@ elements of LIST. Keys are compared by `equal'."
(defmacro --zip-with (form list1 list2) (defmacro --zip-with (form list1 list2)
"Anaphoric form of `-zip-with'. "Anaphoric form of `-zip-with'.
Each element in turn of LIST1 is bound to `it', and of LIST2 to The elements in list1 are bound as symbol `it', the elements in list2 as symbol `other'."
`other', before evaluating FORM."
(declare (debug (form form form))) (declare (debug (form form form)))
(let ((r (make-symbol "result")) (let ((r (make-symbol "result"))
(l1 (make-symbol "list1")) (l1 (make-symbol "list1"))
@ -2012,7 +1991,7 @@ MATCH-FORM is either a symbol, which gets bound to the respective
value in source or another match form which gets destructured value in source or another match form which gets destructured
recursively. recursively.
If the cdr of last cons cell in the list is nil, matching stops If the cdr of last cons cell in the list is `nil', matching stops
there. there.
SOURCE is a proper or improper list." SOURCE is a proper or improper list."
@ -2618,7 +2597,7 @@ Alias: `-uniq'"
(let* ((len (length list)) (let* ((len (length list))
(lut (and (> len 32) (lut (and (> len 32)
;; Check that `-compare-fn' is a valid hash-table ;; Check that `-compare-fn' is a valid hash-table
;; lookup function or nil. ;; lookup function or `nil'.
(memq -compare-fn '(nil equal eq eql)) (memq -compare-fn '(nil equal eq eql))
(make-hash-table :test (or -compare-fn #'equal) (make-hash-table :test (or -compare-fn #'equal)
:size len)))) :size len))))
@ -2632,9 +2611,9 @@ Alias: `-uniq'"
(defalias '-uniq '-distinct) (defalias '-uniq '-distinct)
(defun -union (list list2) (defun -union (list list2)
"Return a new list of all elements appearing in either LIST1 or LIST2. "Return a new list containing the elements of LIST and elements of LIST2 that are not in LIST.
Equality is defined by the value of `-compare-fn' if non-nil; The test for equality is done with `equal',
otherwise `equal'." or with `-compare-fn' if that's non-nil."
;; We fall back to iteration implementation if the comparison ;; We fall back to iteration implementation if the comparison
;; function isn't one of `eq', `eql' or `equal'. ;; function isn't one of `eq', `eql' or `equal'.
(let* ((result (reverse list)) (let* ((result (reverse list))
@ -2651,9 +2630,9 @@ otherwise `equal'."
(nreverse result))) (nreverse result)))
(defun -intersection (list list2) (defun -intersection (list list2)
"Return a new list of the elements appearing in both LIST1 and LIST2. "Return a new list containing only the elements that are members of both LIST and LIST2.
Equality is defined by the value of `-compare-fn' if non-nil; The test for equality is done with `equal',
otherwise `equal'." or with `-compare-fn' if that's non-nil."
(--filter (-contains? list2 it) list)) (--filter (-contains? list2 it) list))
(defun -difference (list list2) (defun -difference (list list2)
@ -2901,7 +2880,7 @@ This is \"dual\" operation to `-reduce-r': while -reduce-r
consumes a list to produce a single value, `-unfold' takes a consumes a list to produce a single value, `-unfold' takes a
seed value and builds a (potentially infinite!) list. seed value and builds a (potentially infinite!) list.
FUN should return nil to stop the generating process, or a FUN should return `nil' to stop the generating process, or a
cons (A . B), where A will be prepended to the result and B is cons (A . B), where A will be prepended to the result and B is
the new seed." the new seed."
(let ((last (funcall fun seed)) r) (let ((last (funcall fun seed)) r)
@ -3337,36 +3316,18 @@ In types: (a -> a) -> a -> a."
re))))) re)))))
(defun -prodfn (&rest fns) (defun -prodfn (&rest fns)
"Return a function that applies each of FNS to each of a list of arguments. "Take a list of n functions and return a function that takes a
list of length n, applying i-th function to i-th element of the
input list. Returns a list of length n.
Takes a list of N functions and returns a function that takes a In types (for n=2): ((a -> b), (c -> d)) -> (a, c) -> (b, d)
list of length N, applying Ith function to Ith element of the
input list. Returns a list of length N.
In types (for N=2): ((a -> b), (c -> d)) -> (a, c) -> (b, d)
This function satisfies the following laws: This function satisfies the following laws:
(-compose (-prodfn f g ...) (-compose (-prodfn f g ...) (-prodfn f\\=' g\\=' ...)) = (-prodfn (-compose f f\\=') (-compose g g\\=') ...)
(-prodfn f\\=' g\\=' ...)) (-prodfn f g ...) = (-juxt (-compose f (-partial \\='nth 0)) (-compose g (-partial \\='nth 1)) ...)
= (-prodfn (-compose f f\\=') (-compose (-prodfn f g ...) (-juxt f\\=' g\\=' ...)) = (-juxt (-compose f f\\=') (-compose g g\\=') ...)
(-compose g g\\=') (-compose (-partial \\='nth n) (-prod f1 f2 ...)) = (-compose fn (-partial \\='nth n))"
...)
(-prodfn f g ...)
= (-juxt (-compose f (-partial #\\='nth 0))
(-compose g (-partial #\\='nth 1))
...)
(-compose (-prodfn f g ...)
(-juxt f\\=' g\\=' ...))
= (-juxt (-compose f f\\=')
(-compose g g\\=')
...)
(-compose (-partial #\\='nth n)
(-prod f1 f2 ...))
= (-compose fn (-partial #\\='nth n))"
(lambda (x) (-zip-with 'funcall fns x))) (lambda (x) (-zip-with 'funcall fns x)))
;;; Font lock ;;; Font lock

10
init.el
View File

@ -129,6 +129,10 @@
(with-demoted-errors "Cannot activate mode: %s" (with-demoted-errors "Cannot activate mode: %s"
(funcall mode +1))) (funcall mode +1)))
(unless on-windows
(with-demoted-errors "Cannot load `pdf-tools: %s"
(pdf-tools-install)))
;; This causes inacceptable lack when drawing buffers, so disable it for now. ;; This causes inacceptable lack when drawing buffers, so disable it for now.
;; Needs to be investigated further. ;; Needs to be investigated further.
@ -407,8 +411,7 @@
history-delete-duplicates t history-delete-duplicates t
track-eol t track-eol t
gc-cons-threshold (* 100 1024 1024) ; 100mb gc-cons-threshold (* 100 1024 1024) ; 100mb
read-process-output-max (* 1024 1024) ; 1mb read-process-output-max (* 1024 1024)) ; 1mb
next-error-message-highlight t)
(when (memq system-type '(gnu gnu/linux gnu/kfreebsd)) (when (memq system-type '(gnu gnu/linux gnu/kfreebsd))
(setq x-wait-for-event-timeout nil)) (setq x-wait-for-event-timeout nil))
@ -3044,6 +3047,9 @@ With given ARG, display files in `db/important-document-path."
(use-package pdf-occur (use-package pdf-occur
:commands (pdf-occur-global-minor-mode)) :commands (pdf-occur-global-minor-mode))
(use-package pdf-tools
:commands (pdf-tools-install))
(use-package python (use-package python
:config (progn :config (progn
(unless (require 'lsp-pyright nil :no-error) (unless (require 'lsp-pyright nil :no-error)

View File

@ -140,11 +140,11 @@ in the main agenda view."
'(("Mail" ?m db/gnus) '(("Mail" ?m db/gnus)
("Agenda" ?a db/org-agenda) ("Agenda" ?a db/org-agenda)
("Init File" ?i db/find-user-init-file) ("Init File" ?i db/find-user-init-file)
("Main Org File" ?o #'(lambda () (interactive) (find-file db/org-default-org-file))) ("Main Org File" ?o (lambda () (interactive) (find-file db/org-default-org-file)))
("EMMS" ?M emms) ("EMMS" ?M emms)
("Shell" ?s db/run-or-hide-shell) ("Shell" ?s db/run-or-hide-shell)
("EShell" ?e db/run-or-hide-eshell) ("EShell" ?e db/run-or-hide-eshell)
("Refile File" ?r #'(lambda () (interactive) (find-file db/org-default-refile-file))) ("scratch" ?r db/scratch)
("Org Clock Goto" ?c org-clock-goto) ("Org Clock Goto" ?c org-clock-goto)
("Info Lookup" ?I counsel-info-lookup-symbol) ("Info Lookup" ?I counsel-info-lookup-symbol)
("Unicode Lookup" ?U counsel-unicode-char) ("Unicode Lookup" ?U counsel-unicode-char)