Skip to content

Commit

Permalink
add lexical support and WSL clipboard functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mcraveiro committed Mar 21, 2024
1 parent ad57106 commit 7fb139d
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 9 deletions.
2 changes: 1 addition & 1 deletion config/core.org
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Basic configuration for core aspects of Emacs.
* Preamble

#+begin_src emacs-lisp
;;; core.el --- Cunene: My emacs configuration Copyright © 2021 Marco Craveiro
;;; core.el --- Cunene: My emacs configuration. -*- lexical-binding: t -*-
;; Author: Marco Craveiro <[email protected]> URL:
;; https://github.com/mcraveiro/prelude Version: 0.0.3 Keywords: convenience

Expand Down
10 changes: 8 additions & 2 deletions config/development.org
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Configuration related to programming.
* Preamble

#+begin_src emacs-lisp
;;; core.el --- Cunene: My emacs configuration Copyright © 2021 Marco Craveiro
;;; core.el --- Cunene: My emacs configuration. -*- lexical-binding: t -*-
;; Author: Marco Craveiro <[email protected]> URL:
;; https://github.com/mcraveiro/prelude Version: 0.0.3 Keywords: convenience

Expand Down Expand Up @@ -325,7 +325,7 @@ _p_rev _u_pper (mine) _=_: upper/lower _r_esolve
;; Improve performance by not logging debug info.
;; https://www.reddit.com/r/emacs/comments/1447fy2/looking_for_help_in_improving_typescript_eglot/
;;
(fset #'jsonrpc--log-event #'ignore)
; (fset #'jsonrpc--log-event #'ignore)
#+end_src

* Diagrams
Expand Down Expand Up @@ -916,6 +916,12 @@ TODO: for some reason we do not trigger the mode with =/**=, it seems to require

(require 'ansi-color)
(add-hook 'compilation-filter-hook #'cunene/colorize-compilation-buffer)

(defun cunene/recompile-quietly ()
"Re-compile without changing the window configuration."
(interactive)
(save-window-excursion
(recompile)))
#+end_src

* Lisp
Expand Down
7 changes: 6 additions & 1 deletion config/external.org
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Interaction with the outside world.
* Preamble

#+begin_src emacs-lisp
;;; external.el --- Cunene: My emacs configuration Copyright © 2021 Marco Craveiro
;;; external.el --- Cunene: My emacs configuration. -*- lexical-binding: t -*-
;; Author: Marco Craveiro <[email protected]> URL:
;; https://github.com/mcraveiro/prelude Version: 0.0.3 Keywords: convenience

Expand Down Expand Up @@ -78,6 +78,10 @@ Todo:
#+begin_src emacs-lisp
(use-package eshell
:config
(add-hook 'eshell-mode-hook
(lambda ()
(setq-local imenu-generic-expression
'(("Prompt" " $ \\(.*\\)" 1)))))
(require 'em-hist)
(require 'em-alias)
(add-to-list
Expand All @@ -97,6 +101,7 @@ Todo:
;; ([remap eshell-list-history] . helm-eshell-history)
))


;; Start a new eshell even if one is active.
(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t)))

Expand Down
2 changes: 1 addition & 1 deletion config/features.org
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Key features.
* Preamble

#+begin_src emacs-lisp
;;; features.el --- Cunene: My emacs configuration Copyright © 2021 Marco Craveiro
;;; features.el --- Cunene: My emacs configuration. -*- lexical-binding: t -*-
;; Author: Marco Craveiro <[email protected]> URL:
;; https://github.com/mcraveiro/prelude Version: 0.0.3 Keywords: convenience

Expand Down
2 changes: 1 addition & 1 deletion config/music.org
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Playing music from Emacs.
* Preamble

#+begin_src emacs-lisp
;;; music.el --- Cunene: My emacs configuration Copyright © 2021 Marco Craveiro
;;; music.el --- Cunene: My emacs configuration. -*- lexical-binding: t -*-
;; Author: Marco Craveiro <[email protected]> URL:
;; https://github.com/mcraveiro/prelude Version: 0.0.3 Keywords: convenience

Expand Down
19 changes: 18 additions & 1 deletion config/quality_of_life.org
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Changes to core behaviour to make life better.
* Preamble

#+begin_src emacs-lisp
;;; quality_of_life.el --- Cunene: My emacs configuration Copyright © 2021 Marco Craveiro
;;; quality_of_life.el --- Cunene: My emacs configuration. -*- lexical-binding: t -*-
;; Author: Marco Craveiro <[email protected]> URL:
;; https://github.com/mcraveiro/prelude Version: 0.0.3 Keywords: convenience

Expand Down Expand Up @@ -585,6 +585,23 @@ other occurrences changed in the same way, with visual feedback as you type.
;; note - this should be after volatile-highlights is required
;; add the ability to cut the current line, without marking it
(require 'rect)

;; WSL only. As per this post:
;; https://www.fredgruber.org/post/wsl_emacs_clipboard/
;;
(defun cunene/wsl-copy-clip(&rest _args)
"Write the region to a file and then copy it to the Windows clipboard."
(setq mytemp (make-temp-file "winclip"))
(write-region (current-kill 0 t) nil mytemp)
(shell-command (concat "clip.exe<" mytemp))
(delete-file mytemp))
;; (advice-add 'kill-new :after #'cunene/wsl-copy-clip)

(defun cunene/wsl-copy-selected-text (start end)
(interactive "r")
(if (use-region-p)
(let ((text (buffer-substring-no-properties start end)))
(shell-command (concat "echo '" text "' | clip.exe")))))
#+end_src

* Mark
Expand Down
8 changes: 7 additions & 1 deletion custom.el
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
'(package-selected-packages
'(iedit paimon haproxy-mode eldoc-box embark-consult embark flyspell-correct consult-flyspell csv-mode ztree yasnippet-snippets yaml-mode windswap vscode-icon volatile-highlights vertico verb undo-tree terraform-mode super-save ssh sql-clickhouse smartparens smart-hungry-delete sharper rg rainbow-mode rainbow-delimiters protobuf-mode project-shells prodigy powershell pfuture persp-mode persistent-scratch org-roam-ui org-present org-fancy-priorities orderless mustache-mode mustache mastodon marginalia magit logview llama-cpp jump-tree json-mode jq-mode jq-format inf-mongo inf-clojure imenu-list ibuffer-sidebar ibuffer-projectile hl-todo hide-mode-line helpful google-this git-timemachine git-modes git-messenger git-gutter-fringe flycheck-plantuml flycheck-eglot eyebrowse expand-region evil eshell-git-prompt engine-mode drag-stuff doom-themes doom-modeline dockerfile-mode dired-sidebar dimmer diminish diff-at-point define-word dashboard csproj-mode crux consult-yasnippet consult-flycheck consult-eglot consult-dir company-posframe company-box color-identifiers-mode cmake-mode citeproc-org chatgpt-shell cfrs browse-kill-ring bongo bm beacon backup-walker anzu all-the-icons-nerd-fonts all-the-icons-ibuffer all-the-icons-dired all-the-icons-completion aggressive-indent ace-window))
'(safe-local-variable-values
'((eval setq-local org-roam-db-location
'((org-roam-directory . "/work/DomainDrivenConsulting/masd/dogen/integration")
(projectile-project-compilation-cmd . "cmake --build --preset linux-clang-release")
(projectile-project-test-cmd . "cmake --build --preset linux-clang-release --target rat")
(projectile-project-run-cmd . "cmake --build --preset linux-clang-release --target gao")
(projectile-project-name . "dogen - integration")
(projectile-project-type . "cmake")
(eval setq-local org-roam-db-location
(expand-file-name ".org-roam.db" org-roam-directory))
(eval setq-local org-roam-directory
(expand-file-name
Expand Down
2 changes: 1 addition & 1 deletion init.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; init.el --- My Emacs configuration -*- lexical-binding: t; -*-
;;; init.el --- Cunene: My emacs configuration. -*- lexical-binding: t -*-

;; Copyright (C) 2024 Marco Craveiro

Expand Down

0 comments on commit 7fb139d

Please sign in to comment.