--------------- -*- Mode: lisp -*- BW : Allows for small fonts --------------- Subject: Re: insert date and time Ken Stevens writes: > This is probably a very simple question... I want to be able to insert > date/time into files. Is there a function that already does this? (defun insert-time () (interactive "*") (insert (format-time-string "%T"))) (defun insert-date () (interactive "*") (insert (format-time-string "%D"))) "M-x apropos RET format-time-string RET C-x o M-3 C-n RET C-x o" for details on the time/date format. :) Have a look at the documentation for format-time-string to learn what else you can use instead of %x. *********** Subject: Re: How to remove the limitation of the .signature file? >>>>> "Kai" == Kai Großjohann writes: Kai> See the documentation for the variable message-syntax-checks. Kai> It appears you want to do this: Kai> (add-to-list 'message-syntax-checks '(signature . disabled)) Thank you very much, kai. -- ************ Subject: Formatting text after its typed? Michael Robbins wrote: > > Can I format already written text? Mark the region and press 'M-C-\'. *********** Subject: Re: About shell mode Veera Venkataramani writes: > If I do a less command in the shell mode, I get weird behaviour. I > get vaious messages like: > WARNING: terminal cannot clear to end of line You are running a program like 'more' or 'less' or maybe 'vi' which expects a real terminal or a terminal emulation. Shell mode, however, is not a terminal emulation. This will never be changed, since the very strength of shell mode is that it is not a terminal emulation: you can use normal Emacs editing commands to manipulate what's in the buffer. Use M-x term RET if you want a terminal emulation. kai -- ' ************ Subject: Re: About shell mode Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes: > You are running a program like 'more' or 'less' or maybe 'vi' which > expects a real terminal or a terminal emulation. Addendum: you may wish to set your $PAGER variable to 'cat' when running in a shell mode buffer. You lose nothing since you can scroll back using the Emacs keys, and you don't have those strange messages anymore. kai -- ************** Veera Venkataramani writes: > Is there any way of asking the shell to have only 1000 lines in its > memory? A *shell* buffer is a type of comint (command interaction) buffer. The comint-buffer-maximum-size is set to 1024, but by default XEmacs doesn't truncate *shell* buffers. To enable truncation in *shell* buffers, you want to add the following to your ~/.emacs file. (add-hook 'shell-mode-hook (lambda () (add-to-list 'comint-output-filter-functions 'comint-truncate-buffer))) -Mark Mark Thomas ************** Fernando writes: > Hi! > is there a way to have a list of most recently used files in > the File menu (a la Windows)? O:-) from xemacs-packages/lisp/edit-utils/recent-files.el: ;; Veera - this is most probably for emacs alone ;;; Enough of this boring stuff. To install recent-files, put the ;;; following statements into your .emacs file ;;; (load "recent-files") ;;; (recent-files-initialize) ************ (defun swap-buffers () "Swap top and bottom buffer in current frame" (interactive) (let ((this-buffer (current-buffer))) (other-window 1) (let ((that-buffer (current-buffer))) (switch-to-buffer this-buffer) (other-window 1) (switch-to-buffer that-buffer)))) ************ Might not work in XEmacs -- I'm not sure. This will give you auto-fill for all text-like modes. If you want message mode only, replace text-mode-hook with message-mode-hook in the above line. ************ From: Mark Thomas Subject: Re: About completions in shell mode Newsgroups: comp.emacs.xemacs Date: 09 Mar 2000 13:49:57 -0500 Organization: Justsystem Pittsburgh Research Center Path: news.jhu.edu!news.cs.jhu.edu!haven.umd.edu!128.8.10.23.MISMATCH!news.umd.edu!bloom-beacon.mit.edu!newsfeed.sgi.net!news.jprc.com!not-for-mail Lines: 31 Message-ID: References: NNTP-Posting-Host: ulysses.jprc.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Gnus/5.0803 (Gnus v5.8.3) XEmacs/21.2 (Iris) Xref: news.jhu.edu comp.emacs.xemacs:2098 Veera Venkataramani writes: > In shell mode, when I ask for completions with the TAB key, xemacs > opens a new window and displays them. The window does not disappear > after I complete the file name. To get rid of the *Completions* window, I need to press the space key BEFORE I press any other key EVERY time I use tab completion. If I forget to press space the first time the *Completion* window appears, it will not go away the next time I use completion and press space; but as long as I remember to press space each time, it goes away. The problem is I often want to be able to type a few characters to disambiguate the name, then get rid of the completions window. The following sort of does what I want. When I hit TAB, there is nothing to complete (i.e., completion returns nil), and a *Completions* buffer visible, the *Completions* buffer goes away. The downside of this is if the *Completions* buffer replaces a visible buffer, I do not get my original buffer back. This hack is not ideal, but it works well enough most of the time. (defadvice comint-dynamic-complete (after remove-completions-window activate) (if (and (not ad-return-value) (equal "*Completions*" (save-window-excursion (other-window 1) (buffer-name)))) (delete-window (get-buffer-window "*Completions*")))) -Mark --------------- (add-hook 'vm-mail-mode-hook 'turn-on-auto-fill) --------------- > For yes/no prompts like revert-buffer, can I have emacs accept > y/n instead of yes/no? This is something Kai Großjohann helped me with. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; I don't want to type "yes" or "no", just "y" or "n". ;; And while I'm at it, make a synonym for "y". (fset 'yes-or-no-p 'y-or-n-p) (define-key query-replace-map [(return)] 'act) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ---- Please note that the last line, "(define-key...", does more than you want. Years ago when I used a Mac, my fingers learned that means "yes". That line makes a synonym for "y" at the "y/n" prompt. If your fingers don't want to do that, just delete the line. Obligatory caveat: y-or-n-p is sort of less safe than yes-or-no-p, since the latter makes you stop and think, then deliberately type an answer. Substituting y-or-n-p makes it easier to accidentally OK Risky Things. --------------- > Does anyone know how to control how the backup files are saved. > If I edit a file named somefile.txt, a backup files is automatically > saved (somefile.txt~). > I want to either: > 1. turn this off I assure you you don't want to do this. > 2. Save this somewhere else Customize your bkup-backup-directory-info. I do it like this: (require 'backup-dir) (setq bkup-backup-directory-info (quote (("^" "~/.backup" ok-create)))) Now all backups are in the hidden directory .backup so I'm never bothered with them, but they're available when needed. You should look into the following menu : Options->Customize->Emacs->Files->Backup Everything you need is there ! =;-) --------------- From: kgold@watson.ibm.com (kgold) Subject: Re: syntax highlighting for c-mode Newsgroups: gnu.emacs.help Date: 3 Apr 2000 13:50:00 GMT Organization: IBM T.J. Watson Research Center Lines: 56 Message-ID: <8ca7i8$q9q$1@news.btv.ibm.com> References: <03d101bf9d2d$1586ace0$31c9a8c0@sachin> NNTP-Posting-Host: alpha.watson.ibm.com X-Trace: news.btv.ibm.com 954769800 26938 9.2.22.43 (3 Apr 2000 13:50:00 GMT) X-Complaints-To: news@btv.ibm.com NNTP-Posting-Date: 3 Apr 2000 13:50:00 GMT X-Newsreader: xrn 9.01 Originator: kgold@watson.ibm.com Path: news.jhu.edu!news.cs.jhu.edu!news4.his.com!news.lightlink.com!nntp-out.monmouth.com!newspeer.monmouth.com!bignews.mediaways.net!abq.news.ans.net!news-w.ans.net!news.chips.ibm.com!newsfeed.btv.ibm.com!news.btv.ibm.com!kgold Xref: news.jhu.edu gnu.emacs.help:3505 "Sachin Shenoy" writes: > Does anyone have emacs syntax highlighting for c-mode. > I wanted the default colour setting for the c-mode. cc-mode is shipped with emacs. Here's part of my .emacs. ; set the font lock colors (setq font-lock-face-attributes ;; FACE FG BG bold italic underline '((font-lock-comment-face "gold" nil nil nil nil) (font-lock-string-face "lightskyblue2" nil nil nil nil) (font-lock-reference-face "palegreen2" nil nil nil nil) (font-lock-constant-face "palegreen2" nil nil nil nil) (font-lock-variable-name-face "wheat" nil nil nil nil) (font-lock-function-name-face "yellow" nil nil nil 1) (font-lock-type-name-face "salmon" nil nil nil nil) (font-lock-doc-name-face "magenta" nil nil nil nil) (font-lock-keyword-face "pink" nil nil nil nil) (font-lock-type-face "lightsalmon" nil nil nil nil) (font-lock-builtin-face "palegreen2" nil nil nil nil) (font-lock-warning-face "red" nil nil nil nil) (show-paren-match-face "black" "green" nil nil nil) )) ; turn on font lock in all modes which support it (require 'font-lock) (global-font-lock-mode 1) (setq font-lock-support-mode 'lazy-lock-mode) ; do as much colorizing as possible (setq font-lock-maximum-decoration t) (require 'ctypes) (ctypes-auto-parse-mode 1) ; define some additional mode extensions (setq auto-mode-alist (append '( ("\\.[Hh]$" . c++-mode) ) auto-mode-alist)) ; c, c++, java mode (add-hook 'c-mode-common-hook (require 'paren) (show-paren-mode t) (ctypes-define-type "size_t" nil) (ctypes-define-type "time_t" nil) ))) -- Ken Goldman kgold@watson.ibm.com 914-784-7646 --------------- (setq default-frame-alist '((width . 80) (height . 60))) --------------- (set-specifier default-toolbar '( [toolbar-file-icon toolbar-open t "Open a file"] [toolbar-folder-icon toolbar-dired t "View directory"] [toolbar-disk-icon toolbar-save t "Save buffer"] [toolbar-printer-icon toolbar-print t "Print buffer"] ; [toolbar-cut-icon toolbar-cut t "Kill region"] ; [toolbar-copy-icon toolbar-copy t "Copy region"] ; [toolbar-paste-icon toolbar-paste t "Paste from clipboard"] [toolbar-undo-icon toolbar-undo t "Undo edit"] [toolbar-spell-icon toolbar-ispell t "Spellcheck"] ; [toolbar-replace-icon toolbar-replace t "Replace text"] [toolbar-mail-icon toolbar-mail t "Mail"] [toolbar-info-icon toolbar-info t "Information"] [toolbar-compile-icon toolbar-compile t "Compile"] [toolbar-debug-icon toolbar-debug t "Debug"] [toolbar-gnu-icon toolbar-gnus t "gnu"] )) --------------- If (setq vm-pop-expunge-after-retrieving nil) or (setq vm-imap-expunge-after-retrieving nil) VM indeed does not expunge the messages of the server. But VM does also retrieve the same messages every time when vm-get-new-mail is invoked. Other mail reader such as Netscape and Eudora only retrieve new messages of the mailbox to the VM INBOX. --------------- Niels L Ellegaard wrote: > I use xemacs at several different machines. At some of them zenirc > is available (require 'zenirc) > But really I would like it to say > (if zenirc-is-available > (require 'zenirc) > (read-the-rest-of-my-.emacs-anyway)) > Is this possible? Probably, but the easiest way is just to handle the error if it occurs: something like (condition-case nil (require 'zenirc) (t (message "zenirc is not available!"))) will allow further processing in either case. On 11 Apr 2000 15:55:31 +0200, Niels L Ellegaard wrote: Use 'locate-library'. For example: ,---- | (when (locate-library "zenirc") | (require 'zenirc)) '---- Niels L Ellegaard writes: It is, but instead I'd use autoload if I were you. I.e. (autoload zenirc-or-whatever-starts-zenirc "zenirc" nil t) This way doesn't cause any load-time speed penalty on those machines that don't have zenirc installed. Even on those machines that have, zenirc is not searched from load-path and loaded until you start it. --------------- Derek Fountain writes: > Is it possible to lock two buffers together somehow such > that when one scrolls the other scrolls too? I have two > binary files which are very similar, and I have them open > side by side in hexl mode. I'm trying to spot the > differences (amongst other pattern analysis techniques) and > I'd like the same section of each file in both windows all > the time. So, when I scroll one down a page, the other moves > down too. > > Is this possible? Answers, preferably, in words of one > syllable. I'm no xemacs expert - just a user! I like to do the same thing with text buffers. I will split the main window with C-x 2 and will scroll them together. I wrote a couple of lisp functions to do this and bound them to some keys. Here are the two functions (change the name of them if you want, dmi is my initials): (defun dmi-sync-scroll-up () "Scrolls current and other window up by one line" (interactive) (scroll-down 1) (scroll-other-window-down 1)) (defun dmi-sync-scroll-down () "Scrolls current and other window down by one line" (interactive) (scroll-up 1) (scroll-other-window 1)) ; bind keys to above functions (global-set-key [(control next)] 'dmi-sync-scroll-down) (global-set-key [(control prior)] 'dmi-sync-scroll-up) This way, I use Control-Page Up and Control-Page Down to scroll two buffers together. This does one line at a time. If you want to do pages at a time, you will have to modify the amount of scrolling given as the argument to the scroll-* commands. --------------- Use forms like the following to add to it: (add-to-list 'auto-mode-alist '("\\.prl\\'" . perl-mode)) kai --------------- (global-set-key 'M 'self-insert-command) (define-key shell-mode-map '\M 'self-insert-command) --------------- >Is there a list of the known -*-Mode: ...-*- modes? >e.g. -*-Shell-Script-*- When it sees -*-XXX-*-, it grabs the XXX, lowercases it, appends "-mode", and tries to call it. So if there's a foo-mode, you can use -*-Foo-*-. --------------- On Thu, 4 May 2000, oliveraustin@btinternet.com wrote: > I've written loads of O-O code and now I want to change some class and > feature names. please could you help and tell me how to search and replace > over about 40 seperate files. Is there a way to bulk load files into emacs > and then perform the search and replace operation over all the buffers? > thanks then. Oliver 1. Switch to "dired"-mode 2. mark the files you want to work on 3. type 'Q' (= dired-do-query-replace) 4. type in your replacements as regexps, 5. enjoy :-) Klaus # Also, You can run 'etags' on all the files, then use M-x tags-query-replace RET. Kai --------------- M-. find-tag M-* pop-tag-mark M-, tags-loop-continue C-x 4 . find-tag-other-window --------------- (defadvice find-tag (around refresh-etags activate) "Rerun etags and reload tags if tag not found and redo find-tag. If buffer is modified, ask about save before running etags." (let ((extension (file-name-extension (buffer-file-name)))) (condition-case err ad-do-it (error (and (buffer-modified-p) (not (ding)) (y-or-n-p "Buffer is modified, save it? ") (save-buffer)) (er-refresh-etags extension) ad-do-it)))) (defun er-refresh-etags (&optional extension) "Run etags on all peer files in current dir and reload them silently." (interactive) (shell-command (format "etags *.%s" (or extension "el"))) (let ((tags-revert-without-query t)) ; don't query, revert silently (visit-tags-table default-directory))) ;; Veera - the last line was (visit-tags-table default-directory ;; nil))). I changed it. ---------------------- C-c ! a Footnote-add-footnote C-c ! b Footnote-back-to-message C-c ! c Footnote-cycle-style C-c ! d Footnote-delete-footnote C-c ! g Footnote-goto-footnote C-c ! r Footnote-renumber-footnotes C-c ! s Footnote-set-style --------------- Sh-tab runs 'tab-to-tab-stop' --------------- Veera Venkataramani wrote: > When I open a new file with the .prl extension, I want Xemacs to > automatically add x rights to the file. > (ie. chmod u+x ) > Is this possible? To quote David Carlisle, "The answer to 'can emacs?' is always yes." I do it like this: (add-hook 'cperl-mode-hook (function (lambda () ;; [...] Lots of keybindings too personal to reveal here... ;; prepare new files for a useful life (if (= (point-min) (point-max)) (progn ;; insert boilerplate (insert-string (concat "#!/opt/bin/perl -w\n" "# " (buffer-file-name) "\n\n")) (goto-char (point-max)) ;; make executable (save-buffer) (shell-command (format "chmod u+x %s" (buffer-file-name))) ))))) This is the inelegant, system-dependent solution, but on Solaris it works. --------------- (setq c-auto-newline nil) (setq cperl-auto-newline nil) ALSO NOTE, C-c C-a runs 'c-toggle-auto-state' 'c-toggle-auto-state' is an interactive compiled Lisp function -- loaded from "cc-cmds.elc" (c-toggle-auto-state ARG) Toggle auto-newline feature. Optional numeric ARG, if supplied turns on auto-newline when positive, turns it off when negative, and just toggles it when zero. When the auto-newline feature is enabled (as evidenced by the '/a' or '/ah' on the modeline after the mode name) newlines are automatically inserted after special characters such as brace, comma, semi-colon, and colon. --------------- > repeat my last n actions Recent Emacsen have 'C-x z' which repeats the last command. If the variable repeat-on-final-keystroke is non-nil (the default), you can type 'z' to repeat more often, ie 'C-x z z z' would repeat three times. The command 'C-x ESC ESC' is available on all Emacsen, not just the recent ones. It allows you to edit and repeat the last 'complex' command. (You'll quickly learn which commands are complex.) If you want to repeat several actions, use a kbd macro. Type 'C-x (' to start recording a kbd macro, then do whatever you want, then type 'C-x )' to finish recording the kbd macro. Then, type 'C-u 4 2 C-x e' to execute the kbd macro 42 times. For example, if you want to append 'foo' to a number of lines, you could type the following: C-x ( start recording C-e foo go to end of line and insert foo there C-n go to next line C-x ) end recording The C-n is important, else you would keep appending 'foo' to the current line :-) Also You can also use 'repeat-complex-command', normally bound to 'C-x M-ESC'. --------------- defining-kbd-macro name-last-kbd-macro (then in kbd-macros.el,) insert-kbd-macro (global-set-key and then save) --------------- Double click with mouse-1 at a paren selects the whole parenthesized text. C-x C-x shall bring you to the opposite bound of the region. In some modes M-a (resp. M-e) could be useful. --------------- > Emacs automatically sets the mark when using some commands, such as > M-< (for beginning-of-buffer). Emacs keeps a stack of these marks. > You can pop items off the stack using C-u C-SPC. --------------- how do you view binary files in emacs > Try: M-x hexl-mode --------------- i a insert-anniversary-diary-entry i b insert-block-diary-entry i c insert-cyclic-diary-entry i d insert-diary-entry i h << Prefix Command >> i i << Prefix Command >> i m insert-monthly-diary-entry i w insert-weekly-diary-entry i y insert-yearly-diary-entry --------------- ;; set the sizes of windows to equal sizes. This WAS cool. not anymore ;; (global-set-key "\M-b" 'balance-windows) --------------- To get the major mode of a buffer M-: major-mode RET --------------- Can't open /opt/GKispell/lib/english.hash itimer "display-time" signaled: (error "Window height 3 too small (after splitting)") --------------- copy x-copy-primary-selection cut x-kill-primary-selection paste x-yank-clipboard-selection --------------- I think this is because you only had one space after the end of the period, so Emacs assumed it was part of a word, like 'Mrs. Foo'. To make Emacs always assume that sentences are ended with a single space, you could try adding (setq sentence-end-double-space nil) to your ~/.emacs file. --------------- If you want to "see" your rectangle, use M-button1 to highlight your rectangle. Then C-x r k (for "R"ectangle "K"ill). You can retrieve the rectangle in another location w/ C-x r y (for "R"ectangle "Y"ank). Copy a rectangle to a register: C-x r r ? (where ? is a register; i.e. any keypress will work). Retrieve a register rectangle : C-x r i ? (where ? is the same register). If you don't need to "see" your rectangle, just set the mark at one of the corners, move the point to the other corner and use the same key bindings. For further info : C-h i 2 C-s Rectangles RET RET. Have fun, C-x r r copy-rectangle-to-register C-x r s copy-to-register C-x r i insert-register C-x r k kill-rectangle C-x r y yank-rectangle --------------- >> How can i print code efficiently, like two or four pages on one, >> if you know what I mean? Klaus> Go to http://www.cpqd.com.br/~vinicius/emacs/Emacs.html, download Klaus> ps-print.tar.gz and printing.el.gz, install it (read README in the tar and the Klaus> comments in printing.el) and be happy with printing with Emacs!! --------------- > Can someone tell me how to do this, importing MS Word docs? Thanks. [robin@radioactive robin]$ grep word /etc/mailcap application/msword; mswordview %s && (netscape -remote 'openURL('%s.html')' >/dev/null 2>&1 || netscape %s.html) --------------- M-x viper-go-away --------------- 'overriding-local-map' is a simple built-in variable. Value: nil Documentation: Keymap that overrides all other local keymaps. If this variable is non-nil, it is used as a keymap instead of the buffer's local map, and the minor mode keymaps and extent-local keymaps. You should *bind* this, not set it. --------------- The trick is that you should tell vm a little more carefully how it should handle MIME-messages for your. The following should do what you want: (setq vm-auto-displayed-mime-content-type-exceptions '("text/html")) (setq vm-mime-external-content-types-alist '(("text/html" "netscape"))) The first two lines ask vm to only display the part of your mail that is in HTML when you explicitly ask for it. The last two lines tell it to use netscape for viewing such messages. If your satisfied with w3 for occasionally viewing messages you can leave out these lines. While you are at it, you might like to give it more information about possible MIME-types. For inspiration, I have the following in my .vm: (setq vm-auto-displayed-mime-content-type-exceptions '("application" "text/html")) ; don't display letters sent as HTML ;; List of applications to be used to display mime messages (setq vm-mime-external-content-types-alist '(("text/html" "netscape") ("image/gif" "xv") ("image/jpeg" "xv") ("application/postscript" "ghostview") ("application/x-dvi" "xdvi") ("application/pdf" "acroread") ("application/msword" "soffice"))) The last part tells it vm what applications it should use for viewing different kinds of attachments (basicly the same information as in your ~/.mime.types). The first one prevents vm from, say, starting Acrobat Reader when I get a message with a pdf-file attached. Best regards Peter --------------- To get rid off: jay> ls Adirectory Afile AnotherDirectory AnotherFile jay> : You (or your systemadministrator) have probably aliased ls to 'ls --color' or such so that it shows your files in color according to type. Two solutions 1) unalias ls 2) use ansi-term instead of shell --------------- For the newsgroups: - C-x C-w with the same permissions. - unset insert key --------------- Subject: Re: Child frames forget color Yaroslav Bulatov writes: > My .emacs file has (set-background-color "ivory") The problem is > that when I spawn child frames, their color is default -- > white. Does anybody know of a hook or some other device to use to > get child frames to remember the color? Does (add-to-list 'default-frame-alist '(background-color . "ivory")) --------------- Subject: Re: auto insert myFunction result in all new buffers Well, it appears that autoinsert.el (or was it auto-insert.el?) is your friend. It allows you to specify things to be inserted based on some condition. You can specify a file name, then it will insert the file contents. For example: (require 'autoinsert) (add-to-list 'auto-insert-alist '("\\.h\\'" . "/templates/c-header-file")) (add-to-list 'auto-insert-alist '("\\.c\\'" . "/templates/c-code-file")) The above are based on the file name, you can also specify a condition for the major mode, instead: (add-to-list 'auto-insert-alist '(java-mode . "/templates/java-mode")) Simple, huh? I think that you were afraid that ready-made packages are hard to use. But if you still don't want to use a ready-made package for this, you might do something along these lines: (defun my-setup-java-file (when (zerop (buffer-size)) (insert "/** This is a Java template. */\n"))) (add-hook 'java-mode-hook 'my-setup-java-file) Or: (defun my-setup-pascal-file (when (zerop (buffer-size)) (insert-file-contents "/templates/pascal"))) (add-hook 'pascal-mode-hook 'my-setup-pascal-file) Also simple. --------------- Rainer.Hubovsky@ci.tuwien.ac.at wrote: > i started to use vm a few days ago and wonder if there is something > like a trash folder in which all deleted messages go until you > ultimately delete them. I wrote this a couple of years ago for someone else, but I've never used it myself: (defvar vm-deleted-message-folder nil "*If non-nil, the folder to which deleted messages are automatically saved.") (put 'vm-deleted-message-folder 'variable-interactive "FDeleted message folder: ") ; vm-folder-directory? (defadvice vm-delete-message (before vm-deleted-message-folder activate) "Save each message to vm-deleted-message-folder (if non-nil) before actually deleting it." (if vm-deleted-message-folder (progn (vm-select-folder-buffer) (vm-check-for-killed-summary) (vm-error-if-folder-read-only) (vm-error-if-folder-empty) (if (not (equal buffer-file-name (expand-file-name vm-deleted-message-folder vm-folder-directory)))) (let ((vm-last-save-folder vm-last-save-folder)) ; avoid side effects (vm-save-message vm-deleted-message-folder (ad-get-arg 0)))))) --------------- Subject: Re: search thru line breaking On 22 Aug 2000, Xavier Decoret wrote: > Hum. The way to incrementalise this may be to change the space key > in isearch-mode-map so that it insert a \W (or rather a '\S ') > instead. You can use C-u C-s (regexp isearch) for this. When you hit SPC in that mode, it uses "[ \t]+" by default, but this can be changed via the variable search-whitespace-regexp. I use this: (setq search-whitespace-regexp "[ \t\r\n]+") Kai --------------- > im writing some formal letters, and I'd like to do it with emacs. I > need to be able to adjust printing fonts, text size, etc. Is that > possible? Also, is there some way to do footnotes in emacs? But simple things can be done with M-x enriched-mode RET. Use M-x ps-print-buffer-with-faces RET for printing if you have a Postscript printer (or GhostScript). I recall a file footnote.el. Can you find a pointer at http://www.anc.ed.ac.uk/~stephen/emacs/ell.html? --------------- C-x n n runs 'narrow-to-region' 'narrow-to-region' is an interactive compiled Lisp function (narrow-to-region B E) Documentation: Restrict editing in this buffer to the current region. The rest of the text becomes temporarily invisible and untouchable but is not deleted; if you save the buffer in a file, the invisible text is included in the file. C-x n w makes all visible again. See also 'save-restriction'. When calling from a program, pass two arguments; positions (integers or markers) bounding the text that should remain visible. --------------- There is a package longlines.el (by yours truly) which might do some of what you want. When it reads a file, it inserts soft newlines to fill the paragraphs, and when the file is written, it removes the soft newlines again. Commands such as M-q insert soft newlines, commands such as RET insert hard newlines. ftp://ls6-ftp.cs.uni-dortmund.de/pub/src/emacs/ With this, you still have to type M-q when the lines in the buffer become too long or too short. If you don't want to do that, you might wish to investigate maniac.el or refill.el. These hit M-q for you. Of course, there is still the issue of the EOL conventions used, but that can be gotten around with by hitting C-x RET f to set the coding system to undecided-dos. Subsequent saves of the buffer will be with DOS line-endings. kai --------------- (From Kai) > 4) I want to be able to edit a huge files. If file is too big it > simply doesn't show the line number of the font highlighting. (setq font-lock-maximum-size 42) The above line means files larger than 42 characters (!) will have font-lock turned off. (setq line-number-display-limit 4711) The above line means don't display line numbers for files larger than 4711 characters. --------------- http://www.zanshin.com/~bobg/unscroll.html --------------- > How do I tell emacs to do away with the ^M in my scripts? Or am I > missing something here? Put this in your .emacs: (defun dos2unix () "convert a buffer from dos 2 unix" (interactive) (let ((deactivate-mark-before deactivate-mark)) (save-excursion (goto-char (point-min)) (while (search-forward "\r" nil t) (replace-match ""))) (setq deactivate-mark deactivate-mark-before))) Then try M-x dos2unix RET. --------------- > > how can I have multiple info-browsers running in one (X)Emacs > > instance? > > .. In the same way to running multiple shells; > start info (M-x info), then rename the buffer, > (M-x rename-buffer ), and run info again. --------------- "jade" writes: > Hi everybody, > > How do I run emacs and xemacs in the same machin given that they try > to use the same > .emacs file? I put the following in my .emacs file ... (if (string-match "XEmacs\\|Lucid" emacs-version) (load file "~/.xemacs") ;; Put all gnu emacs stuff here ... ;; We need this to end the conditional at the top ) --------------- > > Hi > > I would like to know the init file configuration line to configure 1 > line scroll down when I go off the screen limits, instead of half screen > page down > > tks > > -- > Pedro Miguel Gameiro Alves add the following to your .emacs: (setq scroll-conservatively 1) (setq scroll-step 1) -Tony --------------- 21.2. What do I do to start the gnuserv server so that each subseqeuent XEmacs is a client? Put the following in your .emacs file to start the server: (gnuserv-start) Start your first XEmacs as usual. After that, you can do gnuclient randomfilename from the command line to get your existing XEmacs process to open a new frame and visit randomfilename in that window. When you're done editing randomfilename, hit C-x # to kill the buffer and get rid of the frame. > gnuclient -nw -f func runs the frames with the DISPLAY var unset (NoWindow) and executes the lisp function func on startup --------------- The documentation for the function 'set-default-file-modes' is misleading: it does not mention that newly created files are opened with a permission mask of 0666, so the executable bit can't be set on new files. I also suggest mentioning that the elisp reader can be used to convert values from octal into decimal, with an example such as (set-default-file-modes ?\644) resulting in the same permissions as the unix command 'chmod 644'. -- Eric Marsden --------------- vm-mime-reader-map-display-using-default vm-mime-reader-map-display-using-external-viewer vm-mime-reader-map-pipe-to-command vm-mime-reader-map-pipe-to-printer vm-mime-reader-map-save-file --------------- - Sh-insert and C-m does not follow PD. I want it to. Assuming that your C-m does what my C-m does, here's the answer: (put 'newline 'pending-delete t) (put 'yank-clipboard-selection 'pending-delete t) --------------- - Is a keyboard-quit possible after C-q? No. But BS doenst have code to be inserted, so ... --------------- - What function does pretty print? ps-print-buffer-with-faces --------------- - For Xemacs 21.1, the paren matching shows what FOLLOWS the matched paren; should be whats before! (setq paren-backwards-message 1) --------------- > 1) How do I get vm to open a specific mail folder from the command > prompt? I've tried: > > xemacs -f vm-visit-folder "~/mail/myfolder" > > It doesn't work, nor does anything else I've tried. The "-f" switch calls the specified function without arguments. Try using: xemacs -eval '(vm-visit-folder "~/mail/myfolder")' --------------- Try this to avoid .emacs altogether: xemacs -q --load ~/.xemacs --------------- Gary Benson wrote: > I'd like to be able to set a different default font for _some_ text-mode > files. Basically, I still want courier for almost everything but I'd > like to use a proportional font to edit certain text files. I don't mind > having a -*- GaryText -*- in the top of the files. > > The only way I can see to do it is to set the default face, but this > affects all buffers; I don't want to have to keep switching. Faces are defined using specifiers, which allow different settings for different "locales" (buffers, windows, frames or devices). E.g. (set-face-font 'default "-*-helvetica-medium-r-*-*-*-140-*-*-*-*-iso8859-*" (current-buffer)) -- Glynn Clements --------------- Matthias Wiehl writes: Hello, > In psgml-html.el, there is a variable called sgml-html-menu which > contains menu entries and associated function names for viewing HTML > documents in various browsers. This menu may of course be expanded to > suit your needs; you'll just have to write some functions that launch > whatever browsers you want to be able to launch. Looking at how the > pre-defined functions do that should get you started. that sounds very good. > Let me know if I can help you out writing your own functions. You could, maybe? I looked up psgml-html.el and found for example: ,---- | ["View in Netscape" sgml-html-netscape-file | (buffer-file-name | (current-buffer))] | | [...] | | (defun sgml-html-netscape-file () | "Preview the file for the current buffer in Netscape." | (interactive) | (highlight-headers-follow-url-netscape | (concat "file:" (buffer-file-name (current-buffer))))) '---- This seemed to be the right one, so I started a new one like this: ,---- | ["View in Mozilla" sgml-html-mozilla-file | (buffer-file-name | (current-buffer))] | | [...] | | (defun sgml-html-mozilla-file () | "Preview the file for the current buffer in Mozilla." | (interactive) | (highlight-headers-follow-url-mozilla | (concat "file:" (buffer-file-name (current-buffer))))) '---- Everything OK so far? When I try to byte-compile this, I get the following Compile.log: ,---- | Compiling buffer psgml-html.el at Thu Mar 29 17:45:38 2001 | ** assignment to free variable font-lock-no-comments | While compiling html-helper-install-type: | ** variable menu-string bound but not referenced | While compiling the end of the data: | ** The following functions are not known to be defined: | hilit-set-mode-patterns, highlight-headers-follow-url-mozilla '---- | The other ones seem to be none of my business, since there are also there, when I byte-compile the original psgml-html.el. But the highlight-headers-follow-url-mozilla is a Problem for me. I didn't find highlight-headers-follow-url-netscape, so I didn't know how to write and where to put highlight-headers-follow-url-mozilla. I'am quite new to this XEmacs and Lisp kind of stuff, so excuse me, if it's a silly question, but where do I have to look for it? Thanks a lot, Henrik --------------- M-# q formula quick-calc --------------- Alex Schroeder wrote: > Here is how I would search such a thing: > > M-x apropos -- see if there is an appropriate function or variable > loaded. > > C-h p -- check wether there is an appropriate package to load. There are more commands in Emacs that can help find the required information efficiently, before you go to the net for help. Here's the procedure I recommend for finding an arbitrary issue (let's call it TOPIC) in the docs available locally on your machine: C-h a TOPIC RET -- looks for commands whose names match TOPIC C-h i d m Emacs RET i TOPIC RET -- searches the manual indices for TOPIC C-h i d m Emacs RET s TOPIC RET -- searches the manual text for TOPIC M-x apropos-documentation TOPIC RET -- searches doc strings for TOPIC C-h F -- brings up the Emacs FAQ, where you can search with 'i TOPIC' or with 's TOPIC', since the FAQ is also an Info manual. --------------- http://cscope.sourceforge.net/ http://ee.usyd.edu.au/~thlai/xcscope.tar.gz --------------- (require 'cl) (defun totd () "Describe a random command." (interactive) (with-output-to-temp-buffer "*Tip of the day*" (princ (concat "Your tip for the day is:\n========================\n\n" (describe-function (let ((commands (loop for s across obarray when (commandp s) collect s))) (nth (random (length commands)) commands))))))) ---------------(Contd) * Albert REINER : > Unfortunately this does not seem to be a good "tip of the day": whenever I > startup a new emacs, I get the same sequence of commands. That's because you need to tell random to use a new seed: ,----[ From the elisp manual entry for 'random' ] | In Emacs, pseudo-random numbers are generated from a "seed" number. | Starting from any given seed, the 'random' function always generates | the same sequence of numbers. Emacs always starts with the same seed | value, so the sequence of values of 'random' is actually the same in | each Emacs run! For example, in one operating system, the first call | to '(random)' after you start Emacs always returns -1457731, and the | second one always returns -7692030. This repeatability is helpful for | debugging. '---- > Also, it would be nice to have the output go to, e.g., the > *scratch*-buffer upon startup, rather than creating an extra buffer. It should be easy enough for you to modify it for your own purposes. As an aside, Aaron Crane was kind enough to point out that looping over obarray in the way I was wasn't going to work too well. Given this the code is probably better written (actually it's probably better totally re-written, perhaps at some point...) as: -- cut here ---------------------------------------------------------------- (defun totd () (interactive) (with-output-to-temp-buffer "*Tip of the day*" (let* ((commands (loop for s being the symbols when (commandp s) collect s)) (command (nth (random (length commands)) commands))) (princ (concat "Your tip for the day is:\n========================\n\n" (describe-function command) "\n\nInvoke with:\n\n" (with-temp-buffer (where-is command t) (buffer-string))))))) -- cut here ---------------------------------------------------------------- --------------- On Fri, 20 Apr 2001, esko@milkbar.powersurfr.com wrote: > my $text = "Here is some text. This is the first line " . > . "And this is the second line"; Emacs doesn't know what you want. But you can tell it: my $text = ( "first line " . "second line" ); kai --------------- C-M-l runs 'switch-to-other-buffer' --------------- You're both missing the reference. The big hint would should be "swapping". Back in the old days, when timeshared computers swapped whole applications in and out of main memory, 8 megabytes was a HUGE amount of RAM. We had one box with 2M that supported up to 35 users concurrently logged in without breaking a sweat. If you had 35 users using "vi", which ran in 128k, the system was usable. Once we got EMACS users it became intolerable... not only was it huge, but it was mostly interpreted code that ran in the DATA segment and couldn't be shared... and even on the replacement box with 8M the system was constantly running out of memory and having to toss user jobs back to disk. Hence, EMACS. Eight Megabytes And Constantly Swapping! --------------- 'view-goto-percent' is an interactive compiled Lisp function -- loaded from "view-less" (view-goto-percent &optional PERCENT) Documentation: Set mark and go to a position PERCENT way into the current buffer. --------------- M-% M-C-% --------------- >I'd like to automatically go into Perl mode on files that don't have a ".pl" >suffix. Is there someway to have emacs detect the "#!/usr/local/bin/perl" >at the top of the file? add ''("perl" . cperl-mode)'' to interpreter-mode-alist, e.g., (setq interpreter-mode-alist (cons '("perl" . cperl-mode) interpreter-mode-alist)) (replace cperl-mode with the major mode you use for perl editing.) -- okay, have a sig then --------------- Roy Dragseth wrote: > No, I'd rather not do any changes to the text in the buffer. I just > want to change how the text is displayed. In that case could try Kai Großjohann's longlines.el: ftp://ls6-ftp.cs.uni-dortmund.de/pub/src/emacs/longlines.el --------------- C-h w runs the command where-is C-h c runs the command describe-key-briefly --------------- (setq visible-bell t) --------------- Bora Eryilmaz : > I am sure many people asked this question before. But how do I > interchange the functions of Caps Lock and Ctrl keys in emacs? The man page for xmodmap shows how to do this. Henrik Veera - search for "caps" ! ! Swap Caps_Lock and Control_L ! remove Lock = Caps_Lock remove Control = Control_L keysym Control_L = Caps_Lock keysym Caps_Lock = Control_L add Lock = Caps_Lock add Control = Control_L If xmodmap is not automatically called when you restart your system, Bora Eryilmaz --------------- reklar@devnull.freenet.nether.net wrote: > > Is there a way of counting the number of changes that you have > made to a document and then jump to a particular undo number? > > It would be nice if there were a counter (in the modeline possibly) to see > how many changes have been made to a file since the last time it was > saved for instance. Of course you can do multiple undo's until you reach > the very beginning of the changes you have made but if there are a lot > of them that gets rather tedious. And you can give undo an argument to > tell it to do a particular number of them I suppose...but is there a > counter so you'll know how many to do? Is (length buffer-undo-list) what you want? As for ''jump to a particular undo number'', I'm not sure I understand what you want. If you mean to undo N last changes, you can pass an argument to the undo primitives to do that. But I don't think you can undo changes not in the order they were made. Eli See Harley Gorrell's undo-group.el, archived at: http://www.anc.ed.ac.uk/~stephen/emacs/ell.html It is not really an undo-browser, but provides a transaction-oriented undo mechanism. -Jonathan --------------- 'case-fold-search' Documentation: *Non-nil if searches should ignore case. Automatically becomes buffer-local when set in any fashion. (setq case-fold-search nil) (setq case-fold-search 1) --------------- M-y runs 'yank-pop' Replace just-yanked stretch of killed text with a different stretch. This command is allowed only immediately after a 'yank' or a 'yank-pop'. At such a time, the region contains a stretch of reinserted previously-killed text. 'yank-pop' deletes that text and inserts in its place a different stretch of killed text. --------------- (define-key mail-mode-map "s" 'self-insert-command) --------------- repeat-complex-command --------------- or, if you want to begin editing a file on line 1200 you can use ''xemacs +1200 file'' or ''gnuclient +1200 file'' (if gnuserv is running). --------------- customize-option --------------- ;; If non-nil automaticly insert/remove include files in c++ files (defvar c++-auto-include-add t) (defvar c++-auto-include-remove nil) --------------- (if (file-exists-p "~/.emacs-d-personal") (load-file "~/.emacs-d-personal")) --------------- ;; define a personal key-map. for now it is on C-z (defvar kof:keymap (make-sparse-keymap) "Keymap for all personal key bindings") (define-key global-map "\C-z" kof:keymap) (define-key kof:keymap "2" 'make-frame) (define-key kof:keymap "O" 'kof:toggle-read-only) (define-key kof:keymap "R" 'revert-buffer) (define-key kof:keymap "\C-a" 'iso-accents-mode) (define-key kof:keymap "\C-b" 'kof:point-to-bottom) (define-key kof:keymap "\C-c" 'compare-windows) (define-key kof:keymap "\C-f" 're-search-forward) (define-key kof:keymap "\C-k" 'compile) (define-key kof:keymap "\C-l" 'kof:find-file-from-list) (define-key kof:keymap "\C-q" 'query-replace-regexp) (define-key kof:keymap "\C-r" 'replace-regexp) (define-key kof:keymap "\C-t" 'kof:point-to-top) (define-key kof:keymap "\C-w" 'kof:webster-define-current-word) (define-key kof:keymap "\C-s" 'suspend-emacs) (define-key kof:keymap "b" 're-search-backward) (define-key kof:keymap "c" 'comment-region) (define-key kof:keymap "d" 'ediff-buffers) (define-key kof:keymap "f" 'igrep-find) (define-key kof:keymap "g" 'igrep) (define-key kof:keymap "h" 'hexl-mode) (define-key kof:keymap "k" 'delete-frame) (define-key kof:keymap "l" 'list-matching-lines) ; "occur" (define-key kof:keymap "o" 'kof:other-frame) (define-key kof:keymap "q" 'query-replace) (define-key kof:keymap "r" 'replace-string) (define-key kof:keymap "t" 'kof:toggle-case-fold-search) (define-key kof:keymap "<" 'isearch-backward-regexp) (define-key kof:keymap ">" 'isearch-forward-regexp) --------------- ;; Non-nil means query-replace should preserve case in replacements (setq case-replace t) --------------- ;; Non-nil means try to flash the frame to represent a bell. (setq visible-bell t) --------------- ;; The number of lines to try scrolling a window by when point moves out. ;; If that fails to bring point back on frame, point is centered instead. ;; If this is zero, point is always centered after it moves off frame. (setq scroll-step 5) ;; The number of columns to try scrolling a window by when point moves out. ;; If that fails to bring point back on frame, point is centered instead. ;; If this is zero, point is always centered after it moves off frame. (setq hscroll-step 20) --------------- > I found getting both up > and runnign from the same file was a nightmare mostly because of the > differences in setting up faces and control keys. I gave up on Xemacs I set faces with customize and it works fine (the only thing I use customize for). As for the syntax of keys, just use things like (define-key map [(control ?c) (control ?r)] 'foo) (define-key map [(meta down)] 'bar) (define-key map [(meta control mouse-2)] 'baz) that should work for both varieties of emacs as well. (note that, this is the XEmacs syntax (supported by Emacs) except for 'mouse-2' which is the Emacs name but is also supported by XEmacs. AFAIK XEmacs does not support the Emacs syntax [M-down] nor does Emacs understand the XEmacs name 'button2') --------------- Then put this in .emacs: ;;; ---------- both ----------------- (defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version) (cond ((not running-xemacs) ;;; -------- begin of Emacs section ---------------- (load-file "~/.gnuemacs.el") ;; the custom file for Emacs ) ; end of Emacs section (running-xemacs ;;; -------------- begin of XEmacs section ------------- (load-file "~/.xemacs.el") ;; the custom file for XEmacs )) ; end of XEmacs section --------------- Hello, I am using gnuserv for two somewhat different purposes: First, I use GNU Emacs as the general EDITOR=gnuclient. Second, I use it in connection with muttzilla; clicking on "mailto:" URLs in Netscape launches VM. In the first case, I definitely want the new buffer in a new frame, as only then does it land on my current "virtual desktop" (blackbox). Thus I set gnuserv-frame to nil in my .emacs. In the other case, what happens is I call gnuclient -eval '(prog(vm-mail [blah]) (save-excursion))' On 2 Jun 2001, David Thor Bragason wrote: > In the first case, I definitely want the new buffer in a new frame, > as only then does it land on my current "virtual desktop" > (blackbox). Thus I set gnuserv-frame to nil in my .emacs. Maybe you can use a shell script which does gnudoit '(find-file-other-frame "%s")' where %s is the file name. Hm. Lessee... #!/bin/sh gnudoit \(find-file-other-frame\ \"$1\"\) This might actually do the trick, but it's untested. kai gnudoit \(find-file-other-frame\ \""$1"\"\) would probably better (if it's correct) in case the file name has spaces... Stefan --------------- * cperl-invalid-face - The result of evaluation of this expression highlights trailing whitespace. --------------- ;; Tell cc-mode not to check for old-style (K&R) function declarations. ;; This speeds up indenting a lot. (setq c-recognize-knr-p nil) --------------- Opening multiple files 1 - M-: (gnuserv-start) RET M-! gnuclient -q *.cxx RET 2 - Sean, you can do this via dired: C-x d runs the command dired % m runs the command dired-mark-files-regexp F runs the command dired-do-find-file To unmark all files use: M-DEL runs the command dired-unmark-all-files 3 - Or a third way, M-: (require 'complete) C-x C-f ~/prog/project/*.cxx ;;; complete.el --- partial completion mechanism plus other goodies ;; Author: Dave Gillespie Veera - couldnt find the third package --------------- > Hi there, > > How can i bind the key Control-d to inserting the output > of "/usr/bin/date" into the current buffer? > > thanx > > Armin I have this on my .emacs (defun insert-time () (interactive) (require 'thingatpt) (save-excursion (if (thing-at-point-looking-at "[0-9][0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9]") (delete-region (match-beginning 0)(match-end 0))) (insert (format-time-string "%d/%m/%Y")))) (global-set-key [f10] 'insert-time) You can change the definition of format-time-string (and the regexp) to suit your needs The format-time-string syntax is mostly the same as the 'date' command. %Y is the year, %y within the century, %C the century. %G is the year corresponding to the ISO week, %g within the century. %m is the numeric month. %b and %h are the locale's abbreviated month name, %B the full name. %d is the day of the month, zero-padded, %e is blank-padded. %u is the numeric day of week from 1 (Monday) to 7, %w from 0 (Sunday) to 6. %a is the locale's abbreviated name of the day of week, %A the full name. %U is the week number starting on Sunday, %W starting on Monday, %V according to ISO 8601. %j is the day of the year. %H is the hour on a 24-hour clock, %I is on a 12-hour clock, %k is like %H only blank-padded, %l is like %I blank-padded. %p is the locale's equivalent of either AM or PM. %M is the minute. %S is the second. %Z is the time zone name, %z is the numeric form. %s is the number of seconds since 1970-01-01 00:00:00 +0000. %c is the locale's date and time format. %x is the locale's "preferred" date format. %D is like "%m/%d/%y". %R is like "%H:%M", %T is like "%H:%M:%S", %r is like "%I:%M:%S %p". %X is the locale's "preferred" time format. -jp --------------- > Hi, > Can anyone please tell me how I can customize what happens when I > double-click over a word in Emacs? > > That is, currently, if there is a variable called foo_bar and I > double-click on the foo part, then emacs selects foo only. I would like it > to select the entire string (i.e. "foo_bar") > > Thanks, > Andrew Sendonaris This depend on what mode you're in. Emacs uses different syntax tables for different modes. The mode you're using doesn't consider '_' to be part of a word. Seeing how this is Emacs, this can of course be fixed. Add something like the following to the hook of your mode. (modify-syntax-entry ?_ "w") Henrik --------------- repeat-complex-command is on again, redo, C-x M-escape, C-x M-:, C-x M-C-[ --------------- pop-global-mark is on C-x C-@, C-x C-space, C-x C- --------------- ;; Start the Xemacs server; the coolest thing since PinkFloyd! ;; > gnuclient -nw -f func ;; runs the frame with the DISPLAY var unset (NoWindow) and executes the ;; lisp function func on startup ;; (gnuserv-start) ;; (gnuserv-shutdown) ;; Start server manually after Xemacs startup; otw, you can ;; inadvertanly kill all the clients (server and Xemacs still run ;; though!) when you re-load .emacs ;; More instabilities from gnuserv ;; If you have an improperly killed xemacs (eg. from logging out and ;; then logging in with a saved setup), then the new xemacs that you ;; start will not be able to start the gnuserver. --------------- vze2368u@REMOVEMEverizon.net writes: > I have some queries about using gnuclient in a terminal window. When > lines wrap around Xemacs adds a "\" at the end of the line; this is a > pain when I want highlight text with the mouse. Do you how to get rid > of the "\"? I think one has to customize the continuation-glyph but my lisp is not good enough for that. Perhaps someone else on this group can help. > Also, do you how to resize buffers inside a window. Xemacs by default > makes it 50-50%. How do I make it say 75-25, or 66-33? C-x 2 takes an optional numerical prefix: 'split-window-vertically' is an interactive compiled Lisp function -- loaded from "/usr/local/src/xemacs-21.4/lisp/window.elc" (split-window-vertically &optional ARG) Documentation: Split current window into two windows, one above the other. The uppermost window gets ARG lines and the other gets the rest. Negative arg means select the size of the lowermost window instead. With no argument, split equally or close to it. Both windows display the same buffer now current. I've used this for a while. It accepts a percentage argument instead of lines: (defun nk/split-window (&optional percentage) "Splits the current window assigning PERCENTAGE percent to the selected window." (interactive "P") (if percentage (split-window (selected-window) (round (* (/ percentage 100.0) (count-lines (point-min) (point-max))))) (split-window-vertically))) (global-set-key "\C-x2" 'nk/split-window) HTH. Veera: A better solution is M-x enlarge-window --------------- ;; Change the continuation glyph face so it stands out more (and (fboundp 'set-glyph-property) (boundp 'continuation-glyph) (set-glyph-property continuation-glyph 'face ' facemenu-set-invisible)) --------------- C-c ! a Footnote-add-footnote C-c ! b Footnote-back-to-message C-c ! c Footnote-cycle-style C-c ! d Footnote-delete-footnote C-c ! g Footnote-goto-footnote C-c ! r Footnote-renumber-footnotes C-c ! s Footnote-set-style --------------- C-x { shrink-window-horizontally C-x } enlarge-window-horizontally enlarge-window is on C-x ^ shrink-window exists; Veera-For want of a better key sequence, I have bound it to C-x& --------------- "Oliver Fischer" writes: Hi! > I am looking for a function to trim tailing spaces. Does such a function > alreay exists? Dunno, I've cooked up my own: (defun nk-nuke-trailing-whitespaces (beg end) "Remove trailing whitespaces in REGION" (interactive "r") (save-excursion (save-restriction (narrow-to-region beg end) (goto-char (point-min)) (while (re-search-forward "[ \t]+$" nil t) (delete-horizontal-space)) (widen)))) norbert. -- I once decorated my apartment entirely in ten foot salad forks!! --------------- For getting two different font-colors in XServer windows and in ttys. First start the gnuserver. Load the tty colors. Close the XServer window. Run > gnuclient & Run font-lock-use-default-colors. C-x 5 0 for making the gnuclient window the server window (The "Server" in the modeline _disappers_). Start gnuclient -nw from the tty. Voila! ---------------------- Press M-x customize-option RET auto-show-mode RET and set the variable to "on" and save it for future sessions. Then Emacs will automatically scroll the window when you hit the '$' sign in a truncated line. (Try C-x 3 in the default *scratch* buffer to get one of these - you may have to make the frame a bit smaller.) ---------------------- interprogram-cut-function interprogram-paste-function ----------------------' M-/ runs 'dabbrev-expand' 'dabbrev-expand' is an interactive compiled Lisp function -- loaded from "dabbrev" (dabbrev-expand ARG) Documentation: Expand previous word "dynamically". Expands to the most recent, preceding word for which this is a prefix. If no suitable preceding word is found, words following point are considered. If still no suitable word is found, then look in the buffers accepted by the function pointed out by variable 'dabbrev-friend-buffer-function'. ---------------------- Veera - As with _all_ interpretations of "free"/"gnu" software, the following is always debatable and to a lesser extent controversial In gnu.emacs.help, XEmacs is off-topic. In comp.emacs.xemacs, Emacs is off-topic. In comp.emacs, both versions are on-topic. In principle, comp.emacs could be used to discuss MicroEmacs and similar programs, too, but it seems there is no demand for this. Does that help? kai Another distinction in addition to those already mentioned is that the gnus.* newsgroups are proprietary; their charters restrict discussions to gnus and other 'free' software. comp.emacs is not so restricted, so people here are free to mention books and other resources that are not 'free,' as that term is defined. Philip Stripling ---------------------- Evaluate (modify-syntax-entry ?_ "w") in the file's buffer using M-: This changes the buffer's syntax table to make "_" part of a word. ---------------------- C-x = runs 'what-cursor-position' Documentation: Print info on cursor position (on screen and within buffer). ---------------------- insert-selection ---------------------- M-1 M-! inserts the output of shell-command into Xemacs. In fact all you need is a non-nil prefix command ---------------------- The Server keyword appears in the modeline if one of the buffers is associated with a gnuclient ---------------------- > So for some reason Emacs erroneously thinks that your DOS > files are Unix-style files. This might be due to some > setting in your .emacs file that is overriding the usual > automatic file-type detection, forcing all files to be seen > as Unix-type files. inhibit-eol-conversion ---------------------- http://www.davep.org/emacs/ ---------------------- > C-u C-s searches forward for a regular expression. But there is nothing to > search the same expression multiple times, analogous to pressing C-s > repeatedly, right? C-u C-s C-s C-s ... searches again. ---------------------- From: David Oberbeck Subject: Re: add keywords to CC-Mode Newsgroups: gnu.emacs.help Greetings, Put the following in your .emacs: (font-lock-add-keywords 'c-mode '(("\\<\\(FIXME\\)" 1 font-lock-warning-face t))) with the keyword you want added, in this case FIXME . You need to add a separate section for c++ mode, e.g. (font-lock-add-keywords 'c++-mode '(("\\<\\(FIXME\\)" 1 font-lock-warning-face t))) ---------------------- w3m-el is great stuff, but the downloads are synchronous which gets in the way of productivity for big downloads. So I wrote this little function that uses wget to download them. (defun w3m-download-with-wget (loc) (interactive "DSave to: ") (let ((url (or (w3m-anchor) (w3m-image)))) (if url (let ((proc (start-process "wget" (format "*wget %s*" url) "wget" "--passive-ftp" "-nv" "-P" (expand-file-name loc) url))) (with-current-buffer (process-buffer proc) (erase-buffer)) (set-process-sentinel proc (lambda (proc str) (message "wget download done")))) (message "Nothing to get")))) ---------------------- Here's another one, this time using Xdialog to inform you when lftp is finished. (eval-after-load "w3m" '(defun w3m-download (url &optional filename no-cache handler) (call-process "/usr/bin/lftp" nil nil nil "-c" (concat "lcd ~/dl; (get " url " && !Xdialog --title \"w3m download\" --interval 5 " "--msgbox \"" url " has finished downloading\" 0 0) &")))) John Wigley ---------------------- # WARNING: The following code completely redefines the words that have # to be highlighted!!! Nelson Loyola writes: >Hi All, > >Is there a way to make square brackets in c-mode or c++-mode show up as >bold? You can create your own face. Here's a sample of how I've done it with perl: ;############# CPERL-BRACKET-FACE ################## (defvar cperl-bracket-face 'cperl-bracket-face "Special face for brackets in cperl mode") (defface cperl-bracket-face '((((class color) (background dark)) (:foreground "red")) (((class color) (background light)) (:foreground "red" :bold t :size "14pt" :family "lucida")) (((class grayscale) (background light)) (:foreground "DimGray" :bold t :italic t)) (((class grayscale) (background dark)) (:foreground "LightGray" :bold t :italic t)) (t (:bold t))) "Special face for bracket in cperl mode." :group 'cperl-faces) (defun glen-cperl-mode-setup0 () (setq font-lock-keywords (cons '("[{}()]" 0 cperl-bracket-face t t) font-lock-keywords))) (add-hook 'cperl-mode-hook 'glen-cperl-mode-setup0) ---------------------- how to add a menu This stuff goes to your ~/.xemacs/init.el (in XEmacs 21.1 and before this was the file .emacs - now it's splitted into a own directory). In this example the menu Menu is added to the Menubar, which also contains a small submenu to start and to stop the clock. I also added buttons to scroll to the top or bottom of the active buffer. (add-menu-button '("Menu") ["Gnus" gnus t]) (add-menu-button '("Menu") ["Speedbar" speedbar t]) (add-menu-button '("Menu" "Clock") ["start" display-time t]) (add-menu-button '("Menu" "Clock") ["Stop" display-time-stop t]) (add-menu-button nil ["Sky"beginning-of-buffer t]) (add-menu-button nil ["Earth" end-of-buffer t]) ---------------------- # a foreach command execution in elisp > (setq shell-file-name "/bin/sh") > (shell-command "for word in foo bar\ndo\nprint $word\ndone") ---------------------- >> When I delete words and regions in my xemacs 21.4, it puts theninto >> the kill ring. > > You did not 'delete' but 'killed' ;-) > > See delete-region vs kill-region. > > But I'm afraid that there's no built in delete-word in Emacs. It's not built-in, but this should do the trick: (defun my-delete-word (arg) "Delete characters forward until encountering the end of a word. With prefix argument ARG, do this that many times." (interactive "p") (delete-region (point) (progn (forward-word arg) (point)))) (defun my-backwards-delete-word (arg) "Delete characters backward until encountering the end of a word. With prefix argument ARG, do this that many times." (interactive "p") (my-delete-word (- arg))) Bind to keys of your choice and have a blast. ---------------------- http://oconnor.cx/elisp/ ---------------------- http://deego.gnufans.org/~deego/pub/emacspub/lisp-mine/vel/ ---------------------- >>>>> "Jaroslaw" == Jaroslaw Zola writes: Jaroslaw> I have one more question :) Jaroslaw> Is that possible (using i.e. ctypes) to add some Jaroslaw> keywords to different font-faces, for example, I want to Jaroslaw> add "\\" to font-lock-type-face and, Jaroslaw> "\\" to font-lock-keyword-face ? Hi Jaroslaw, I'm not sure if following snippet from my site-start.el is still relevant, but it should be enough to show you how to extend font-locking for a certain mode. (defconst python-keywords '("import" "from" "def" "class" "exec" "global" "del" "pass" "if" "while" "for" "in" "try" "except" "finally" "raise" "and" "or" "not" "return" "print" "else" "elif" "break" "continue" "access" "is") "Keywords in python-mode.") (defconst python-font-lock-keywords (list '("\\bdef\\s +\\(\\sw+\\)(" 1 font-lock-function-name-face) '("\\bclass\\s +\\(\\sw+\\)[(:]" 1 font-lock-function-name-face) (cons (concat "\\(\\<" (mapconcat 'identity python-keywords "\\>\\|\\<") "\\>\\)") 1) ) "Expressions to highlight in Python buffers.") (add-hook 'font-lock-mode-hook '(lambda () (cond ((eq major-mode 'python-mode) (set (make-local-variable 'font-lock-keywords) python-font-lock-keywords))) )) Jaroslaw> Regards, Jaroslaw> Jaroslaw Zola -- Adrian Aichner ---------------------- --------- ;;from my .emacs... (let ((storage "auto\\|extern\\|register\\|static\\|volatile") (prefixes "unsigned\\|short\\|long\\|const") (types (concat "int\\|long\\|char\\|float\\|double\\|void\\|struct\\|" "union\\|enum\\|typedef")) (usertypes "bool_t\\|DLGWID_LIST\\|DateTimeType") (xtypes "Boolean\\|XtPointer\\|Widget") (ctoken "\\(\\sw\\|\\s_\\|[:~*&]\\)+") ) (setq c-gnc-font-lock-keywords (purecopy (append c-font-lock-keywords-1 (list ;; ;; fontify all storage classes and type specifiers ;; types should be surrounded by non alphanumerics (Raymond Toy) (cons (concat "\\<\\(" storage "\\)\\>") 'font-lock-type-face) (list (concat "\\([^a-zA-Z0-9_]\\|^\\)\\(" types "\\)\\([^a-zA-Z0-9_]\\|$\\)") 2 'font-lock-type-face) ;; Fontify usertypes (list (concat "\\([^a-zA-Z0-9_]\\|^\\)\\(" usertypes "\\)\\([^a-zA-Z0-9_]\\|$\\)") 2 'font-lock-preprocessor-face) ;; Fontify X/Xt/Xm types (list (concat "\\([^a-zA-Z0-9_]\\|^\\)\\(" xtypes "\\)\\([^a-zA-Z0-9_]\\|$\\)") 2 'font-lock-preprocessor-face) ;; fontify the prefixes now. The types should have been fontified ;; previously. (list (concat "\\<\\(" prefixes "\\)[ \t]+\\(" types "\\)\\>") 1 'font-lock-type-face) ;; ;; fontify all builtin tokens (cons (concat "[ \t]\\(" (mapconcat 'identity '("for" "while" "do" "return" "goto" "case" "break" "switch" "if" "then" "else if" "else" "return" "continue" "default" ) "\\|") "\\)[ \t\n(){};,]") 1) ;; ;; fontify case targets and goto-tags. This is slow because the ;; expression is anchored on the right. "\\(\\(\\sw\\|\\s_\\)+\\):" ;; ;; Fontify variables declared with structures, or typedef names. '("}[ \t*]*\\(\\(\\sw\\|\\s_\\)+\\)[ \t]*[,;]" 1 font-lock-function-name-face) ;; ;; Fontify global variables without a type. ; '("^\\([_a-zA-Z0-9:~*]+\\)[ \t]*[[;={]" 1 font-lock-function-name-face) )))) ) (setq-default c-font-lock-keywords-1 c-gnc-font-lock-keywords) (setq-default c-font-lock-keywords-2 c-gnc-font-lock-keywords) -- Glenn Carr, gcarr@lgc.com ---------------------- Veera Venkataramani wrote: > I compiled xemacs-21.4.11 on solaris (Sun Blade 100) and it seems to > run fine. But if I try to run gnuclient from a TTY I get this error in > the xemacs frame. > Terminal type `xterm' undefined (or can't access database?) > I looked in the trouble shooting FAQ > (http://www.xemacs.org/FAQ/xemacs-faq.html#SEC40) and I something > similar for ncurses (I dont know what that is). > " Ben Wing writes: > Your ncurses configuration is messed up. Your /usr/lib/terminfo is > a bad pointer, perhaps to a CD-ROM that is not inserted. " /usr/lib/terminfo is technically obsolete (installing ncurses may add a link, but is not recommended). > However, on my desktop, I cant find /usr/lib/terminfo. Can someone > help me out here? setenv TERMINFO /usr/share/lib/terminfo will make the application use Sun's terminfo database. But none of the terminfo entries in Sun's terminfo database have useful color definitions (unless you're using dtterm, which does not sound likely). You can also set TERMINFO to your own directory, and compile terminfo entries that reside locally. ;; Veera - You have to set TERMINFO before compiling and before ;; starting any xemacs session!! ---------------------- > McClain writes: > >> How do I change or switch off this annoying >> beep emacs plays for nearly everything? >> > > put this in your .emacs: > > ;; blink instead of beep when an error occurs > (setq visible-bell t) > Or alternatively, if you just want it to be less nearly everything (setq ring-bell-function (lambda () (unless (memq this-command '(isearch-abort abort-recursive-edit exit-minibuffer keyboard-quit)) ;; add extra commands here! (ding)))) pinched off a ng somewhere R ---------------------- Thomas R. Shannon wrote: > Is there a way to have vm prompt for an external viewer for a mime > object when one is not defined? If your viewer can accept input on stdin you can put the cursor on the object tag and use $ |. Otherwise, no. '| ---------------------- (defun match-paren (arg) "Go to the matching paren if on a paren; otherwise insert %." (interactive "p") (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1)) ((looking-at "\\s\)") (forward-char 1) (backward-list 1)) (t (self-insert-command (or arg 1))))) (global-set-key "%" 'match-paren) ---------------------- When the hungry-delete-key feature is enabled (as evidenced by the `/h' or `/ah' on the modeline after the mode name) the delete key gobbles all preceding whitespace in one fell swoop. ----------------------