help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What are Emacs best uses?


From: Joe Corneli
Subject: Re: What are Emacs best uses?
Date: Tue, 13 Aug 2013 14:34:00 +0100

On Mon, Aug 12, 2013 at 7:08 PM, Pascal J. Bourguignon
<pjb@informatimago.com> wrote:

> Ok, so let's see what other programs beside emacs I use, perhaps that'll
> give us a hint at what emacs is bad:

Nice!  And, going the other direction, here are a few files that I've
had a reason to use (or create, or customize) when working on my
thesis or day job, or just for fun, over the last year or so.  I hope
the titles are explanatory enough.  To concur with Pascal's point
about personal modifications: most of these aren't published anywhere.

"Miscellaneous" - quick coding for fun and profit

loccur.el litable.el cards.el toki-pona.el wc-mode.el hide-lines.el
randomize-region.el tex-mode.el calendar.el caps-mode.el mal-mode.el
dash.el extract-examples.el greek-mode.el toki-pona-hack.el
loop-throwaway.el monthly-mode.el power-laws.el

"Research" - programmatic and idiosyncratic text mangling as well as
interaction with external programs

premixx.el contributing-users.el alternate-formulation.el general-utilities.el
run-through-top-100-users.el apm-analysis.el
more-encyclopedia-analysis.el forum-analysis-client.el
convert-to-tims-format.el run-through-top-100-users-variant1.el
emacs-spine.el minimal-arxana.el authors-uniq.el linkwords-long.el
more-forum-analysis.el seconds-converter.el apm-terms.el
computing-entropy.el linked-words.el forum-analysis.el
emacs-spine-revised.el filter-data.el linkwords.el
extract-math-terms.el emacs-parse-preamble.el git-log-extractor.el
corrections-analysis.el top-100.el encyclopedia-analysis.el
committers.el ess.el

"Work" - more text mangling (e.g. tab-separated columns instead of spreadsheets)

recombinant.el recombinant2.el delete-stopwords.el swap-two-columns.el
freebaseize.el unique-fields.el delete-first-column.el
delete-doubles.el extractor2.el extractor3.el
turn-freebase-data-into-rdf.el postprocess.el extractor.el
zip-two-buffers-together.el

"General usability" - useful compatibility layer
magit.el markdown-mode.el all.el php-mode.el

... and to continue with an extract from my ~/.emacs -- I'm finding
the calendar quite useful, but only after relatively *extensive*
customizations (copied below).

(require 'diary-lib)
(require 'calendar)

(setq calendar-view-diary-initially-flag t
      ;; «This variable does not affect the diary display with the `d'
      ;; command from the calendar; in that case, the prefix argument
      ;; controls the number of days of diary entries displayed.»
      ;; -- description of `diary-number-of-entries'
      diary-number-of-entries 7)

;;; DIARY bindings
;; This lets you close the diary and redisplay changes
(define-key diary-mode-map (kbd "C-c C-c") '(lambda () (interactive)
                                              (widen)
                                              (quit-window)
                                              (calendar)))

(define-key diary-mode-map (kbd "C-c C-d") '(lambda () (interactive)
                                              (goto-char (line-end-position))
                                              (insert " DONE")
                                              ))

(define-key diary-mode-map (kbd "C-c C-w") '(lambda () (interactive)
                                              (widen)
                                              ))

(define-key diary-mode-map (kbd "C-o") '(lambda () (interactive)
                                          (goto-char (line-end-position))
                                          (open-line 1)
                                          (forward-line 1)
                                          (insert "  ")))

(define-key diary-mode-map (kbd "C-o") '(lambda () (interactive)
                                          (goto-char (line-end-position))
                                          (open-line 1)
                                          (forward-line 1)
                                          (insert "  ")))

;;; CALENDAR bindings
;; This lets you insert entries into the diary directly from the
;; calendar in a nicer way than the usual i-d command, since it
;; collates with previously existing entries, by date.
(define-key calendar-mode-map "ie"
  (lambda () (interactive)
    (let ((date (calendar-date-string (calendar-cursor-to-date t) t t)))
      (other-window 1)
      (find-file diary-file)
      (widen)
      (goto-char (point-min))
      (if (search-forward date nil t)
          (when (search-forward-regexp "^[A-Z]" nil t)
            (backward-char 1)
            (insert "  \n")
            (backward-char 1))
        (goto-char (point-max))
        (backward-char 1)
        (if (looking-at "\n")
            (progn (forward-char)
                   (insert (concat date "\n  ")))
          (forward-char)
          (insert (concat "\n" date "\n  ")))))))

