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

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

emacs21 (in gnome) stalls/hangs/slows briefly when changing font


From: address@hidden
Subject: emacs21 (in gnome) stalls/hangs/slows briefly when changing font
Date: 30 Oct 2005 08:16:05 -0800
User-agent: G2/0.2

Hi all,

It's simple. Anytime I change a font (be it in .emacs.el, with the
mouse button, etc) emacs21 hangs. I'm running gnome 2.4 and debian.

It doesn't happen if I'm running fluxbox.

Here's my emacs.el (hugeish)

;;;_* initial packages

;; these modules are needed by the variable customizations, and so
;; must be made available before everything else






;;;_ + paths

(setq load-path (append '("~/Emacs/") load-path))
(add-to-list 'load-path "~/Emacs/ps-print/lisp/ps-print")
(setq ps-postscript-code-directory "~/Emacs/ps-print/etc/ps-print")

;;;_ + environmental variables

(setenv "BSTINPUTS" ".:~/localtexmf/frankenstein:~/localtexmf/mla::")
(setenv "BIBINPUTS" ".:~/bibliographies/::")
(setenv "TEXTBIB" ".:~/bibliographies/::")
(setenv "TEXINPUTS"
"${TEXINPUTS}:.:~/localtexmf/preprint:~/localtexmf/vmargin:~/localtexmf/frankenstein:~/localtexmf/misc:~/localtexmf:~/localtexmf/mla:~/localtexmf/plari:~/localtexmf/scripttex::")

;;;_ + auto-insert

      (add-hook 'find-file-hooks 'auto-insert)
      (load-library "autoinsert")
      (setq auto-insert-directory "~/Emacs/")
      (setq auto-insert-alist
            (append '((latex-mode .  "tex-insert.tex"))
                    auto-insert-alist))
;;;_ + ispell
(setq-default ispell-program-name "aspell")
;;;_ + ido

(require 'ido)
(ido-mode t)


;;;_ + flyspell-prog

(defun flyspell-prog-check-word ()
  (memq (get-text-property (point) 'face)
        '(font-lock-comment-face font-lock-string-face)))

(defun flyspell-prog-mode ()
  "Turn on `flyspell-mode' for comments and strings."
  (interactive)
  (set (make-local-variable 'flyspell-generic-check-word-p)
       'flyspell-prog-check-word)
  (let ((tab-binding (local-key-binding [(meta tab)]))
        (ctli-binding (local-key-binding [(meta control ?i)])))
    (flyspell-mode 1)
    (when (or tab-binding ctli-binding)
      (local-set-key [(meta tab)] (or tab-binding ctli-binding))
      (local-set-key [(meta control ?i)] (or tab-binding
ctli-binding)))))

;;;_* customizations

;;;_ + variables

(custom-set-variables
  ;; custom-set-variables was added by Custom -- don't edit or
cut/paste it!
  ;; Your init file should contain only one such instance.
 '(Emacs-Wiki-Maintainer "Mailto:ariddell@member.fsf.org")
 '(abbrev-mode t)
 '(align-to-tab-stop nil)
 '(ange-ftp-try-passive-mode t)
 '(auto-dmacro-alist (quote (("\\.el$" . dot-el) ("\\.h$" . dot-h)
("\\.sgml$" . dot-sgml))) t)
 '(auto-image-file-mode t nil (image-file))
 '(auto-save-interval 1024)
 '(backup-directory-alist (quote (("." . "~/.emacs.d/backups"))))
 '(backward-delete-char-untabify-method nil)
 '(bbdb-complete-name-allow-cycling t)
 '(bbdb-completion-display-record nil)
 '(bbdb-default-area-code "650")
 '(bbdb-default-country "")
 '(bbdb-dial-long-distance-prefix 1)
 '(bbdb-display-layout (quote multi-line))
 '(bbdb-display-layout-alist (quote ((one-line (order phones mail-alias
net notes) (name-end . 24) (toggle . t)) (multi-line (omit pilot-id)
(indention . 14) (toggle . t)) (pop-up-multi-line (indention . 14)))))
 '(bbdb-electric-p nil)
 '(bbdb-file "~/.bbdb")
 '(bbdb-offer-save (quote savenoprompt))
 '(bbdb-silent-running t)
 '(bbdb-sound-files (quote ["~/Emacs/sounds/touchtone.0.au"
"~/Emacs/sounds/touchtone.1.au" "~/Emacs/sounds/touchtone.2.au"
"~/Emacs/sounds/touchtone.3.au" "~/Emacs/sounds/touchtone.4.au"
"~/Emacs/sounds/touchtone.5.au" "~/Emacs/sounds/touchtone.6.au"
"~/Emacs/sounds/touchtone.7.au" "~/Emacs/sounds/touchtone.8.au"
"~/Emacs/sounds/touchtone.9.au" "~/Emacs/sounds/touchtone.pound.au"
"~/Emacs/sounds/touchtone.star.au"]) t)
 '(bbdb-sound-player "/usr/bin/esdplay" t)
 '(bbdb-use-pop-up nil)
 '(bookmark-save-flag 1)
 '(cal-tex-diary t)
 '(cal-tex-holidays t)
 '(change-log-mode-hook (quote (flyspell-mode (lambda nil
(filladapt-mode -1)))))
 '(check-mail-boxes (quote ("/var/mail/abr")))
 '(check-mail-summary-function (quote check-mail-mh-summary))
 '(chess-autosave-database "~/scid/games")
 '(chess-display-popup nil)
 '(chess-irc-nick "abrchess")
 '(chess-sound-play-function (quote chess-sound-play))
 '(chessboard-image-directory "~/Emacs/chess/small")
 '(clean-buffer-list-kill-regexps (quote (".*")))
 '(compilation-scroll-output t)
 '(compilation-search-path (quote (nil "~/src/bcc")) t)
 '(completion-ignored-extensions (quote ("CVS/" ".o" "~" ".bin" ".lbin"
".fasl" ".a" ".ln" ".blg" ".bbl" ".elc" ".lof" ".glo" ".idx" ".lot"
".dvi" ".fmt" ".class" ".fas" ".lib" ".x86f" ".toc" ".log" ".aux" ".cp"
".fn" ".ky" ".pg" ".tp" ".vr" ".cps" ".fns" ".kys" ".pgs" ".tps" ".vrs"
".pyo" ".pyc")))
 '(connection-broken-end-of-line t)
 '(copyright-limit 2010)
 '(copyright-regexp
"\\([\201\251\201\201\251]\\|@copyright{}\\|[Cc]opyright\\s *:?\\s
*([Cc])\\|[Cc]opyright\\s *:?\\s *[\201\251\201\201\251]\\)\\s
*\\([1-9][-0-9, ']*[0-9]+\\)")
 '(cperl-indent-level 4)
 '(crypt-encryption-file-extension "\\(\\.gpg\\)$" t)
 '(crypt-encryption-type (quote pgp-pub) t)
 '(crypt-no-extension-implies-plain nil t)
 '(crypt-pgp-pub-multirecipients nil t)
 '(crypt-pgp-pub-sub-library (quote gpg) t)
 '(custom-buffer-done-function (quote kill-buffer))
 '(custom-file "~/.emacs.el")
 '(custom-raised-buttons nil)
 '(cvs-inhibit-copyright-message t)
 '(default-input-method "latin-1-prefix")
 '(default-major-mode (quote text-mode))
 '(delete-old-versions t)
 '(desktop-buffer-handlers (quote (desktop-buffer-eshell
desktop-buffer-message desktop-buffer-dired desktop-buffer-info
desktop-buffer-file desktop-buffer-restore-buffer-data)))
 '(desktop-buffer-misc-functions (quote (desktop-buffer-info-misc-data
desktop-buffer-dired-misc-data desktop-buffer-eshell-misc
desktop-buffer-save-buffer-data)))
 '(desktop-buffer-modes-to-save (quote (Info-mode eshell-mode
message-mode help-mode compilation-mode lisp-interaction-mode)))
 '(desktop-buffers-not-to-save
"\\(^nn\\.a[0-9]+\\|^\\.nntodo\\|\\.log\\|(ftp)\\|^tags\\|^TAGS\\)$")
 '(desktop-data-buffers (quote (help-mode compilation-mode
lisp-interaction-mode)))
 '(desktop-globals-to-save nil t)
 '(diary-display-hook (quote (fancy-schedule-display-desk-calendar)))
 '(diary-file "~/doc/diary")
 '(diary-hook (quote (appt-make-list)))
 '(diary-list-include-blanks t)
 '(dictionary-server "localhost")
 '(dired-guess-shell-gnutar "tar")
 '(dired-load-hook (quote ((lambda nil (load "dired-x") (let ((ext
completion-ignored-extensions)) (while ext (add-to-list (quote
dired-omit-extensions) (car ext)) (setq ext (cdr ext))))))) t)
 '(dired-omit-files-p t)
 '(dired-recursive-copies (quote top))
 '(dired-recursive-deletes (quote top))
 '(display-time-24hr-format t)
 '(display-time-day-and-date t)
 '(display-time-mode t nil (time))
 '(dont-bind-my-keys t t)
 '(emacs-lisp-mode-hook (quote (eldoc-mode (lambda nil (local-set-key
[(meta 46)] (quote find-function)) (local-set-key [(control 109)]
(quote newline-and-indent))))))
 '(enable-recursive-minibuffers t)
 '(eval-expr-print-function (quote pp))
 '(flyspell-abbrev-p nil)
 '(flyspell-incorrect-hook (quote
(flyspell-maybe-correct-transposition)))
 '(font-lock-support-mode (quote jit-lock-mode))
 '(frame-title-format (quote (:eval (concat "Emacs: " (if
buffer-file-name default-directory "%b")))) t)
 '(global-auto-revert-mode t nil (autorevert))
 '(global-font-lock-mode t nil (font-lock))
 '(goto-address-url-face (quote underline))
 '(init-file-debug t t)
 '(initial-frame-alist (quote ((top . 0) (left . 0) (width . 98)
(height . 48))))
 '(initsplit-customizations-alist (quote
(("^\\(gnus\\|message\\|mail\\|smtpmail\\|feedmail\\|mc\\|mm\\|sc\\|nn[^-]+\\|bbdb/sc\\|bbdb-user-mail\\|bbdb-canonicalize\\)-"
"~/Emacs/.gnus.el" t))))
 '(ispell-really-aspell t t)
 '(iswitchb-mode t nil (iswitchb))
 '(iswitchb-use-frame-buffer-list t)
 '(kept-new-versions 9)
 '(kept-old-versions 9)
 '(kill-emacs-query-functions (quote ((lambda nil (setq debug-on-error
t)))) t)
 '(kill-whole-line t)
 '(list-diary-entries-hook (quote (include-other-diary-files)))
 '(mark-diary-entries-in-calendar t)
 '(mark-holidays-in-calendar t)
 '(menu-bar-mode nil)
 '(mouse-avoidance-mode (quote exile) nil (avoid))
 '(next-line-add-newlines nil)
 '(outline-inhibit-protection t)
 '(outline-old-style-prefixes t)
 '(paren-sexp-mode t)
 '(pcomplete-compare-entries-function (quote file-newer-than-file-p))
 '(ps-font-size (quote (8 . 10)))
 '(ps-footer-font-size (quote (12 . 14)))
 '(ps-header-font-size (quote (12 . 14)))
 '(ps-header-title-font-size (quote (14 . 16)))
 '(ps-line-number-font-size 10)
 '(ps-lpr-switches (quote ("-Php_laserjet_1012")))
 '(ps-print-color-p nil)
 '(ps-print-header nil)
 '(ps-print-header-frame nil)
 '(rcp-default-method "scp")
 '(reftex-default-bibliography (quote ("~/bibliography/abr.bib")))
 '(remember-mode-hook (quote (flyspell-mode)))
 '(require-final-newline t)
 '(save-abbrevs (quote silently))
 '(scroll-bar-mode (quote right))
 '(session-globals-exclude (quote (load-history
flyspell-auto-correct-ring)))
 '(session-registers (quote (t (0 . 127))))
 '(smiley-data-directory "~/Emacs/.smilies" t)
 '(smiley-regexp-alist (quote (("\\(:-?)\\)\\W" 1 "mysmile.xpm")
("\\(;-?)\\)\\W" 1 "mywink.xpm") ("\\(:-?D\\)\\W" 1 "biggrin.xpm")
("\\(:-?P~*\\)\\W" 1 "tongue.xpm") ("\\(:-[({]\\)\\W" 1
"myfrown.xpm"))))
 '(special-display-regexps (quote (("^\\*zenirc\\*" (width . 59)
(height . 5) (visibility . icon)) ("^#\\S-+\\s-+\\[.+\\]" (width . 59)
(height . 40)) ("^\\*FICS" (width . 80) (height . 30)))))
 '(tags-apropos-verbose t)
 '(tags-case-fold-search nil t)
 '(temp-buffer-resize-mode t nil (help))
 '(text-mode-hook (quote (turn-on-auto-fill)))
 '(tool-bar-mode nil nil (tool-bar))
 '(tramp-default-method "sudm" t)
 '(uniquify-buffer-name-style (quote post-forward-angle-brackets) nil
(uniquify))
 '(url-be-asynchronous t)
 '(url-keep-history t)
 '(user-full-name "Allen Beye Riddell")
 '(user-initials "ariddell")
 '(user-mail-address "ariddell@member.fsf.org")
 '(vc-follow-symlinks t)
 '(vc-make-backup-files t)
 '(version-control t)
 '(visible-bell t)
 '(vocab-test-directory "~/doc/vocab/")
 '(w3-default-stylesheet "~/.w3/default.css")
 '(w3-do-incremental-display t)
 '(w3-load-hook (quote ((lambda nil (turn-on-lynx-masquerade-mode)))))
 '(w3-strict-width 80 t)
 '(w3-user-colors-take-precedence t)
 '(w3m-arrived-file-coding-system (quote iso-latin-1))
 '(w3m-async-exec t)
 '(w3m-bookmark-file-coding-system (quote iso-latin-1))
 '(w3m-charset-coding-system-alist (quote ((x-unknown . undecided)
(unknown . undecided) (cp874 . tis-620) (windows-874 . tis-620)
(us-ascii . raw-text))))
 '(w3m-coding-system (quote iso-latin-1))
 '(w3m-edit-function (quote find-file-other-window))
 '(w3m-file-name-coding-system (quote iso-latin-1))
 '(w3m-fontify-after-hook (quote ((lambda nil "Change asterices into
bullets" (let ((inhibit-read-only t)) (save-excursion (goto-char
(point-min)) (while (re-search-forward "^\\s-*\\*" nil t)
(delete-backward-char 1) (insert (decode-char (quote ucs) 8226)))))))))
 '(w3m-home-page "file:/home/abr/.w3m/bookmark.html")
 '(w3m-input-coding-system (quote iso-latin-1))
 '(w3m-key-binding (quote info))
 '(w3m-mailto-url-function (quote compose-mail))
 '(w3m-output-coding-system (quote iso-latin-1))
 '(w3m-search-default-coding-system (quote iso-latin-1))
 '(w3m-search-default-engine "google")
 '(w3m-terminal-coding-system (quote iso-latin-1))
 '(w3m-use-toolbar nil)
 '(which-func-maxout 500000)
 '(whitespace-auto-cleanup t)
 '(whitespace-rescan-timer-time nil)
 '(whitespace-silent t)
 '(winner-mode t nil (winner))
 '(x-select-enable-clipboard t)
 '(x-stretch-cursor t))

;;;
;; (font . "-misc-fixed-medium-r-normal--15-140-75-75-c-90-iso8859-1")
;; -misc-fixed-medium-r-normal--15-140-75-75-c-70-iso8859-1"
;; interesting fotn
;; "-misc-fixed-medium-r-normal--15-140-75-75-c-70-iso8859-1"
;;  '(initial-frame-alist (quote ((top . 0) (left . 0) (width . 140)
(height . 48) (font .
"-schumacher-clean-medium-*-normal-*-12-120-*-75-*-60-iso8859-1"))))
;; height 50, 140
;; in gnome:
(custom-set-faces
  ;; custom-set-faces was added by Custom -- don't edit or cut/paste
it!
  ;; Your init file should contain only one such instance.
 '(default ((t (:stipple nil :background "white" :foreground "black"
:inverse-video nil :box nil :strike-through nil :overline nil
:underline nil :slant normal :weight normal :height 144 :width normal
:family "misc-fixed"))))
 '(erc-action-face ((t (:foreground "Cyan"))))
 '(erc-direct-msg-face ((t (:foreground "beige"))))
 '(erc-input-face ((t (:foreground "grey60"))))
 '(erc-notice-face ((t (:foreground "Orange"))))
 '(erc-pal-face ((t (:foreground "yellow" :weight bold))))
 '(erc-timestamp-face ((t (:foreground "green"))))
 '(font-lock-comment-face ((((class color) (background dark))
(:foreground "AquaMarine"))))
 '(highline-face ((t (:background "DimGray"))))
 '(info-node ((((class color)) (:foreground "orange" :bold t :italic
t)) (t (:bold t :italic t))))
 '(info-xref ((t (:foreground "cyan" :underline "cyan" :weight bold))))
 '(paren-face-match ((((class color)) (:weight bold))))
 '(secondary-selection ((((class color) (background dark)) (:background
"blue"))))
 '(tnt-my-name-face ((t (:weight bold :foreground "CornFlowerBlue"))))
 '(tnt-other-name-face ((t (:weight bold :foreground "Orange"))))
 '(widget-field-face ((((class grayscale color) (background dark))
(:background "dim gray" :foreground "white")))))

;;;_ + disabled commands

(put 'eval-expression  'disabled nil)   ; Let ESC-ESC work
(put 'narrow-to-region 'disabled nil)   ; Let narrowing work
(put 'narrow-to-page   'disabled nil)   ; Let narrowing work
(put 'upcase-region    'disabled nil)   ; Let downcasing work
(put 'downcase-region  'disabled nil)   ; Let upcasing work
(put 'erase-buffer     'disabled nil)

;;;_* packages

;;;_ + abbrev

(if (file-exists-p abbrev-file-name)
    (quietly-read-abbrev-file))

;;;_ + auctex

(load "tex-site" t)


;;_ + mailcrypt

(require 'mailcrypt-init)

(load "mc-auto-encrypt" t)
(setq mc-passwd-timeout 6000)


;;_ + reftex

(add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
(add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode

;;_ + time-stamp

(add-hook 'write-file-hooks 'time-stamp)

;;;_ + bbdb

;; (load "bbdb")
;; (bbdb-initialize 'gnus 'message 'sc)

;;;_ + calc

; FIX (load "calc")

;;;_ + calendar

(load "calendar")


;;;_ + wheel-mouse

(mouse-wheel-mode)

;;;_ + battery

(display-battery)

;;;_ + gnus

;;(push "/usr/local/src/emacs/site-lisp/gnus/contrib" load-path)
;;(push "/usr/local/src/emacs/site-lisp/gnus/lisp" load-path)

;; third argument for autload is DOCSTRING -- fourth arg =
;; interatctive or not.

;;(autoload 'gnus ".gnus" nil t)
;;(autoload 'gnus-no-server ".gnus" nil t)
;;(autoload 'gnus-plugged ".gnus" nil t)
;;(autoload 'gnus-unplugged ".gnus" nil t)



;;;_ + global


     (add-hook 'texinfo-mode-hook
               '(lambda ()
                  (define-key texinfo-mode-map "\C-cp"
                              'backward-paragraph)
                  (define-key texinfo-mode-map "\C-cn"
                              'forward-paragraph)))
;; text mode bindings


;; needs to be only for .txt files.
(add-hook 'text-mode-hook
          '(lambda ()
             (define-key mode-specific-map "t" 'insert-time-stamp-abr)
             (define-key mode-specific-map "d" 'insert-date-stamp-abr)
             (define-key mode-specific-map "j" 'insert-journal-date-stamp-abr)
             (define-key mode-specific-map "i" 'insert-iso-date-stamp-abr)
             (define-key mode-specific-map "p" 'ps-print-buffer)
             (define-key mode-specific-map "D"
'insert-dispositif-template-abr)
             ))

;;           (define-key mode-specific-map "\C-c" 'markdown-print)


;; Latex mode keybindings
(add-hook 'LaTeX-mode-hook
          '(lambda ()
             (define-key mode-specific-map "p" "\C-r{\C-f\C-b[]\C-b")
             (define-key mode-specific-map "t"
               (lambda () (interactive) (insert "% TS: ")))
             (define-key mode-specific-map "r"
               (lambda () (interactive) (insert "% R: ")))
             (define-key mode-specific-map "w"
               (lambda () (interactive) (insert "% W: ")))
             (define-key mode-specific-map "t" (lambda () (interactive)
                 (beginning-of-buffer)
                 (replace-string "\\begin{quote}"

"\\begin{quote}\n\\renewcommand{\\baselinestretch}{1.5}\\normalsize\n")
                 (beginning-of-buffer)
                 (replace-string "\\end{quote}"

"\\end{quote}\n\\renewcommand{\\baselinestretch}{2}\\normalsize\n")))
             (define-key mode-specific-map "s" (lambda () (interactive)
            (insert
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%
")))
             (define-key mode-specific-map "l" (lambda () (interactive)
                 (insert
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n")))
             ))


(define-key global-map  [(f9)] (lambda () (interactive)
                                 (insert
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n")
                                 (insert "% \n")
                                 (insert
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n")
                                 (previous-line 2)
                                 (forward-char 2)))


(define-key global-map [(meta ?\")] 'insert-quotes)
(define-key global-map [(meta ?o)] 'other-window)

(define-prefix-command 'lisp-find-map)
(define-key global-map [(control ?h) ?e] 'lisp-find-map)

(define-key lisp-find-map [?f] 'find-function)
(define-key lisp-find-map [?v] 'find-variable)
(define-key lisp-find-map [?k] 'find-function-on-key)

(define-key global-map [(meta ?B)] 'bbdb)
(define-key global-map [(meta ?C)] 'calendar)
(define-key global-map [(meta ?D)] 'diary)
(define-key global-map [(meta ?N)] 'winner-redo)
(define-key global-map [(meta ?P)] 'winner-undo)
(define-key global-map [(meta ?T)] 'tags-search)
(define-key global-map [(meta ?U)] 'unscroll)
(define-key global-map [(meta ?W)] 'dictionary-lookup-definition)

(define-key global-map [(meta ?g)] 'goto-line)


(define-key global-map [(alt tab)] 'indent-relative)

(define-key global-map [(alt ?a) ?a] 'append-to-buffer)
(define-key global-map [(alt ?a) ?p] 'prepend-to-buffer)
(define-key global-map [(alt ?a) ?c] 'copy-to-buffer)
(define-key global-map [(alt ?a) ?i] 'insert-buffer)
(define-key global-map [(alt ?a) ?f] 'append-to-file)

(define-key global-map [(alt ?b)] 'bookmark-jump)

(define-key global-map [(alt ?c) (control ?m)] 'customize)
(define-key global-map [(alt ?c) ?a] 'customize-apropos)
(define-key global-map [(alt ?c) ?b] 'customize-browse)
(define-key global-map [(alt ?c) ?c] 'customize-customized)
(define-key global-map [(alt ?c) ?f] 'customize-face)
(define-key global-map [(alt ?c) ?g] 'customize-group)
(define-key global-map [(alt ?c) ?o] 'customize-option)
(define-key global-map [(alt ?c) ?s] 'customize-saved)


(define-key global-map [(alt ?d)] 'kill-comment)


;; REFILL
(defun unfill-paragraph ()
  (interactive)
  (let ((fill-column (point-max)))
        (fill-paragraph nil)))
 (defun unfill-buffer ()
   "Undo filling for all paragraphs."
   (interactive)
   (goto-char (point-min))
   (let ((fill-column 99999))
     (fill-paragraph nil)
     (while (< (point) (point-max))
       (forward-paragraph)
       (fill-paragraph nil))))

;; WORD COUNT

(defun word-count-buffer ()
  "Count the words in a buffer.
Gives a quick word count for the buffer in the message line.
This removes the need to use the shell command."
  (interactive)                 ; available at a user level
  (word-count-region (point-min) (point-max) (buffer-name)))

(defun word-count-region (start end &optional description)
  "Count the words in a region.
This counts the number of words within a region including numbers, but
not punctuation. It has no special knowledge of TeX or LaTeX commands
so counts these as well. Uses forward-word as a guide to the next
word."
  (interactive "r")             ; gets the region if not already given
  (let ((words 0))              ; local variable counts words-so-far
    (save-excursion             ; don`t muck up the pointer and mark
      (goto-char start)         ; go to the beginning of the
buffer/region
      (while (< (point) end) (setq words (1+ words)) (forward-word 1))
      (backward-word 1)         ; fix for that one-word-out bug
      (if (> (point) end) (setq words (1- words))))
    (if (eq words 1)            ; let`s try to be user-friendly
        (message "There is only 1 word in %s" (or description "the region"))
      (message "There are %d words in %s" words
               (or description "the region")))))

;;; Final version: while
     (defun count-words-region (beginning end)
       "Print number of words in the region."
       (interactive "r")
       (message "Counting words in region ... ")

     ;;; 1. Set up appropriate conditions.
       (save-excursion
         (let ((count 0))
           (goto-char beginning)

     ;;; 2. Run the while loop.
           (while (and (< (point) end)
                       (re-search-forward "\\w+\\W*" end t))
             (setq count (1+ count)))

     ;;; 3. Send a message to the user.
           (cond ((zerop count)
                  (message
                   "The region does NOT have any words."))
                 ((= 1 count)
                  (message
                   "The region has 1 word."))
                 (t
                  (message
                   "The region has %d words." count))))))


;; ;;; timestamp

     (defun insert-time-stamp-abr ()
       "Put a time stamp in format dd.mm.yy hh:mm in GMT"
       (interactive)
       (message "Inserting time stamp")
       (insert (format-time-string "%d.%m.%y %H:%M" () t) " GMT")
)

;;; datestamp
     (defun insert-date-stamp-abr ()
       "Put a date stamp in format dd Month yyyy"
       (interactive)
       (message "Inserting date stamp")
             (insert (format-time-string "%d %B %Y")))
;;; journal-datestamp
;;      (defun insert-journal-date-stamp-abr ()
;;        "Put a date stamp in format dd Month yyyy"
;;        (interactive)
;;        (message "Inserting date stamp")
;;              (insert (format-time-string "%a %d %B %Y %H:%M %Z"))
;;           (insert "\n")
;;           (dotimes (i (length (concat (format-time-string "%a %d %B %Y
%H:%M %Z"))))
;;             (insert "-"))
;;           (insert "\n"))
     (defun insert-journal-date-stamp-abr ()
       "Put a date stamp in format dd Month yyyy"
       (interactive)
       (message "Inserting date stamp")
             (insert (format-time-string "%Y%m%d"))
             (insert "\n")
             (dotimes (i (length (concat (format-time-string "%Y%m%d"))))
               (insert "-"))
             (insert "\n"))

;;; iso-datestamp
     (defun insert-iso-date-stamp-abr ()
       "Put a date stamp in iso format"
       (interactive)
       (message "Inserting date stamp")
             (insert (format-time-string "%Y-%m-%dT%T%z")))


;;; dispositif

(defun insert-dispositif-template-abr ()
  "Special Function for enter records in dispositif"
  (interactive)
  (end-of-buffer)
  (insert (concat "\nBLOCK: " (read-from-minibuffer "BLOCK: ")))
  (let ((beg (point))) (forward-line 1) (delete-region beg (point))
(insert "\nTAG: ")
(insert (read-from-minibuffer "TAG: "))
(insert "\nPROJECT: ")
(insert (read-from-minibuffer "PROJECT: "))
(insert "\nCATEGORY: \n")
(insert "ATTACHMENTS: \n")
(insert "DATE_ENTERED: " (format-time-string "%Y-%m-%dT%T%z") "\n")
(insert "DATE_UPDATED: " (format-time-string "%Y-%m-%dT%T%z") "\n")
(insert "TEXT: \n\n")
;;(goto-char beg)))
))


;; markdown

(defun markdown-print ()
  "Print a markdown formatted file via html and firefox"
  (interactive)
  (shell-command (concat "/home/abr/bin/markdown_abr.pl "
(buffer-file-name) " > /dev/null"))
  )




;;;_ + fonts
(defun font-helvetica-12 ()
        (interactive)
        (set-default-font
"-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso10646-1"))
(defun font-courier-12 ()
        (interactive)
        (set-default-font
"-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso10646-1"))
(defun font-courier-14 ()
        (interactive)
        (set-default-font
"-adobe-courier-medium-r-normal--14-100-100-100-m-90-iso10646-1"))
(defun font-lucidatypewriter-12 ()
        (interactive)
        (set-default-font
"-b&h-lucidatypewriter-medium-r-normal-sans-12-120-75-75-m-70-iso10646-1"))
(defun font-fixed-10 ()
        (interactive)
        (set-default-font
"-misc-fixed-medium-r-normal--10-100-75-75-c-60-iso10646-1"))
(defun font-fixed-13 ()
        (interactive)
        (set-default-font
"-misc-fixed-medium-r-normal--13-100-100-100-c-70-iso8859-1"))
(defun font-fixed-14 ()
        (interactive)
        (set-default-font
"-misc-fixed-medium-r-normal--14-110-100-100-c-70-iso8859-1"))
;;(defun font-courier () (interactive) (font-courier-14))
(defun font-fixed ()   (interactive) (font-fixed-14))
(defun font-default () (interactive) (font-fixed-14))
(font-default)



reply via email to

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