commit 6e1fac9bc7d28a7c7ebdc612673736c9825606e0 (HEAD, refs/remotes/origin/master) Author: Eric Abrahamsen Date: Sat Mar 21 23:59:30 2015 +0000 lisp/gnus/{registry.el,gnus-registry.el}: Use slot names in references to object slot values diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 63a2826..762e3e7 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,10 @@ +2015-03-21 Eric Abrahamsen + + * registry.el (registry-lookup-secondary, registry-full) + (registry-prune, registry-collect-prune-candidates): + * gnus-registry.el (gnus-registry-load): Use slot names rather than + initarg names in `oref' and `oset'. + 2015-03-19 Eric Abrahamsen * registry.el (registry-prune): Allow registry to reach full size diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el index 1d5887d..f73f216 100644 --- a/lisp/gnus/gnus-registry.el +++ b/lisp/gnus/gnus-registry.el @@ -335,7 +335,7 @@ This is not required after changing `gnus-registry-cache-file'." old-file-name file))) (progn (gnus-registry-read old-file-name) - (setf (oref gnus-registry-db :file) file) + (setf (oref gnus-registry-db file) file) (gnus-message 1 "Registry filename changed to %s" file)) (gnus-registry-remake-db t)))) (error diff --git a/lisp/gnus/registry.el b/lisp/gnus/registry.el index e0f944a..e4ba0bc 100644 --- a/lisp/gnus/registry.el +++ b/lisp/gnus/registry.el @@ -185,8 +185,8 @@ When CREATE is not nil, create the secondary index hashtable if needed." (when create (puthash tracksym (make-hash-table :size 800 :rehash-size 2.0 :test 'equal) - (oref db :tracker)) - (gethash tracksym (oref db :tracker)))))) + (oref db tracker)) + (gethash tracksym (oref db tracker)))))) (defmethod registry-lookup-secondary-value ((db registry-db) tracksym val &optional set) @@ -282,7 +282,7 @@ This is the key count of the `data' slot." (defmethod registry-full ((db registry-db)) "Checks if registry-db THIS is full." (>= (registry-size db) - (oref db :max-size))) + (oref db max-size))) (defmethod registry-insert ((db registry-db) key entry) "Insert ENTRY under KEY into the registry-db THIS. @@ -341,11 +341,11 @@ from the front of the list are deleted first. Returns the number of deleted entries." (let ((size (registry-size db)) - (target-size (- (oref db :max-size) - (* (oref db :max-size) - (oref db :prune-factor)))) + (target-size (- (oref db max-size) + (* (oref db max-size) + (oref db prune-factor)))) candidates) - (if (> size (oref db :max-size)) + (if (> size (oref db max-size)) (progn (setq candidates (registry-collect-prune-candidates @@ -359,7 +359,7 @@ Returns the number of deleted entries." Proposes only entries without the :precious keys, and attempts to return LIMIT such candidates. If SORTFUNC is provided, sort entries first and return candidates from beginning of list." - (let* ((precious (oref db :precious)) + (let* ((precious (oref db precious)) (precious-p (lambda (entry-key) (cdr (memq (car entry-key) precious)))) (data (oref db data)) commit ad80180d0f2fc2ea422cf7ca5bdcc636c0600744 Author: Eli Zaretskii Date: Sat Mar 21 17:44:00 2015 +0200 Fix problems with setting system-time-locale on MS-Windows src/emacs.c (synchronize_locale) [WINDOWSNT]: Ignore 'category' and always use LC_ALL instead. Fixes problems with setting system-time-locale to something non-default. diff --git a/src/ChangeLog b/src/ChangeLog index bdec3c9..5aa248e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2015-03-21 Eli Zaretskii + + * emacs.c (synchronize_locale) [WINDOWSNT]: Ignore 'category' and + always use LC_ALL instead. Fixes problems with setting + system-time-locale to something non-default. + 2015-03-18 Glenn Morris * frame.h (x_set_bitmap_icon): Don't set the icon if icon-type is diff --git a/src/emacs.c b/src/emacs.c index d318fd4..70db900 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -2152,6 +2152,13 @@ synchronize_locale (int category, Lisp_Object *plocale, Lisp_Object desired_loca { if (! EQ (*plocale, desired_locale)) { +#ifdef WINDOWSNT + /* Changing categories like LC_TIME usually requires to specify + an encoding suitable for the new locale, but MS-Windows's + 'setlocale' will only switch the encoding when LC_ALL is + specified. So we ignore CATEGORY and use LC_ALL instead. */ + category = LC_ALL; +#endif *plocale = desired_locale; setlocale (category, (STRINGP (desired_locale) ? SSDATA (desired_locale) commit 4a50af936e24b5f71df4079beb6dde82ed1955c2 Author: Titus von der Malsburg Date: Sat Mar 21 12:31:29 2015 +0200 Add new functions for computing default font dimensions lisp/window.el (window-font-width, window-font-height) (window-max-chars-per-line): New functions. lisp/simple.el (default-font-height): Doc fix. (default-font-width): New function. etc/NEWS: Mention `default-font-width', `window-font-height', `window-font-width', and `window-max-chars-per-line'. diff --git a/etc/ChangeLog b/etc/ChangeLog index cd5c540..c94e122 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,8 @@ +2015-03-21 Titus von der Malsburg + + * NEWS: Mention `default-font-width', `window-font-height', + `window-font-width', and `window-max-chars-per-line'. + 2015-03-03 Kelvin White * NEWS.24: Add section to include ERC changes. diff --git a/etc/NEWS b/etc/NEWS index cabd008..7cdb24b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -173,6 +173,24 @@ possible inaccuracies in the end position. In particular, it now returns the average width of the font's characters, which can be used for geometry-related calculations. +** A new function `default-font-width' returns the average width of a +character in the current buffer's default font. If the default face +is remapped (see `face-remapping-alist'), the value for the remapped +face is returned. This function complements the existing function +`default-font-height'. + +** New functions `window-font-height' and `window-font-width' return +the height and average width of characters in a specified face and +window. If FACE is remapped (see `face-remapping-alist'), the +function returns the information for the remapped face. + +** A new function `window-max-chars-per-line' returns the maximal +number of characters that can be displayed on one line. If a face +and/or window are provided, these values are used for the +calculation. This function is different from `window-body-width' in +that it accounts for (i) continuation glyphs, (ii) the size of the +font, and (iii) the specified window. + * Editing Changes in Emacs 25.1 diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1cfefaa..2f9c430 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2015-03-21 Titus von der Malsburg + + * window.el (window-font-width, window-font-height) + (window-max-chars-per-line): New functions. + + * simple.el (default-font-height): Doc fix. + (default-font-width): New function. + 2015-03-21 Tassilo Horn * emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-1): Also diff --git a/lisp/simple.el b/lisp/simple.el index 98188a0..f7f3556 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5409,7 +5409,10 @@ lines." (declare-function font-info "font.c" (name &optional frame)) (defun default-font-height () - "Return the height in pixels of the current buffer's default face font." + "Return the height in pixels of the current buffer's default face font. + +If the default font is remapped (see `face-remapping-alist'), the +function returns the height of the remapped face." (let ((default-font (face-font 'default))) (cond ((and (display-multi-font-p) @@ -5420,6 +5423,25 @@ lines." (aref (font-info default-font) 3)) (t (frame-char-height))))) +(defun default-font-width () + "Return the width in pixels of the current buffer's default face font. + +If the default font is remapped (see `face-remapping-alist'), the +function returns the width of the remapped face." + (let ((default-font (face-font 'default))) + (cond + ((and (display-multi-font-p) + ;; Avoid calling font-info if the frame's default font was + ;; not changed since the frame was created. That's because + ;; font-info is expensive for some fonts, see bug #14838. + (not (string= (frame-parameter nil 'font) default-font))) + (let* ((info (font-info (face-font 'default))) + (width (aref info 11))) + (if (> width 0) + width + (aref info 10)))) + (t (frame-char-width))))) + (defun default-line-height () "Return the pixel height of current buffer's default-face text line. diff --git a/lisp/window.el b/lisp/window.el index cc8a7fc..d176050 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -1835,6 +1835,61 @@ optional argument PIXELWISE is passed to the functions." (window-body-width window pixelwise) (window-body-height window pixelwise))) +(defun window-font-width (&optional window face) + "Return average character width for the font of FACE used in WINDOW. +WINDOW must be a live window and defaults to the selected one. + +If FACE is nil or omitted, the default face is used. If FACE is +remapped (see `face-remapping-alist'), the function returns the +information for the remapped face." + (with-selected-window (window-normalize-window window t) + (if (display-multi-font-p) + (let* ((face (if face face 'default)) + (info (font-info (face-font face))) + (width (aref info 11))) + (if (> width 0) + width + (aref info 10))) + (frame-char-width)))) + +(defun window-font-height (&optional window face) + "Return character height for the font of FACE used in WINDOW. +WINDOW must be a live window and defaults to the selected one. + +If FACE is nil or omitted, the default face is used. If FACE is +remapped (see `face-remapping-alist'), the function returns the +information for the remapped face." + (with-selected-window (window-normalize-window window t) + (if (display-multi-font-p) + (let* ((face (if face face 'default)) + (info (font-info (face-font face)))) + (aref info 3)) + (frame-char-height)))) + +(defun window-max-chars-per-line (&optional window face) + "Return the number of characters that can be displayed on one line in WINDOW. +WINDOW must be a live window and defaults to the selected one. + +The character width of FACE is used for the calculation. If FACE +is nil or omitted, the default face is used. If FACE is +remapped (see `face-remapping-alist'), the function uses the +remapped face. + +This function is different from `window-body-width' in two +ways. First, it accounts for the portions of the line reserved +for the continuation glyph. Second, it accounts for the size of +the font." + (with-selected-window (window-normalize-window window t) + (let* ((window-width (window-body-width window t)) + (font-width (window-font-width window face)) + (ncols (/ window-width font-width))) + (if (and (display-graphic-p) + overflow-newline-into-fringe + (/= (frame-parameter nil 'left-fringe) 0) + (/= (frame-parameter nil 'right-fringe) 0)) + ncols + (1- ncols))))) + (defun window-current-scroll-bars (&optional window) "Return the current scroll bar types for WINDOW. WINDOW must be a live window and defaults to the selected one. commit 70565a21765ea5f9b163e1a0ef1331df03c7fc67 Author: Samer Masterson Date: Sat Mar 21 12:09:30 2015 +0200 Documentation and testing tips for CONTRIBUTE CONTRIBUTE (Test your changes.): New section. (Document your changes.): Add doc tips. diff --git a/CONTRIBUTE b/CONTRIBUTE index 5cf015f..7c40227 100644 --- a/CONTRIBUTE +++ b/CONTRIBUTE @@ -187,6 +187,26 @@ know it does not, mark the NEWS entry with "---". If you know that *all* the necessary documentation updates have been made, mark the entry with "+++". Otherwise do not mark it. +Please see (info "(elisp)Documentation Tips") or +https://www.gnu.org/software/emacs/manual/html_node/elisp/Documentation-Tips.html +for more specific tips on Emacs's doc style. Use `checkdoc' to check +for documentation errors before submitting a patch. + +** Test your changes. + +Please test your changes before committing them or sending them to the +list. + +Emacs uses ERT, Emacs Lisp Regression Testing, for testing. See (info +"(ert)") or https://www.gnu.org/software/emacs/manual/html_node/ert/ +for more information on writing and running tests. + +To run tests on the entire Emacs tree, run "make check" from the +top-level directory. Most tests are in the directory +"test/automated". From the "test/automated" directory, run "make +" to run the tests for .el(c). See +"test/automated/Makefile" for more information. + ** Understanding Emacs Internals. The best way to understand Emacs Internals is to read the code, diff --git a/ChangeLog b/ChangeLog index a79863a..c155708 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-03-21 Samer Masterson + + * CONTRIBUTE (Test your changes.): New section. + (Document your changes.): Add doc tips. + 2015-03-19 Paul Eggert Better port of pthread usage to FreeBSD