;;; inbox.el -*- lexical-binding: t; -*- ;; Use this file for new packages and configuration snippets ;; before sorting them into their proper places. (defun df/copy-file-line-ref () "Copy absolute file path with line reference as @/path#Lline or @/path#Lstart-end." (interactive) (let* ((file (or (buffer-file-name) (buffer-name))) (abs-file (if (file-name-absolute-p file) file (expand-file-name file))) (ref (if (use-region-p) (let* ((start (region-beginning)) (end (region-end)) (start-line (line-number-at-pos start)) (end-line (line-number-at-pos (max start (1- end))))) (format "@%s#L%d-%d" abs-file start-line end-line)) (format "@%s#L%d" abs-file (line-number-at-pos (point)))))) (kill-new ref) (when (fboundp 'gui-set-selection) (gui-set-selection 'CLIPBOARD ref)) (message "%s" ref))) (global-set-key (kbd "M-S w") #'df/copy-file-line-ref) (defun load-current-file () (interactive) (load (buffer-file-name))) (global-set-key (kbd "C-c l") #'load-current-file) (use-package! command-log-mode :config (map! "C-c L" #'(lambda () (interactive) (command-log-mode (if command-log-mode -1 +1)) (when command-log-mode (switch-to-buffer "*Command Log*")))))