;;; DIARY DISPLAY binding
;; This lets you edit specific entries from the fancy diary display
(add-hook 'diary-fancy-display-mode-hook
          '(lambda ()
             (local-set-key  (kbd "e")
                             '(lambda () (interactive)
                                (let (date)
                                  (if (looking-at (diary-fancy-date-pattern))
                                      (setq date (match-string 0))
                                    (re-search-backward
                                     (diary-fancy-date-pattern))
                                    (setq date (match-string 0)))
                                  (find-file "~/diary")
                                  (widen)
                                  (goto-char (point-min))
                                  ;; needs some coding improvements in
case matches aren't found
                                  (when (search-forward
(replace-regexp-in-string
                                                   "^[^ ]* \\(...\\)[^ ]* "
                                                   "\\1 "
                                                   date)
                                                  nil t)
                                  (let* ((beg (line-beginning-position))
                                         (next (search-forward-regexp
"^[A-Z]" nil t))
                                         (end (if next
                                                  (- next 1)
                                                (point-max))))
                                    (narrow-to-region beg end)
                                    (goto-char (point-min)))))))))

; The alternative is: diary-simple-display, that can be used
alternately see below
(setq diary-display-function 'diary-fancy-display)

(define-key calendar-mode-map "n" (lambda () (interactive)
                                    (let ((diary-display-function
'diary-simple-display)
                                          ;; Setting this explicitly
was important
                                          ;; to get around what
otherwise looked like a bug
                                          (diary-number-of-entries 1))
                                      (diary-view-entries))))

(add-hook 'today-visible-calendar-hook 'calendar-mark-today)

(add-hook 'diary-fancy-display-mode-hook
       '(lambda ()
              (alt-clean-equal-signs)))

(add-hook 'diary-fancy-display-mode-hook
          '(lambda () (setq selective-display 3
                            selective-display-ellipses nil)))

(defface calendar-tag-face
  '((t (:foreground "red" :weight bold)))
  "Used for tags in the calendar.")

(defface calendar-keyword-face
  '((t (:foreground "Cyan1" :weight bold)))
  "Used for super special keywords in the calendar.")

;; display org-like tags in the diary (four or more capital letters in a row)
(add-hook 'diary-fancy-display-mode-hook
           '(lambda () (font-lock-add-keywords
                        nil
                        '(("\\<[A-Z]\\{4,\\}\\>" . 'calendar-tag-face)))))

(add-hook 'diary-mode-hook
          '(lambda () (font-lock-add-keywords
                       nil
                       '(("\\<[A-Z]\\{4,\\}\\>" . 'calendar-tag-face)))))

(add-hook 'diary-fancy-display-mode-hook
           '(lambda () (font-lock-add-keywords
                        nil
                        '(("\\<\\(DONE\\)\\>" 1 'calendar-keyword-face
prepend)))))

(add-hook 'diary-mode-hook
          '(lambda () (font-lock-add-keywords
                       nil
                       '(("\\<\\(DONE\\)\\>" 1 'calendar-keyword-face
prepend)))))

(defun alt-clean-equal-signs ()
   "This function makes lines of = signs invisible."
   (goto-char (point-min))
   (let ((state buffer-read-only))
     (when state (setq buffer-read-only nil))
     (while (not (eobp))
       (search-forward-regexp "^=+$" nil 'move)
       (add-text-properties (match-beginning 0)
                        (match-end 0)
                '(invisible t)))
     (when state (setq buffer-read-only t))))

;; As far as I can tell, sorting doesn't actually work - is this a bug?
;; jac July 31, 2013
(add-hook 'diary-list-entries-hook 'diary-sort-entries t)
(setq diary-list-include-blanks t)

;;; Start it on load - but after thing are properly set up
(setq inhibit-startup-screen t)
(add-hook 'after-init-hook (lambda () (progn (calendar)
                                             (diary-mark-entries))))

(add-hook 'diary-list-entries-hook 'diary-include-other-diary-files)
; (add-hook 'diary-mark-entries-hook 'diary-mark-included-diary-files)

(defun calendar-view-all ()
  (interactive)
  (add-hook 'diary-mark-entries-hook 'diary-mark-included-diary-files)
  (save-window-excursion (find-file "~/diary")
                         (goto-char (point-min))
                         (insert "&"))
  (calendar)
  (remove-hook 'diary-mark-entries-hook 'diary-mark-included-diary-files)
  (save-window-excursion (find-file "~/diary")
                         (goto-char (point-min))
                         (delete-char 1)))

(setq diary-comment-start "¡")
(setq diary-comment-end "!")

(require 'appt)
(appt-activate 1)
;; See also: appt-warning-time-regexp
(setq appt-message-warning-time 10)
(setq appt-display-format 'echo)
(setq appt-display-mode-line t)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]