Emacs changes
This commit is contained in:
parent
0343c39a1c
commit
54c96acfc3
@ -72,7 +72,6 @@
|
||||
"PATH=/run/current-system/sw/bin:/etc/profiles/per-user/balsoft/bin";
|
||||
|
||||
home.file.".emacs.d/init.el".source = ./init.el;
|
||||
home.file.".emacs.d/elisp/gud-lldb.el".source = ./gud-lldb.el;
|
||||
home.activation.emacs = {
|
||||
before = [ ];
|
||||
after = [ ];
|
||||
|
@ -1,198 +0,0 @@
|
||||
;;; gud-lldb.el --- Grand Unified Debugger mode for running LLDB
|
||||
|
||||
;; Copyright (C) 1992-1996, 1998, 2000-2014 Free Software Foundation,
|
||||
;; Inc.
|
||||
|
||||
;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
|
||||
;; Maintainer: emacs-devel@gnu.org
|
||||
;; Keywords: unix, tools, osx
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file contains an extract of the gud.el version from
|
||||
;; `http://opensource.apple.com/source/lldb/lldb-69/utils/emacs/gud.el'
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'gud)
|
||||
|
||||
|
||||
;; History of argument lists passed to lldb.
|
||||
(defvar gud-lldb-history nil)
|
||||
|
||||
;; Keeps track of breakpoint created. In the following case, the id is "1".
|
||||
;; It is used to implement temporary breakpoint.
|
||||
;; (lldb) b main.c:39
|
||||
;; breakpoint set --file 'main.c' --line 39
|
||||
;; Breakpoint created: 1: file ='main.c', line = 39, locations = 1
|
||||
(defvar gud-breakpoint-id nil)
|
||||
|
||||
(defun lldb-extract-breakpoint-id (string)
|
||||
;; Search for "Breakpoint created: \\([^:\n]*\\):" pattern.
|
||||
;(message "gud-marker-acc string is: |%s|" string)
|
||||
(if (string-match "Breakpoint created: \\([^:\n]*\\):" string)
|
||||
(progn
|
||||
(setq gud-breakpoint-id (match-string 1 string))
|
||||
(message "breakpoint id: %s" gud-breakpoint-id)))
|
||||
)
|
||||
|
||||
(defun gud-lldb-marker-filter (string)
|
||||
(setq gud-marker-acc
|
||||
(if gud-marker-acc (concat gud-marker-acc string) string))
|
||||
(lldb-extract-breakpoint-id gud-marker-acc)
|
||||
(let (start)
|
||||
;; Process all complete markers in this chunk
|
||||
(while (or
|
||||
;; (lldb) r
|
||||
;; Process 15408 launched: '/Volumes/data/lldb/svn/trunk/test/conditional_break/a.out' (x86_64)
|
||||
;; (lldb) Process 15408 stopped
|
||||
;; * thread #1: tid = 0x2e03, 0x0000000100000de8 a.out`c + 7 at main.c:39, stop reason = breakpoint 1.1, queue = com.apple.main-thread
|
||||
(string-match " at \\([^:\n]*\\):\\([0-9]*\\), stop reason = .*\n"
|
||||
gud-marker-acc start)
|
||||
;; (lldb) frame select -r 1
|
||||
;; frame #1: 0x0000000100000e09 a.out`main + 25 at main.c:44
|
||||
(string-match "^[ ]*frame.* at \\([^:\n]*\\):\\([0-9]*\\)\n"
|
||||
gud-marker-acc start))
|
||||
;(message "gud-marker-acc matches our pattern....")
|
||||
(setq gud-last-frame
|
||||
(cons (match-string 1 gud-marker-acc)
|
||||
(string-to-number (match-string 2 gud-marker-acc)))
|
||||
start (match-end 0)))
|
||||
|
||||
;; Search for the last incomplete line in this chunk
|
||||
(while (string-match "\n" gud-marker-acc start)
|
||||
(setq start (match-end 0)))
|
||||
|
||||
;; If we have an incomplete line, store it in gud-marker-acc.
|
||||
(setq gud-marker-acc (substring gud-marker-acc (or start 0))))
|
||||
string)
|
||||
|
||||
;; Keeps track of whether the Python lldb_oneshot_break function definition has
|
||||
;; been exec'ed.
|
||||
(defvar lldb-oneshot-break-defined nil)
|
||||
|
||||
;;;###autoload
|
||||
(defun lldb (command-line)
|
||||
"Run lldb on program FILE in buffer *gud-FILE*.
|
||||
The directory containing FILE becomes the initial working directory
|
||||
and source-file directory for your debugger."
|
||||
(interactive (list (gud-query-cmdline 'lldb)))
|
||||
|
||||
(gud-common-init command-line nil 'gud-lldb-marker-filter)
|
||||
(set (make-local-variable 'gud-minor-mode) 'lldb)
|
||||
(setq lldb-oneshot-break-defined nil)
|
||||
|
||||
;; Make lldb dump fullpath instead of basename for a file.
|
||||
;; See also gud-lldb-marker-filter where gud-last-frame is grokked from lldb output.
|
||||
(progn
|
||||
(gud-call "settings set frame-format frame #${frame.index}: ${frame.pc}{ ${module.file.basename}{`${function.name}${function.pc-offset}}}{ at ${line.file.fullpath}:${line.number}}\\n")
|
||||
(sit-for 1)
|
||||
(gud-call "settings set thread-format thread #${thread.index}: tid = ${thread.id}{, ${frame.pc}}{ ${module.file.basename}{`${function.name}${function.pc-offset}}}{ at ${line.file.fullpath}:${line.number}}{, stop reason = ${thread.stop-reason}}\\n")
|
||||
(sit-for 1))
|
||||
|
||||
(gud-def gud-listb "breakpoint list"
|
||||
"l" "List all breakpoints.")
|
||||
(gud-def gud-bt "thread backtrace"
|
||||
"b" "Show stack for the current thread.")
|
||||
(gud-def gud-bt-all "thread backtrace all"
|
||||
"B" "Show stacks for all the threads.")
|
||||
|
||||
(gud-def gud-break "breakpoint set -f %f -l %l"
|
||||
"\C-b" "Set breakpoint at current line.")
|
||||
(gud-def gud-tbreak
|
||||
(progn (gud-call "breakpoint set -f %f -l %l")
|
||||
(sit-for 1)
|
||||
(if (not lldb-oneshot-break-defined)
|
||||
(progn
|
||||
;; The "\\n"'s are required to escape the newline chars
|
||||
;; passed to the lldb process.
|
||||
(gud-call (concat "script exec \"def lldb_oneshot_break(frame, bp_loc):\\n"
|
||||
" target=frame.GetThread().GetProcess().GetTarget()\\n"
|
||||
" bp=bp_loc.GetBreakpoint()\\n"
|
||||
" print 'Deleting oneshot breakpoint:', bp\\n"
|
||||
" target.BreakpointDelete(bp.GetID())\""))
|
||||
(sit-for 1)
|
||||
;; Set the flag since Python knows about the function def now.
|
||||
(setq lldb-oneshot-break-defined t)))
|
||||
(gud-call "breakpoint command add -p %b -o 'lldb_oneshot_break(frame, bp_loc)'"))
|
||||
"\C-t" "Set temporary breakpoint at current line.")
|
||||
(gud-def gud-remove "breakpoint clear -f %f -l %l"
|
||||
"\C-d" "Remove breakpoint at current line")
|
||||
(gud-def gud-step "thread step-in"
|
||||
"\C-s" "Step one source line with display.")
|
||||
(gud-def gud-stepi "thread step-inst"
|
||||
"\C-i" "Step one instruction with display.")
|
||||
(gud-def gud-next "thread step-over"
|
||||
"\C-n" "Step one line (skip functions).")
|
||||
(gud-def gud-nexti "thread step-inst-over"
|
||||
nil "Step one instruction (skip functions).")
|
||||
(gud-def gud-cont "process continue"
|
||||
"\C-r" "Continue with display.")
|
||||
(gud-def gud-finish "thread step-out"
|
||||
"\C-f" "Finish executing current function.")
|
||||
(gud-def gud-up
|
||||
(progn (gud-call "frame select -r 1")
|
||||
(sit-for 1))
|
||||
"<" "Up 1 stack frame.")
|
||||
(gud-def gud-down
|
||||
(progn (gud-call "frame select -r -1")
|
||||
(sit-for 1))
|
||||
">" "Down 1 stack frame.")
|
||||
(gud-def gud-print "expression -- %e"
|
||||
"\C-p" "Evaluate C expression at point.")
|
||||
(gud-def gud-pstar "expression -- *%e"
|
||||
nil "Evaluate C dereferenced pointer expression at point.")
|
||||
(gud-def gud-run "run"
|
||||
"r" "Run the program.")
|
||||
(gud-def gud-stop-subjob "process kill"
|
||||
"s" "Stop the program.")
|
||||
|
||||
(setq comint-prompt-regexp "\\(^\\|\n\\)\\*")
|
||||
(setq paragraph-start comint-prompt-regexp)
|
||||
(run-hooks 'lldb-mode-hook)
|
||||
)
|
||||
|
||||
;; ;; tooltip
|
||||
;; (defun gud-lldb-tooltip-print-command (expr)
|
||||
;; "Return a suitable command to print the expression EXPR."
|
||||
;; (pcase gud-minor-mode
|
||||
;; ;; '-o' to print the objc object description if available
|
||||
;; (`lldb (concat "expression -o -- " expr))
|
||||
;; (`gdbmi (concat "-data-evaluate-expression \"" expr "\""))
|
||||
;; (`guiler expr)
|
||||
;; (`dbx (concat "print " expr))
|
||||
;; ((or `xdb `pdb) (concat "p " expr))
|
||||
;; (`sdb (concat expr "/"))))
|
||||
|
||||
;; (advice-add 'gud-tooltip-print-command :override #'gud-lldb-tooltip-print-command)
|
||||
|
||||
;; menu
|
||||
(setcdr (nth 2 (nth 7 (assoc 'nexti gud-menu-map))) '((lldb gdbmi gdb dbx)))
|
||||
(setcdr (nth 2 (nth 7 (assoc 'stepi gud-menu-map))) '((lldb gdbmi gdb dbx)))
|
||||
(setcdr (nth 2 (nth 7 (assoc 'finish gud-menu-map))) '((lldb gdbmi gdb guiler xdb jdb pdb)))
|
||||
(setcdr (nth 2 (nth 7 (assoc 'print* gud-menu-map))) '((lldb gdbmi gdb jdb)))
|
||||
(setcdr (nth 2 (nth 7 (assoc 'down gud-menu-map))) '((lldb gdbmi gdb guiler dbx xdb jdb pdb)))
|
||||
(setcdr (nth 2 (nth 7 (assoc 'up gud-menu-map))) '((lldb gdbmi gdb guiler dbx xdb jdb pdb)))
|
||||
(setcdr (nth 2 (nth 7 (assoc 'tbreak gud-menu-map))) '((lldb gdbmi gdb sdb xdb)))
|
||||
(setcdr (nth 2 (nth 7 (assoc 'run gud-menu-map))) '((lldb gdbmi gdb dbx jdb)))
|
||||
;; (setcdr (nth 2 (nth 7 (assoc 'tooltips gud-menu-map))) '((lldb gdbmi guiler dbx sdb xdb pdb)))
|
||||
|
||||
|
||||
(provide 'gud-lldb)
|
||||
|
||||
;;; gud-lldb.el ends here
|
@ -8,45 +8,7 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;----------------------------------------------------------------------------
|
||||
;; Adjust garbage collection
|
||||
;;----------------------------------------------------------------------------
|
||||
(setq gc-cons-threshold (* 20 1024 1024))
|
||||
|
||||
|
||||
;; ---------------------
|
||||
;; Setup Load Path
|
||||
;; ---------------------
|
||||
|
||||
(nconc load-path
|
||||
(list (expand-file-name "local" user-emacs-directory)
|
||||
(expand-file-name "wakib" user-emacs-directory)))
|
||||
|
||||
|
||||
;; -----------------------
|
||||
;; use-package
|
||||
;; -----------------------
|
||||
(setq load-prefer-newer t) ; Don't load outdated byte code
|
||||
|
||||
(require 'package)
|
||||
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
|
||||
(not (gnutls-available-p))))
|
||||
(proto (if no-ssl "http" "https")))
|
||||
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
|
||||
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
|
||||
(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
|
||||
|
||||
(add-to-list 'package-archives '("cselpa" . "https://elpa.thecybershadow.net/packages/"))
|
||||
(when (< emacs-major-version 24)
|
||||
;; For important compatibility libraries like cl-lib
|
||||
(add-to-list 'package-archives '("gnu" . (concat proto "://elpa.gnu.org/packages/")))))
|
||||
(package-initialize)
|
||||
(setq package-enable-at-startup nil)
|
||||
|
||||
;; Bootstrap `use-package'
|
||||
(unless (package-installed-p 'use-package)
|
||||
(package-refresh-contents)
|
||||
(package-install 'use-package))
|
||||
(eval-when-compile
|
||||
(require 'use-package))
|
||||
(setq use-package-always-ensure nil)
|
||||
@ -72,9 +34,6 @@
|
||||
|
||||
(setq-default compilation-scroll-output 'first-error)
|
||||
|
||||
(add-to-list 'load-path "~/.emacs.d/elisp/")
|
||||
|
||||
(require 'gud-lldb)
|
||||
|
||||
(use-package ws-butler
|
||||
:config
|
||||
@ -87,12 +46,6 @@
|
||||
|
||||
(global-auto-revert-mode)
|
||||
|
||||
(electric-indent-mode 1)
|
||||
|
||||
;; (use-package ergoemacs-mode
|
||||
;; :config
|
||||
;; (ergoemacs-mode 1))
|
||||
|
||||
|
||||
(use-package xah-fly-keys
|
||||
:config
|
||||
@ -102,7 +55,6 @@
|
||||
)
|
||||
|
||||
(global-set-key (kbd "C-b") 'switch-to-buffer)
|
||||
(global-set-key (kbd "C-TAB") 'org-cycle-level)
|
||||
|
||||
(global-display-line-numbers-mode)
|
||||
|
||||
@ -114,18 +66,10 @@
|
||||
:config
|
||||
(global-flycheck-mode))
|
||||
|
||||
;; -------------------
|
||||
;; Initial Setup
|
||||
;; -------------------
|
||||
(menu-bar-mode -1)
|
||||
(scroll-bar-mode -1)
|
||||
(tool-bar-mode -1)
|
||||
(cua-selection-mode 1)
|
||||
;;(define-key cua--rectangle-keymap (kbd "ESC") nil)
|
||||
;;(define-key cua-global-keymap (kbd "<C-return>") nil)
|
||||
;;(define-key cua-global-keymap (kbd "C-x SPC") 'cua-rectangle-mark-mode)
|
||||
|
||||
|
||||
|
||||
|
||||
(when (not window-system)
|
||||
@ -142,7 +86,6 @@
|
||||
:config
|
||||
(push 'company-ghci company-backends))
|
||||
|
||||
(global-set-key (kbd "M-RET") 'execute-extended-command)
|
||||
|
||||
(defun smart-beginning-of-line ()
|
||||
"Move point to first non-whitespace character or beginning of line.
|
||||
@ -173,9 +116,9 @@ If point was already at that position, move point to beginning of line."
|
||||
|
||||
(use-package frames-only-mode)
|
||||
;; Make new frames instead of new windows
|
||||
(set 'pop-up-frames 'graphic-only)
|
||||
(set 'gdb-use-separate-io-buffer nil)
|
||||
(set 'gdb-many-windows nil)
|
||||
(setq pop-up-frames 'graphic-only)
|
||||
(setq gdb-use-separate-io-buffer nil)
|
||||
(setq gdb-many-windows nil)
|
||||
|
||||
|
||||
(use-package counsel
|
||||
@ -189,7 +132,6 @@ If point was already at that position, move point to beginning of line."
|
||||
;; doesn't handle wakib C-d keymaps
|
||||
(use-package projectile
|
||||
:config
|
||||
(setq projectile-completion-system 'ivy)
|
||||
(define-key projectile-mode-map (kbd "C-c p") nil)
|
||||
(define-key projectile-mode-map (kbd "C-x p") 'projectile-command-map)
|
||||
(projectile-mode 1)
|
||||
@ -202,48 +144,25 @@ If point was already at that position, move point to beginning of line."
|
||||
(global-set-key (kbd "<f9>") 'projectile-compile-project)
|
||||
(global-set-key (kbd "<f5>") 'projectile-run-project))
|
||||
|
||||
;; -------------------
|
||||
;; Yasnippet
|
||||
;; -------------------
|
||||
|
||||
(use-package nix-mode
|
||||
:hook
|
||||
((nix-mode . (lambda () (local-set-key (kbd "<f7>") 'nix-format-buffer))))
|
||||
((nix-mode . (lambda () (setq indent-line-function 'nix-indent-line)))))
|
||||
|
||||
;; -------------------
|
||||
;; expand-region
|
||||
;; -------------------
|
||||
(use-package company
|
||||
:config
|
||||
(global-company-mode 1)
|
||||
;; Trigger completion immediately.
|
||||
(setq company-idle-delay 0)
|
||||
|
||||
;; Number the candidates (use M-1, M-2 etc to select completions).
|
||||
(setq company-show-numbers t)
|
||||
(setq company-idle-delay 0)
|
||||
)
|
||||
|
||||
;; Use the tab-and-go frontend.
|
||||
;; Allows TAB to select and complete at the same time.
|
||||
(company-tng-configure-default)
|
||||
(setq company-frontends
|
||||
'(company-tng-frontend
|
||||
company-echo-metadata-frontend))
|
||||
|
||||
(require 'color)
|
||||
|
||||
(let ((bg (face-attribute 'default :background)))
|
||||
(custom-set-faces
|
||||
`(company-tooltip ((t (:inherit default :background ,(color-lighten-name bg 2)))))
|
||||
`(company-scrollbar-bg ((t (:background ,(color-lighten-name bg 10)))))
|
||||
`(company-scrollbar-fg ((t (:background ,(color-lighten-name bg 5)))))
|
||||
`(company-tooltip-selection ((t (:inherit font-lock-function-name-face))))
|
||||
`(company-tooltip-common ((t (:inherit font-lock-constant-face)))))))
|
||||
(use-package company-box
|
||||
:hook (company-mode . company-box-mode))
|
||||
|
||||
(use-package company-tabnine
|
||||
:config
|
||||
(add-to-list 'company-backends #'company-tabnine))
|
||||
|
||||
(push 'company-tabnine company-backends))
|
||||
|
||||
;; -------------------
|
||||
;; Ivy
|
||||
@ -253,28 +172,12 @@ If point was already at that position, move point to beginning of line."
|
||||
(ivy-mode 1)
|
||||
(setq ivy-use-virtual-buffers t)
|
||||
(define-key ivy-minibuffer-map [remap keyboard-quit] 'minibuffer-keyboard-quit)
|
||||
;; (setq enable-recursive-minibuffers t)
|
||||
(setq ivy-count-format "")
|
||||
(setq ivy-initial-inputs-alist nil))
|
||||
|
||||
|
||||
(use-package smex)
|
||||
|
||||
;; TODO (change defun rewrite to advice)
|
||||
(use-package quickrun
|
||||
:init
|
||||
(global-set-key [menu-bar tools quickrun] `(menu-item ,"Run Buffer" quickrun))
|
||||
:config
|
||||
(setq quickrun-focus-p nil)
|
||||
;; Move cursor out of the way when displaying output
|
||||
(advice-add 'quickrun--recenter
|
||||
:after (lambda (&optional _)
|
||||
(with-selected-window
|
||||
(get-buffer-window quickrun--buffer-name)
|
||||
(end-of-buffer))))
|
||||
:bind
|
||||
(([f8] . quickrun )))
|
||||
|
||||
|
||||
(show-paren-mode 1)
|
||||
;; TODO - MOVE Electric Pair Mode to user local
|
||||
|
||||
@ -293,22 +196,6 @@ If point was already at that position, move point to beginning of line."
|
||||
(setq custom-file (expand-file-name "custom" user-emacs-directory))
|
||||
(load custom-file t t)
|
||||
|
||||
(defun compile-on-save-start ()
|
||||
"Recompile when compilation is not going."
|
||||
(let ((buffer (compilation-find-buffer)))
|
||||
(unless (get-buffer-process buffer)
|
||||
(recompile))))
|
||||
|
||||
(define-minor-mode compile-on-save-mode
|
||||
"Minor mode to automatically call `recompile' whenever the
|
||||
current buffer is saved. When there is ongoing compilation,
|
||||
nothing happens."
|
||||
:lighter " CoS"
|
||||
(if compile-on-save-mode
|
||||
(progn (make-local-variable 'after-save-hook)
|
||||
(add-hook 'after-save-hook 'compile-on-save-start nil t))
|
||||
(kill-local-variable 'after-save-hook)))
|
||||
|
||||
(auto-fill-mode)
|
||||
|
||||
|
||||
|
@ -87,6 +87,9 @@
|
||||
cmd_start=`date +%s`
|
||||
}
|
||||
|
||||
bindkey -M emacs '^H' backward-kill-word
|
||||
bindkey -r '^W'
|
||||
|
||||
# make sure this plays nicely with any existing preexec
|
||||
preexec_functions+=( notifyosd-preexec )
|
||||
XDG_DATA_DIRS=$XDG_DATA_DIRS:$GSETTINGS_SCHEMAS_PATH
|
||||
|
Loading…
Reference in New Issue
Block a user