4 Commits 5d94242376 ... a5c7ee3392

Autor SHA1 Mensaje Fecha
  Distopico Vegan a5c7ee3392 setup calendar integration hace 1 año
  Distopico Vegan fe43d9ebf1 hippie cleanup hace 1 año
  Distopico Vegan 1b48fce3b5 move calendar configuration to another file hace 1 año
  Distopico Vegan d513899006 fix jabber mode-line hace 1 año

+ 5 - 1
core/setup-keybindings.el

@@ -21,9 +21,13 @@
 (global-set-key (kbd "C-c c w") 'copy-whole-lines)
 (global-set-key (kbd "<C-S-SPC>") 'cua-rectangle-mark-mode)
 (global-set-key (kbd "C-c y") 'browse-kill-ring)
+(global-set-key (kbd "M--") 'hippie-expand)
+(global-set-key (kbd "M-s--") 'distopico:hippie-expand-no-case-fold)
+(global-set-key (kbd "M-s-_") 'distopico:hippie-expand-lines)
 
 ;; Command with default hard keys such ^
-(global-set-key (kbd "M--") 'delete-indentation)
+(global-set-key (kbd "C-S-d") 'delete-indentation)
+(global-set-key (kbd "M-s-.") 'dabbrev-expand)
 
 ;; File manager
 (global-set-key [f7] 'dired-jump-other-window)

+ 1 - 0
init.el

@@ -55,6 +55,7 @@
 
 ;; Write and organize
 ;;(require 'conf-pomodoro)
+(require 'conf-calendar)
 (require 'conf-org)
 (require 'conf-present)
 (require 'conf-markdown)

+ 52 - 0
modes/conf-calendar.el

@@ -0,0 +1,52 @@
+;;; Code:
+(require 'diary-lib)
+(require 'holidays)
+(require 'lunar)
+
+;; General settings
+(setq calendar-mark-diary-entries-flag t
+      calendar-view-diary-initially-flag t
+      calendar-mark-holidays-flag t
+      lunar-phase-names
+      '("● New Moon"
+	"☽ First Quarter Moon"
+	"○ Full Moon"
+	"☾ Last Quarter Moon"))
+
+(add-to-list 'auto-mode-alist '("diary" . diary-mode))
+
+;; Custom holidays
+(setq-default holiday-general-holidays
+      '((holiday-fixed 1 1 "Año nuevo")
+	(holiday-sexp '(calendar-nth-named-day 1 1 1 year 6) "Día de Reyes")
+	(holiday-sexp '(calendar-nth-named-day 1 1 3 year 19) "Día de San José")
+	(holiday-easter-etc -3 "Jueves Santo")
+	(holiday-easter-etc -2 "Viernes Santo")
+	(holiday-fixed 5 1 "Día del trabajo")
+	(holiday-easter-etc +43 "Día de la ascención")
+	(holiday-sexp '(calendar-nth-named-day 1 1 6 year 29)
+		      "San Pedro y San Pablo")
+	(holiday-easter-etc +64 "Corpus Christi")
+	(holiday-easter-etc +71 "Sagrado corazón")
+	(holiday-fixed 7 20 "Día de la independencia")
+	(holiday-fixed 8 7 "Batalla de Boyacá")
+	(holiday-sexp '(calendar-nth-named-day 1 1 8 year 15)
+		      "Asunción de la virgen")
+	(holiday-sexp '(calendar-nth-named-day 1 1 10 year 12) "Día de la raza")
+	(holiday-sexp '(calendar-nth-named-day 1 1 11 year 1)
+		      "Todos los santos")
+	(holiday-sexp '(calendar-nth-named-day 1 1 11 year 11)
+		      "Independencia de Cartagena")
+	(holiday-fixed 12 8 "Inmaculada concepción")
+	(holiday-fixed 12 25 "Navidad")))
+
+(setq calendar-holidays (append holiday-general-holidays
+				holiday-local-holidays
+				holiday-other-holidays
+				holiday-solar-holidays))
+
+;; Hooks
+(add-hook 'calendar-today-visible-hook 'calendar-mark-today)
+
+(provide 'conf-calendar)
+;;; conf-calendar.el ends here

+ 5 - 0
modes/conf-dired.el

@@ -43,6 +43,9 @@
 ;; Custom keymap
 (define-key dired-mode-map (kbd "C-<right>") 'dired-subtree-insert)
 (define-key dired-mode-map (kbd "C-<left>") 'dired-subtree-remove)
+(define-key dired-mode-map (kbd "_") 'dired-up-directory)
+(define-key dired-mode-map (kbd "|") 'dired-up-directory)
+(define-key dired-mode-map (kbd "M--") 'dired-up-directory)
 (define-key dired-mode-map (kbd "C-c s") 'distopico:dired-sort)
 (define-key dired-mode-map (kbd "r") 'distopico:dired-toggle-reverse)
 (define-key dired-mode-map [mouse-2] 'dired-mouse-find-file)
@@ -180,6 +183,8 @@ see `dired-insert-directory' documentation for more information."
 ;; Hooks
 (add-hook 'dired-mode-hook 'distopico:dired-mode-hook)
 (add-hook 'dired-after-readin-hook 'distopico:dired-after-readin-hook)
+;; Attach files with C-c RET C-a
+(add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
 
 (provide 'conf-dired)
 ;;; conf-dired.el ends here

+ 9 - 86
modes/conf-hippie.el

@@ -1,92 +1,14 @@
+;;; Code:
 (defvar he-search-loc-backward (make-marker))
 (defvar he-search-loc-forward (make-marker))
 
-
-;; Hippie expand: sometimes too hip
-(setq hippie-expand-try-functions-list
-      '(try-expand-dabbrev-closest-first
-        try-complete-file-name
-        try-expand-dabbrev-all-buffers
-        try-expand-dabbrev-from-kill
-        try-expand-all-abbrevs
-        try-complete-lisp-symbol-partially
-        try-complete-lisp-symbol))
-
 ;; Functions
-(defun try-expand-dabbrev-closest-first (old)
-  "Try to expand word \"dynamically\", searching the current buffer.
-The argument OLD has to be nil the first call of this function, and t
-for subsequent calls (for further possible expansions of the same
-string).  It returns t if a new expansion is found, nil otherwise."
-  (let (expansion)
-    (unless old
-      (he-init-string (he-dabbrev-beg) (point))
-      (set-marker he-search-loc-backward he-string-beg)
-      (set-marker he-search-loc-forward he-string-end))
-
-    (if (not (equal he-search-string ""))
-        (save-excursion
-          (save-restriction
-            (if hippie-expand-no-restriction
-                (widen))
-
-            (let (forward-point
-                  backward-point
-                  forward-distance
-                  backward-distance
-                  forward-expansion
-                  backward-expansion
-                  chosen)
-
-              ;; search backward
-              (goto-char he-search-loc-backward)
-              (setq expansion (he-dabbrev-search he-search-string t))
-
-              (when expansion
-                (setq backward-expansion expansion)
-                (setq backward-point (point))
-                (setq backward-distance (- he-string-beg backward-point)))
-
-              ;; search forward
-              (goto-char he-search-loc-forward)
-              (setq expansion (he-dabbrev-search he-search-string nil))
-
-              (when expansion
-                (setq forward-expansion expansion)
-                (setq forward-point (point))
-                (setq forward-distance (- forward-point he-string-beg)))
-
-              ;; choose depending on distance
-              (setq chosen (cond
-                            ((and forward-point backward-point)
-                             (if (< forward-distance backward-distance) :forward :backward))
-
-                            (forward-point :forward)
-                            (backward-point :backward)))
-
-              (when (equal chosen :forward)
-                (setq expansion forward-expansion)
-                (set-marker he-search-loc-forward forward-point))
-
-              (when (equal chosen :backward)
-                (setq expansion backward-expansion)
-                (set-marker he-search-loc-backward backward-point))
-
-              ))))
-
-    (if (not expansion)
-        (progn
-          (if old (he-reset-string))
-          nil)
-      (progn
-        (he-substitute-string expansion t)
-        t))))
-
-(defun try-expand-line-closest-first (old)
+(defun distopico:try-expand-line-closest-first (old)
   "Try to complete the current line to an entire line in the buffer.
 The argument OLD has to be nil the first call of this function, and t
 for subsequent calls (for further possible completions of the same
-string).  It returns t if a new completion is found, nil otherwise."
+string).  It returns t if a new completion is found, nil otherwise.
+from: https://gist.github.com/magnars/4060654"
   (let ((expansion ())
         (strip-prompt (and (get-buffer-process (current-buffer))
                            comint-use-prompt-regexp
@@ -156,18 +78,19 @@ string).  It returns t if a new completion is found, nil otherwise."
         (he-substitute-string expansion t)
         t))))
 
-(defun hippie-expand-lines ()
-  "Create own function to expand lines (C-S-.)"
+(defun distopico:hippie-expand-lines ()
+  "Create own function to expand lines."
   (interactive)
   (let ((hippie-expand-try-functions-list '(try-expand-line-closest-first
                                             try-expand-line-all-buffers)))
     (end-of-line)
     (hippie-expand nil)))
 
-(defun hippie-expand-no-case-fold ()
-  "Don't case-fold when expanding with hippe"
+(defun distopico:hippie-expand-no-case-fold ()
+  "Don't case-fold when expanding with `hippe-mode'."
   (interactive)
   (let ((case-fold-search nil))
     (hippie-expand nil)))
 
 (provide 'conf-hippie)
+;;; conf-hippie.el ends here

+ 1 - 1
modes/conf-jabber.el

@@ -245,7 +245,7 @@ Optional argument GROUP to look."
   "Extract last jabber `JID' from `ACTIVITY-JIDS' list."
   (let* ((activity-sort-jids (distopico:jabber--activity-sort-jids activity-jids))
          (last-jid (car (cdr (car activity-sort-jids)))))
-    (cons last-jid activity-jids)))
+    (cons last-jid activity-sort-jids)))
 
 (defun distopico:jabber--activity-mode-line-format (activity-jids)
   "Format jabber `ACTIVITY-JIDS' to `mode-line' propertize.

+ 1 - 0
modes/conf-magit.el

@@ -32,3 +32,4 @@
 (add-hook 'magit-popup-mode-hook #'distopico:magit-popup-mode-hook)
 
 (provide 'conf-magit)
+;;; conf-magit.el ends here

+ 9 - 4
modes/conf-mu4e.el

@@ -1,6 +1,7 @@
 ;;; Code:
 (require 'mu4e)
 (require 'mu4e-contrib)
+(require 'mu4e-icalendar)
 (require 'message-view-patch)
 (require 'smtpmail-async)
 (require 'buffer-defuns)
@@ -143,7 +144,6 @@ launch the no-attachment warning message defined in
              '("View in browser" . mu4e-action-view-in-browser) t)
 (add-to-list 'mu4e-view-actions
              '("add contact org" . distopico:mu4e-action-add-org-contact) t)
-
 (add-to-list 'mu4e-headers-actions
              '("add contact org" . distopico:mu4e-action-add-org-contact) t)
 
@@ -174,17 +174,21 @@ launch the no-attachment warning message defined in
 (setq mml-secure-openpgp-encrypt-to-self t
       mml-secure-openpgp-sign-with-sender t)
 
+;; Calendar support
+(mu4e-icalendar-setup)
+(gnus-icalendar-org-setup)
+
 ;; Custom keymap
 (define-key mu4e-main-mode-map "r" 'distopico:mu4e-maildirs-force-update)
 (define-key mu4e-main-mode-map (kbd "q") 'distopico:mu4e-close)
 (define-key mu4e-main-mode-map (kbd "C-q") 'distopico:mu4e-close)
 (define-key mu4e-headers-mode-map (kbd "C-q") 'distopico:mu4e-kill-close)
 (define-key mu4e-headers-mode-map (kbd "C-x k") 'distopico:mu4e-kill-close)
-(define-key mu4e-headers-mode-map (kbd "C-c o c") 'org-mu4e-store-and-capture)
+(define-key mu4e-headers-mode-map (kbd "C-c o c") 'mu4e-org-store-and-capture)
 (define-key mu4e-headers-mode-map "o" 'distopico:mu4e-toggle-headers-include-related)
 (define-key mu4e-view-mode-map (kbd "C-q") 'distopico:mu4e-kill-close)
 (define-key mu4e-view-mode-map (kbd "C-x k") 'distopico:mu4e-kill-close)
-(define-key mu4e-view-mode-map (kbd "C-c o c") 'org-mu4e-store-and-capture)
+(define-key mu4e-view-mode-map (kbd "C-c o c") 'mu4e-org-store-and-capture)
 
 ;;------------------
 ;; Functions
@@ -279,7 +283,8 @@ store your org-contacts."
   (unless mu4e-org-contacts-file
     (mu4e-error "`mu4e-org-contacts-file' is not defined"))
   (let* ((sender (car-safe (mu4e-message-field msg :from)))
-         (name (car-safe sender)) (email (cdr-safe sender))
+         (name (mu4e-contact-name sender))
+         (email (mu4e-contact-email sender))
          (blurb
           (format
            (concat

+ 7 - 18
modes/conf-org.el

@@ -2,9 +2,6 @@
 (require 'alert)
 (require 'org)
 (require 'appt)
-(require 'diary-lib)
-(require 'lunar)
-(require 'diary-loaddefs)
 (require 'org-clock)
 (require 'org-habit)
 (require 'org-goto)
@@ -16,6 +13,7 @@
 (require 'org-protocol)
 (require 'org-projectile)
 (require 'org-annotate-file)
+(require 'gnus-icalendar)
 (require 'midnight)
 (require 'bookmark)
 
@@ -77,9 +75,9 @@
 ;; Contacts
 (setq org-contacts-files (list (expand-file-name "contacts.org" org-directory)))
 
-;; Diary
-(setq org-agenda-diary-file (expand-file-name "calendar.org" org-directory))
-(add-to-list 'auto-mode-alist '("diary" . diary-mode))
+;; Diary to Org
+(setq diary-file (concat org-directory "diary")
+      org-agenda-diary-file (expand-file-name "calendar.org" org-directory))
 
 ;;Archive
 (setq org-archive-location (expand-file-name "archive/archive_%s::" org-directory))
@@ -242,17 +240,6 @@
 	("y" "Syadmin stuff to do" tags-todo "+sysadmin+SCHEDULED=\"\"")
 	("D" "Daily tasks:" tags "daily|CATEGORY=\"daily\"|STYLE=\"habit\"")))
 
-;; Calendar
-(setq diary-file (concat org-directory "diary")
-      calendar-mark-diary-entries-flag t
-      calendar-view-diary-initially-flag t
-      calendar-mark-holidays-flag t
-      lunar-phase-names
-      '("● New Moon"
-	"☽ First Quarter Moon"
-	"○ Full Moon"
-	"☾ Last Quarter Moon"))
-
 ;;Appointment
 (setq appt-audible nil
       appt-display-diary nil
@@ -292,6 +279,9 @@
       '(("M" ((in-mode . "mu4e-headers-mode")
 	      (in-mode . "mu4e-view-mode")))))
 
+(setq gnus-icalendar-org-capture-file (concat org-directory "calendar.org")
+      gnus-icalendar-org-capture-headline '("Personal"))
+
 ;; Org Projectile
 (setq org-projectile-projects-file (expand-file-name "todo.org" org-directory))
 (push (org-projectile-project-todo-entry) org-capture-templates)
@@ -833,7 +823,6 @@ See: `org-capture-finalize' for `STAY-WITH-CAPTURE' docs."
 ;; Hooks
 (add-hook 'org-mode-hook 'distopico:org-init-hook)
 (add-hook 'org-after-todo-state-change-hook #'distopico:org-after-todo-state-change-hook 'append)
-(add-hook 'calendar-today-visible-hook 'calendar-mark-today)
 (add-hook 'midnight-hook 'distopico:org-show-agenda-appt 'append)
 (add-hook 'distopico:after-init-load-hook #'distopico:org-init-load-hook)
 

+ 0 - 0
modes/conf-yasnippet.el


Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio