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

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

[h-e-w] Highlighting


From: Scott Purcell
Subject: [h-e-w] Highlighting
Date: Thu, 20 Feb 2003 13:52:01 -0600

Hello,
I am trying to get emacs to highlight areas when I am using the editor via the 
keyboard.  Firstly, I have a _emacs file (I am on a pc) and it works. And when 
I mouse and highlight some text, it shows up highlighted.

But I try to never use a mouse, and when I use the  ctl [spacebar] ctr e (which 
marks a line) it does not get highlighted. How do I turn on that function. (I 
know I can turn it on each time using Emacs/help/options (Transient/Mark Mode) 
on the menu, but I am getting of tired of turning that on each time I launch 
emacs.

Thanks,
Scott


;; turn on pc type settings (home/end, shift cursor keys etc.)
(pc-selection-mode)

;;{{{ SET auto-mode-alist
(setq auto-mode-alist
      '(("\\.[Cc][Oo][Mm]\\'" . text-mode)
        ("\\.bat\\'" . bat-generic-mode)
        ("\\.inf\\'" . inf-generic-mode)
        ("\\.rc\\'" . rc-generic-mode)
        ("\\.reg\\'" . reg-generic-mode)

        ("\\.te?xt\\'" . text-mode)
        ("\\.c\\'" . c-mode)
        ("\\.h\\'" . c++-mode)
        ("\\.tex$" . LaTeX-mode)))

;;}}}



;; highlight the marked region
(transient-mark-mode t)
(setq transient-mark-mode t)
(global-font-lock-mode t)
(setq font-lock-maximum-mode t)

;; highlight matching paren
(show-paren-mode 1)

;; set tab width
(setq default-tab-width 4)
(setq-default indent-tabs-mode nil)   ;; use spaces not real tabs
(setq-default perl-tab-to-comment t)  ;; in perl TAB indents lines or comments

;; show current line and column number in status bar
(setq line-number-display-limit 99999) 
(setq line-number-mode t) 
(setq column-number-mode t) 

;; make it quiet - bell just flashes the screen
(setq visible-bell t)

;; map M-g to goto-line
(global-set-key "\M-g" 'goto-line)

;; remember to remove extra ^M from DOS command output
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)


;; Turn on font-lock stuff for colour syntax highlighting
;; Set up some colours ...
;;
(cond ((fboundp 'global-font-lock-mode)
       ;; Customize the face attributes
       (setq font-lock-face-attributes
             ;; Symbol-for-Face Foreground Background Bold Italic Underline
             '((font-lock-comment-face       "DarkGreen" "gray95")
                   (font-lock-constant-face      "Red" "white" 1)
               (font-lock-function-name-face "Blue")
               (font-lock-keyword-face       "Navy" "white" 1)
               (font-lock-reference-face     "Purple")
               (font-lock-string-face        "Red")
               (font-lock-type-face          "Black")
               (font-lock-variable-name-face "Black" "white" 1)

               ))
       ;; Load the font-lock package.
       (require 'font-lock)
       ;; Maximum colors
       (setq font-lock-maximum-decoration t)
       ;; Turn on font-lock in all modes that support it
       (global-font-lock-mode t)))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; perl debugger support

;;;  Have to fix up compilation mode for perl
(require 'compile)

;;  Add the regex for looking for perl compile errors
(defvar perl-compilation-error-regexp-alist 
  ;; This looks like a paranoiac regexp: could anybody find a better one?
  '(("^[^\n]* \\(file\\|at\\) \\([^ \t\n]+\\) [^\n]*line \\([0-9]+\\)[\\., \n]"
     2 3))
  "Alist that specifies how to match errors in perl output.")
(setq compilation-error-regexp-alist
      (append compilation-error-regexp-alist
              perl-compilation-error-regexp-alist))

;;  Make compilation mode think that gud buffers are OK for error parsing.
(defsubst compilation-buffer-p (buffer)
  (save-excursion
    (set-buffer buffer)
    (or (or compilation-minor-mode (eq major-mode 'compilation-mode))
        (eq major-mode 'gud-mode))))

;;;  Have to fix up gud mode for perl
(require 'gud)

;;  Re-define gud-perldb-massage-args to handle variable perl flags
(defvar gud-perldb-interp-flags "-dw"
  "The flags to pass to the perl interpreter when running a debug session.")
(defun gud-perldb-massage-args (file args)
  (cons gud-perldb-interp-flags (cons (car args) (cons "-emacs" (cdr args)))))
;;(cons gud-perldb-interp-flags (cons (car args) (cons "" (cdr args)))))


;; Fix for perldb - make default reasonable and allow no-prompt option
(defun better-perldb (&optional arg)
  "Runs perldb with better handling of default command string.
With arg true, doesn't prompt for new command, uses last one."
  (interactive)
  (if (not (null arg))
      (perldb (car gud-perldb-history))
      (perldb (read-from-minibuffer
               "Run perldb (like this): "
               (if (and (consp gud-perldb-history)
                        (string-match
                         (concat "^ *[^ ]+ +" (buffer-file-name))
                         (car gud-perldb-history)))
                   (car gud-perldb-history)
                   (concat "perl " (buffer-file-name)))
               nil nil
               '(gud-perldb-history . 1)))))

;;  Add functions that do compilation error matching using compilation mode,
;;  then switch back when done.  (C-x` for next-error, C-xx to exit)
(defun perl-next-error ()
  "Moves to the next perl error from the last perldb run."
  (interactive)
  (next-error))
(defun perl-next-error-start ()
  "Moves to the next perl error from the last perldb run."
  (interactive)
  (compilation-minor-mode)
  (define-key (current-local-map) "\C-x`" 'perl-next-error)
  (define-key (current-local-map) "\C-xx" 'perl-next-error-end)
  (next-error))
(defun perl-next-error-end ()
  "Ends compilation mode for finding perl errors and returns to perldb mode."
  (interactive)
  (set-buffer (compilation-find-buffer))
  (compilation-minor-mode))
(defun perldb-compilation-preferences ()
  (define-key (current-local-map) "\C-x`" 'perl-next-error-start))
(add-hook 'perldb-mode-hook '(lambda () (perldb-compilation-preferences)))
;;(custom-set-faces '(default ((t (:background "sky blue"))) t))




reply via email to

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