Advertisement
Guest User

Untitled

a guest
May 26th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 3.82 KB | None | 0 0
  1. (set-background-color "black")
  2. (set-foreground-color "white")
  3. (setq line-number-mode t)
  4. (setq column-number-mode t)
  5.  
  6. ;; ===== Function to delete a line =====
  7.  
  8. ;; First define a variable which will store the previous column position
  9. (defvar previous-column nil "Save the column position")
  10.  
  11. ;; Define the nuke-line function. The line is killed, then the newline
  12. ;; character is deleted. The column which the cursor was positioned at is then
  13. ;; restored. Because the kill-line function is used, the contents deleted can
  14. ;; be later restored by usibackward-delete-char-untabifyng the yank commands.
  15. (defun nuke-line()
  16.   "Kill an entire line, including the trailing newline character"
  17.   (interactive)
  18.  
  19.   ;; Store the current column position, so it can later be restored for a more
  20.   ;; natural feel to the deletion
  21.   (setq previous-column (current-column))
  22.  
  23.   ;; Now move to the end of the current line
  24.   (end-of-line)
  25.  
  26.   ;; Test the length of the line. If it is 0, there is no need for a
  27.   ;; kill-line. All that happens in this case is that the new-line character
  28.   ;; is deleted.
  29.   (if (= (current-column) 0)
  30.     (delete-char 1)
  31.  
  32.     ;; This is the 'else' clause. The current line being deleted is not zero
  33.     ;; in length. First remove the line by moving to its start and then
  34.     ;; killing, followed by deletion of the newline character, and then
  35.     ;; finally restoration of the column position.
  36.     (progn
  37.       (beginning-of-line)
  38.       (kill-line)
  39.       (delete-char 1)
  40.       (move-to-column previous-column))))
  41.  
  42. ;; Now bind the delete line function to the F8 key
  43. (global-set-key [f8] 'nuke-line)
  44.  
  45. ;; ===== Turn off tab character =====
  46.  
  47. ;;
  48. ;; Emacs normally uses both tabs and spaces to indent lines. If you
  49. ;; prefer, all indentation can be made from spaces only. To request this,
  50. ;; set `indent-tabs-mode' to `nil'. This is a per-buffer variable;
  51. ;; altering the variable affects only the current buffer, but it can be
  52. ;; disabled for all buffers.
  53.  
  54. ;;
  55. ;; Use (setq ...) to set value locally to a buffer
  56. ;; Use (setq-default ...) to set value globally
  57. ;;
  58. (setq-default indent-tabs-mode nil)
  59.  
  60. ;; ===== Set standard indent to 2 rather that 4 ====
  61. (setq standard-indent 4)
  62.  
  63. ;; ========== Support Wheel Mouse Scrolling ==========
  64. (mouse-wheel-mode t)
  65.  
  66. ;; ===== Set the highlight current line minor mode =====
  67. ;; In every buffer, the line which contains the cursor will be fully
  68. ;; highlighted
  69.  
  70. (global-hl-line-mode 1)
  71.  
  72. ;; To customize the background color of highlighted line
  73. (set-face-background 'hl-line "#191970")  ;; Emacs 22 Only
  74. ;; (set-face-background 'highlight "#0000DD")  ;; Emacs 21 Only
  75.  
  76. (add-hook 'c-mode-common-hook
  77.     '(lambda () (c-toggle-auto-hungry-state 1)))
  78.  
  79. ;; Switch RET and LF. Makes <return> indent                                                                                      
  80. (defvar tmp (global-key-binding "\C-m"))
  81. (global-set-key "\C-m" (global-key-binding "\C-j"))
  82. (global-set-key "\C-j" tmp)
  83.  
  84. ;; Put autosave files (ie #foo#) in one place, *not*
  85. ;; scattered all over the file system!
  86. (defvar autosave-dir
  87.  (concat "/home/" (user-login-name) "/.emacs-bak/"))
  88.  
  89. (make-directory autosave-dir t)
  90.  
  91. (defun auto-save-file-name-p (filename)
  92.   (string-match "^#.*#$" (file-name-nondirectory filename)))
  93.  
  94. (defun make-auto-save-file-name ()
  95.   (concat autosave-dir
  96.    (if buffer-file-name
  97.       (concat "#" (file-name-nondirectory buffer-file-name) "#")
  98.     (expand-file-name
  99.      (concat "#%" (buffer-name) "#")))))
  100.  
  101. ;; Put backup files (ie foo~) in one place too. (The backup-directory-alist
  102. ;; list contains regexp=>directory mappings; filenames matching a regexp are
  103. ;; backed up in the corresponding directory. Emacs will mkdir it if necessary.)
  104. (defvar backup-dir (concat "/home/" (user-login-name) "/.emacs-bak"))
  105. (setq backup-directory-alist (list (cons "." backup-dir)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement