Re: read-abbrev-file function
Richard Stallman wrote: > Thanks for reporting the bug. I wrote a cleaner fix. > Until it's in the CVS-rep; Here the present state of art: ;; Bugged: read-abbrev-file function in abbrev.el ;; The `(interactive "f' - kontroll-letter takes just ;; the current buffer-file if you quit the demand ;; with RET. That's not what you want: If the file is ;; already open, there is no need to call ;; `read-abbrev-file', the `default-abbrev-file' should ;; be called in the case of no specified user input. ;; Fixed: ;; Loads the default-abbrev-file unless no file is specified. (defalias 'read-abbrev-file 'read-abbrev-file-ar) (defun read-abbrev-file-ar (&optional file quietly) "Read abbrev definitions from file written with `write-abbrev-file'. Optional argument FILE is the name of the file to read; it defaults to the value of `abbrev-file-name'. Optional second argument QUIETLY non-nil means don't print anything." (interactive (list ;; clear unavertedly inserted whitespaces (string-strip (read-from-minibuffer (concat "default: " abbrev-file-name)) t t))) (load (if (and file (> (length file) 0)) file abbrev-file-name) nil quietly) (setq abbrevs-changed nil)) ;; Function needed to clear unavertedly by users ;; inserted whitespaces ;; Source: comment-string-strip, newcomment.el, GNU Emacs 22.0.50.1;; (defun string-strip (str beforep afterp) "Strip STR of any leading (if BEFOREP) and/or trailing (if AFTERP) space. " (string-match (concat "\\`" (if beforep "\\s-*") "\\(.*?\\)" (if afterp "\\s-*\n?") "\\'") str) (match-string 1 str)) ;; Bugged: quietly-read-abbrev-file: ;; old: ;; Interactive calls have been disabled from ;; quietly-read-abbrev-file, probably to avoid the bug ;; with the `f'-interactive-kontroll-letter ;; new: `interactive' reinstalled (defun quietly-read-abbrev-file-ar (&optional file) "Read abbrev definitions from file written with `write-abbrev-file'. Optional argument FILE is the name of the file to read; it defaults to the value of `abbrev-file-name'. Does not display any message." (interactive) (read-abbrev-file-ar file t)) ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: read-abbrev-file function
Richard Stallman wrote: > Thanks for reporting the bug. I wrote a cleaner fix. > Please send copy of the fix, couldn't see it in the CVS-Rep. AFAIS there is a related bug in abbrev.el, the fix depends on the way `read-abbrev-file' is written: ;; Bugged: quietly-read-abbrev-file: ;; old: Interactive calls have been disabled from ;; quietly-read-abbrev-file, probably to avoid ;; disturbance caused by the ;; `f'-interactive-kontroll-letter bug ;; new: `interactive' reinstalled (defun quietly-read-abbrev-file-ar (&optional file) "Read abbrev definitions from file written with `write-abbrev-file'. Optional argument FILE is the name of the file to read; it defaults to the value of `abbrev-file-name'. Does not display any message." (interactive) (read-abbrev-file-ar file t)) __ Andreas Roehler PS.: Meanwhile I rewrote `read-abbrev-file' with `cond', so its better to read: (defun read-abbrev-file-ar (&optional file quietly) "Read abbrev definitions from file written with `write-abbrev-file'. Optional argument FILE is the name of the file to read; it defaults to the value of `abbrev-file-name'. Optional second argument QUIETLY non-nil means don't print anything." (interactive) (let* ((abbrevs-to-load (cond ((when (boundp file)) file) ;; if quietly was specified but no file given, ;; load default abbrev-file ((when quietly abbrev-file-name)) ;; clear unavertedly inserted whitespaces ((string-strip (read-from-minibuffer (concat "default: " abbrev-file-name)) t t) (when (string= abbrevs-to-load "") (setq abbrevs-to-load abbrev-file-name)) (load abbrevs-to-load nil quietly)) (setq abbrevs-changed nil)) ;; Function needed to clear unavertedly by users ;; inserted whitespaces ;; Source: comment-string-strip, newcomment.el, GNU Emacs 22.0.50.1;; (defun string-strip (str beforep afterp) "Strip STR of any leading (if BEFOREP) and/or trailing (if AFTERP) space. " (string-match (concat "\\`" (if beforep "\\s-*") "\\(.*?\\)" (if afterp "\\s-*\n?") "\\'") str) (match-string 1 str)) ;; end ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: read-abbrev-file function
Thanks for reporting the bug. I wrote a cleaner fix. ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
read-abbrev-file function
;; Bugged: read-abbrev-file function in abbrev.el ;; The `(interactive "f' - kontroll-letter takes just ;; the current buffer-file if you quit the demand ;; with RET. That's not what you want: If the file is ;; already open, there is no need to call ;; `read-abbrev-file', the `default-abbrev-file' should ;; be called in the case of no specified user input. ;; Proposed fix: ;; Loads the default-abbrev-file unless no file is specified. (defalias 'read-abbrev-file 'read-abbrev-file-ar) (defun read-abbrev-file-ar (&optional file quietly) "Read abbrev definitions from file written with `write-abbrev-file'. Optional argument FILE is the name of the file to read; it defaults to the value of `abbrev-file-name'. Optional second argument QUIETLY non-nil means don't print anything." (interactive) (let* ((abbrevs-to-load file) (abbrevs-to-load (if abbrevs-to-load abbrevs-to-load ;; clear unavertedly inserted whitespaces (string-strip (read-from-minibuffer (concat "(default: "abbrev-file-name") ")) t t))) (abbrevs-to-load (if (string= abbrevs-to-load "") abbrev-file-name abbrevs-to-load))) (load abbrevs-to-load nil quietly)) (setq abbrevs-changed nil)) ;; Function needed to clear unavertedly ;; inserted whitespaces ;; Source: comment-string-strip, newcomment.el, GNU Emacs 22.0.50.1;; (defun string-strip (str beforep afterp) "Strip STR of any leading (if BEFOREP) and/or trailing (if AFTERP) space. " (string-match (concat "\\`" (if beforep "\\s-*") "\\(.*?\\)" (if afterp "\\s-*\n?") "\\'") str) (match-string 1 str)) ;; end ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug