init-editing-utils.el 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. ;;; init-editing-utils.el --- .Emacs Configuration -*- lexical-binding: t -*-
  2. ;;; Commentary:
  3. ;;
  4. ;;; Code:
  5. ;;----------------------------------------------------------------------------
  6. ;; Remove whitespaces
  7. ;;----------------------------------------------------------------------------
  8. ;; Delete trailing whitespace before saving fil → all modes
  9. ;; (add-hook 'before-save-hook 'delete-trailing-whitespace)
  10. ;; Delete-trailing-whitespace-when-saving-except-certain-modes
  11. (add-hook 'before-save-hook
  12. (lambda ()
  13. (unless (eq major-mode 'diff-mode)
  14. (delete-trailing-whitespace))))
  15. ;;----------------------------------------------------------------------------
  16. ;; Automatic pairs open symbols (, {, [...
  17. ;; Disable for default.
  18. ;; Uncomment the next 4 lines if you want to enable the pairs-mode
  19. ;;(when (fboundp 'electric-pair-mode)
  20. ;; (electric-pair-mode))
  21. ;;(when (eval-when-compile (version< "24.4" emacs-version))
  22. ;; (electric-indent-mode 1))
  23. ;; Active auto-revert-mode that automatically reloads modified files out of Emacs.
  24. ;; It is very useful to see logs (like auto-revert-tail-mode) among many other cases.
  25. (global-auto-revert-mode)
  26. (setq global-auto-revert-non-file-buffers t
  27. auto-revert-verbose nil)
  28. ;;----------------------------------------------------------------------------
  29. ;; Show matching parens
  30. ;;----------------------------------------------------------------------------
  31. (show-paren-mode 1)
  32. ;;----------------------------------------------------------------------------
  33. ;; More useful things - only one line
  34. ;;----------------------------------------------------------------------------
  35. (set-default 'truncate-lines t)
  36. (setq show-trailing-whitespace nil)
  37. ;;---------------------------------------------------------------------------
  38. ;; XML
  39. ;;--------------------------------------------------------------------------
  40. (setq nxml-child-indent 4 nxml-attribute-indent 4)
  41. ;;----------------------------------------------------------------------------
  42. ;; Some basic preferences
  43. ;;----------------------------------------------------------------------------
  44. (setq-default
  45. indent-tabs-mode nil)
  46. ;;----------------------------------------------------------------------------
  47. ;;Fix ORG
  48. ;;----------------------------------------------------------------------------
  49. (setq org-support-shift-select 'always)
  50. ;;----------------------------------------------------------------------------
  51. ;; Undo-tree
  52. ;;----------------------------------------------------------------------------
  53. (use-package undo-tree
  54. :demand t
  55. :diminish undo-tree-mode
  56. :bind (("C-x u" . undo-tree-visualizer)
  57. (:map
  58. undo-tree-visualizer-mode-map ("RET" . undo-tree-visualizer-quit)))
  59. :init
  60. (defadvice undo-tree-make-history-save-file-name
  61. (after undo-tree activate)
  62. (setq ad-return-value (concat ad-return-value ".7z")))
  63. (defadvice undo-tree-visualize (around undo-tree-split-side-by-side activate)
  64. "Divide la ventana de lado a lado al visualizar undo-tree-visualize"
  65. (let ((split-height-threshold nil)
  66. (split-width-threshold 0))
  67. ad-do-it))
  68. (setf undo-tree-visualizer-timestamps t)
  69. (setf undo-tree-visualizer-diff nil)
  70. (setf undo-tree-auto-save-history nil) ;; no salva el historial de cambios
  71. :config
  72. (defalias 'redo 'undo-tree-redo)
  73. (global-undo-tree-mode 1))
  74. ;;----------------------------------------------------------------------------
  75. ;; which-key
  76. ;;----------------------------------------------------------------------------
  77. (use-package which-key
  78. :pin "MELPA"
  79. :ensure t
  80. :init
  81. (which-key-mode))
  82. (provide 'init-editing-utils)
  83. ;; Local Variables:
  84. ;; byte-compile-warnings: (not free-vars)
  85. ;; End:
  86. ;;; init-editing-utils.el ends here