Using saved parent location: http://bzr.savannah.gnu.org/r/emacs/trunk/ Now on revision 102685. ------------------------------------------------------------ revno: 102685 author: Gnus developers committer: Katsumi Yamaoka branch nick: trunk timestamp: Fri 2010-12-17 22:45:16 +0000 message: Merge changes made in Gnus trunk. nnir.el (nnir-get-active): Ignore nnir-ignored-newsgroups if null. gnus-sum.el (gnus-summary-refer-thread): Simplify code. Restore gnus-use-agent. (gnus-get-newsgroup-headers): Avoid unwanted spaces at eol. gravatar.el (gravatar-retrieve-synchronously): New function. (gravatar-get-data): Make more robust. gnus-util.el (gnus-rescale-image): Allow to resize images even if they are from file. Can also scale up. nnimap.el (nnimap-retrieve-headers): Remove CRLF from the headers. nnir.el (nnir-mode): Make sure 'gnus-registry-install is bound. gnus-sum.el (gnus-get-newsgroup-headers): Revert the last change here, since it's up to the backends to do CRLF removal if their protocol has it. gnus-group.el (gnus-group-delete-articles): New command. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2010-12-16 23:18:57 +0000 +++ lisp/gnus/ChangeLog 2010-12-17 22:45:16 +0000 @@ -1,3 +1,37 @@ +2010-12-17 Lars Magne Ingebrigtsen + + * gnus-group.el (gnus-group-delete-articles): New command. + +2010-12-17 Andrew Cohen + + * nnir.el (nnir-mode): Make sure 'gnus-registry-install is bound. + +2010-12-17 Lars Magne Ingebrigtsen + + * gnus-sum.el (gnus-get-newsgroup-headers): Revert the last change + here, since it's up to the backends to do CRLF removal if their + protocol has it. + + * nnimap.el (nnimap-retrieve-headers): Remove CRLF from the headers. + +2010-12-17 Julien Danjou + + * gnus-util.el (gnus-rescale-image): Allow to resize images even if + they are from file. Can also scale up. + +2010-12-17 Andrew Cohen + + * gnus-sum.el (gnus-summary-refer-thread): Simplify code. Restore + gnus-use-agent. + (gnus-get-newsgroup-headers): Avoid unwanted spaces at eol. + + * nnir.el (nnir-get-active): Ignore nnir-ignored-newsgroups if null. + +2010-12-17 Julien Danjou + + * gravatar.el (gravatar-retrieve-synchronously): New function. + (gravatar-get-data): Make more robust. + 2010-12-16 Lars Magne Ingebrigtsen * nnimap.el (nnimap-wait-for-response): Fix the end-point calculation === modified file 'lisp/gnus/gnus-gravatar.el' --- lisp/gnus/gnus-gravatar.el 2010-12-11 01:27:14 +0000 +++ lisp/gnus/gnus-gravatar.el 2010-12-17 22:45:16 +0000 @@ -56,7 +56,7 @@ (let* ((mail-extr-disable-voodoo t) (addresses (mail-extract-address-components (or (mail-fetch-field header) "") t)) - (gravatar-size gnus-gravatar-size) + (gravatar-size (or gnus-gravatar-size gravatar-size)) name) (dolist (address addresses) (when (and (setq name (car address)) === modified file 'lisp/gnus/gnus-group.el' --- lisp/gnus/gnus-group.el 2010-12-16 22:22:28 +0000 +++ lisp/gnus/gnus-group.el 2010-12-17 22:45:16 +0000 @@ -2734,6 +2734,15 @@ (lambda (group) (gnus-group-delete-group group nil t)))))) +(defun gnus-group-delete-articles (group) + "Delete all articles in the current group." + (interactive (list (gnus-group-group-name))) + (let ((articles (gnus-uncompress-range (gnus-active group)))) + (when (gnus-yes-or-no-p + (format "Do you really want to delete these %d articles forever? " + (length articles))) + (gnus-request-expire-articles articles group 'force)))) + (defun gnus-group-delete-group (group &optional force no-prompt) "Delete the current group. Only meaningful with editable groups. If FORCE (the prefix) is non-nil, all the articles in the group will === modified file 'lisp/gnus/gnus-sum.el' --- lisp/gnus/gnus-sum.el 2010-12-16 22:22:28 +0000 +++ lisp/gnus/gnus-sum.el 2010-12-17 22:45:16 +0000 @@ -8868,30 +8868,27 @@ variable." (interactive "P") (gnus-warp-to-article) - (let ((id (mail-header-id (gnus-summary-article-header))) - (gnus-inhibit-demon t) - (gnus-agent nil) - (gnus-summary-ignore-duplicates t) - (gnus-read-all-available-headers t) - (limit (if limit (prefix-numeric-value limit) - gnus-refer-thread-limit))) + (let* ((header (gnus-summary-article-header)) + (id (mail-header-id header)) + (gnus-inhibit-demon t) + (gnus-summary-ignore-duplicates t) + (gnus-read-all-available-headers t) + (limit (if limit (prefix-numeric-value limit) + gnus-refer-thread-limit))) (setq gnus-newsgroup-headers (gnus-merge 'list gnus-newsgroup-headers (if (gnus-check-backend-function 'request-thread gnus-newsgroup-name) - (gnus-request-thread (gnus-summary-article-header)) + (gnus-request-thread header) (let* ((last (if (numberp limit) - (min (+ (mail-header-number - (gnus-summary-article-header)) + (min (+ (mail-header-number header) limit) gnus-newsgroup-highest) gnus-newsgroup-highest)) (subject (gnus-simplify-subject - (mail-header-subject - (gnus-summary-article-header)))) - (refs (split-string (or (mail-header-references - (gnus-summary-article-header)) + (mail-header-subject header))) + (refs (split-string (or (mail-header-references header) ""))) (gnus-parse-headers-hook (lambda () (goto-char (point-min)) === modified file 'lisp/gnus/gnus-util.el' --- lisp/gnus/gnus-util.el 2010-12-05 23:29:50 +0000 +++ lisp/gnus/gnus-util.el 2010-12-17 22:45:16 +0000 @@ -1983,21 +1983,16 @@ "Rescale IMAGE to SIZE if possible. SIZE is in format (WIDTH . HEIGHT). Return a new image. Sizes are in pixels." - (if (or (not (fboundp 'imagemagick-types)) - (not (get-buffer-window (current-buffer)))) - image + (when (fboundp 'imagemagick-types) (let ((new-width (car size)) (new-height (cdr size))) - (when (> (cdr (image-size image t)) new-height) - (setq image (or (create-image (plist-get (cdr image) :data) 'imagemagick t - :height new-height) - image))) - (when (> (car (image-size image t)) new-width) - (setq image (or - (create-image (plist-get (cdr image) :data) 'imagemagick t - :width new-width) - image))) - image))) + (unless (= (cdr (image-size image t)) new-height) + (setcdr image (plist-put (cdr image) :type 'imagemagick)) + (setcdr image (plist-put (cdr image) :height new-height))) + (unless (= (car (image-size image t)) new-width) + (setcdr image (plist-put (cdr image) :type 'imagemagick)) + (setcdr image (plist-put (cdr image) :width new-width))))) + image) (defun gnus-list-memq-of-list (elements list) "Return non-nil if any of the members of ELEMENTS are in LIST." === modified file 'lisp/gnus/gravatar.el' --- lisp/gnus/gravatar.el 2010-10-04 22:26:51 +0000 +++ lisp/gnus/gravatar.el 2010-12-17 22:45:16 +0000 @@ -78,10 +78,11 @@ (defun gravatar-get-data () "Get data from current buffer." - (when (string-match "^HTTP/.+ 200 OK$" - (buffer-substring (point-min) (line-end-position))) - (when (search-forward "\n\n" nil t) - (buffer-substring (point) (point-max))))) + (save-excursion + (goto-char (point-min)) + (when (re-search-forward "^HTTP/.+ 200 OK$" nil (line-end-position)) + (when (search-forward "\n\n" nil t) + (buffer-substring (point) (point-max)))))) (eval-and-compile (cond ((featurep 'xemacs) @@ -98,7 +99,7 @@ If no image available, return 'error." (let ((data (gravatar-get-data))) (if data - (gravatar-create-image data nil t) + (gravatar-create-image data nil t) 'error))) ;;;###autoload @@ -117,6 +118,23 @@ (gravatar-data->image)) cbargs)))) +;;;###autoload +(defun gravatar-retrieve-synchronously (mail-address) + "Retrieve MAIL-ADDRESS gravatar and returns it." + (let ((url (gravatar-build-url mail-address))) + (if (gravatar-cache-expired url) + (with-current-buffer (url-retrieve-synchronously url) + (when gravatar-automatic-caching + (url-store-in-cache (current-buffer))) + (let ((data (gravatar-data->image))) + (kill-buffer (current-buffer)) + data)) + (with-temp-buffer + (mm-disable-multibyte) + (url-cache-extract (url-cache-create-filename url)) + (gravatar-data->image))))) + + (defun gravatar-retrieved (status cb &optional cbargs) "Callback function used by `gravatar-retrieve'." ;; Store gravatar? === modified file 'lisp/gnus/nnimap.el' --- lisp/gnus/nnimap.el 2010-12-16 23:18:57 +0000 +++ lisp/gnus/nnimap.el 2010-12-17 22:45:16 +0000 @@ -167,7 +167,8 @@ (nnimap-article-ranges (gnus-compress-sequence articles)) (nnimap-header-parameters)) t) - (nnimap-transform-headers)) + (nnimap-transform-headers) + (nnheader-remove-cr-followed-by-lf)) (insert-buffer-substring (nnimap-find-process-buffer (current-buffer)))) 'headers)) @@ -1568,7 +1569,7 @@ (min (- (point) 500) (save-excursion - (forward-line -1) + (forward-line -3) (point)))) (point-min)) t))) === modified file 'lisp/gnus/nnir.el' --- lisp/gnus/nnir.el 2010-12-16 22:22:28 +0000 +++ lisp/gnus/nnir.el 2010-12-17 22:45:16 +0000 @@ -1543,7 +1543,8 @@ (let ((cur (current-buffer)) name) (goto-char (point-min)) - (unless (string= nnir-ignored-newsgroups "") + (unless (or (null nnir-ignored-newsgroups) + (string= nnir-ignored-newsgroups "")) (delete-matching-lines nnir-ignored-newsgroups)) (if (eq (car method) 'nntp) (while (not (eobp)) @@ -1589,7 +1590,8 @@ (when (eq (car (gnus-find-method-for-group gnus-newsgroup-name)) 'nnir) (setq gnus-summary-line-format (or nnir-summary-line-format gnus-summary-line-format)) - (when (eq gnus-registry-install t) + (when (and (boundp 'gnus-registry-install) + (eq gnus-registry-install t)) (remove-hook 'gnus-summary-article-delete-hook 'gnus-registry-action t) (remove-hook 'gnus-summary-article-move-hook 'gnus-registry-action t) (remove-hook 'gnus-summary-article-expire-hook 'gnus-registry-action t) ------------------------------------------------------------ revno: 102684 committer: Ken Brown branch nick: trunk timestamp: Fri 2010-12-17 10:14:57 -0500 message: * loadup.el: Use version numbers in Cygwin build. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-12-17 10:56:03 +0000 +++ lisp/ChangeLog 2010-12-17 15:14:57 +0000 @@ -1,3 +1,7 @@ +2010-12-17 Ken Brown + + * loadup.el: Use version numbers in Cygwin build. + 2010-12-17 Ryan Twitchell (tiny change) * ido.el (ido-file-internal): Ask for confirmation before === modified file 'lisp/loadup.el' --- lisp/loadup.el 2010-12-15 08:16:53 +0000 +++ lisp/loadup.el 2010-12-17 15:14:57 +0000 @@ -342,7 +342,7 @@ (dump-emacs "emacs" "temacs") (message "%d pure bytes used" pure-bytes-used) ;; Recompute NAME now, so that it isn't set when we dump. - (if (not (or (memq system-type '(ms-dos windows-nt cygwin)) + (if (not (or (memq system-type '(ms-dos windows-nt)) ;; Don't bother adding another name if we're just ;; building bootstrap-emacs. (equal (nth 3 command-line-args) "bootstrap") ------------------------------------------------------------ revno: 102683 author: Ryan Twitchell committer: Chong Yidong branch nick: trunk timestamp: Fri 2010-12-17 18:56:03 +0800 message: Ask for confirmation in ido-file-internal (Bug#1238). * ido.el (ido-file-internal): Ask for confirmation before overwriting an existing file (Bug#1238). diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-12-17 04:04:06 +0000 +++ lisp/ChangeLog 2010-12-17 10:56:03 +0000 @@ -1,3 +1,8 @@ +2010-12-17 Ryan Twitchell (tiny change) + + * ido.el (ido-file-internal): Ask for confirmation before + overwriting an existing file (Bug#1238). + 2010-12-16 Chong Yidong * tool-bar.el (tool-bar-setup): Add separators. === modified file 'lisp/ido.el' --- lisp/ido.el 2010-12-13 15:27:36 +0000 +++ lisp/ido.el 2010-12-17 10:56:03 +0000 @@ -2430,7 +2430,7 @@ (ido-record-command 'write-file filename) (add-to-history 'file-name-history filename) (ido-record-work-directory) - (write-file filename)) + (write-file filename t)) ((eq method 'read-only) (ido-record-work-file filename) ------------------------------------------------------------ revno: 102682 committer: Chong Yidong branch nick: trunk timestamp: Fri 2010-12-17 12:04:06 +0800 message: Support for menu separators in the GTK tool-bar. * src/gtkutil.c (XG_BIN_CHILD): New macro. (xg_get_menu_item_label, xg_update_menubar) (xg_update_menu_item, xg_tool_bar_menu_proxy) (xg_show_toolbar_item, update_frame_tool_bar): Use it. (separator_names, xg_separator_p): Move to keyboard.c. (create_menus, xg_update_submenu, update_frame_tool_bar): Use menu_separator_name_p. * src/keyboard.c (parse_tool_bar_item): Allow menu separators in tool-bar maps. (menu_separator_name_p): New function, from gtkutil.c. (separator_names): Move from gtkutil.c. * src/keyboard.h (menu_separator_name_p): Add prototype. * src/nsmenu.m (name_is_separator): Function deleted. (addItemWithWidgetValue): Use menu_separator_name_p. * src/w32menu.c (name_is_separator): Function deleted. (add_menu_item): Use menu_separator_name_p. diff: === modified file 'etc/NEWS' --- etc/NEWS 2010-12-16 02:28:33 +0000 +++ etc/NEWS 2010-12-17 04:04:06 +0000 @@ -690,6 +690,11 @@ triplet, instead of signalling an error if the user provides a invalid input. +** Tool-bars can display separators. +Tool-bar separators are handled like menu separators in menu-bar maps, +i.e. with entries of the form `(menu-item "--")'. + +Currently, tool-bar separators are only displayed on GTK. ** Image API === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-12-16 02:35:56 +0000 +++ lisp/ChangeLog 2010-12-17 04:04:06 +0000 @@ -1,3 +1,9 @@ +2010-12-16 Chong Yidong + + * tool-bar.el (tool-bar-setup): Add separators. + + * menu-bar.el (featurep): Use menu-bar-separator. + 2010-12-16 Daiki Ueno * epa-file.el (epa-file-select-keys): Accept 'silent to inhibit === modified file 'lisp/menu-bar.el' --- lisp/menu-bar.el 2010-12-13 15:27:36 +0000 +++ lisp/menu-bar.el 2010-12-17 04:04:06 +0000 @@ -523,7 +523,8 @@ ,(purecopy "Cut (kill) text in region between mark and current position"))) ;; ns-win.el said: Separate undo from cut/paste section. (if (featurep 'ns) - (define-key menu-bar-edit-menu [separator-undo] `(,(purecopy "--")))) + (define-key menu-bar-edit-menu [separator-undo] menu-bar-separator)) + (define-key menu-bar-edit-menu [undo] `(menu-item ,(purecopy "Undo") undo :enable (and (not buffer-read-only) === modified file 'lisp/tool-bar.el' --- lisp/tool-bar.el 2010-11-21 18:29:08 +0000 +++ lisp/tool-bar.el 2010-12-17 04:04:06 +0000 @@ -257,23 +257,23 @@ ;;; Set up some global items. Additions/deletions up for grabs. (defun tool-bar-setup () - ;; People say it's bad to have EXIT on the tool bar, since users - ;; might inadvertently click that button. - ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit") (tool-bar-add-item-from-menu 'find-file "new" nil :label "New File" :vert-only t) (tool-bar-add-item-from-menu 'menu-find-file-existing "open" nil - :vert-only t) + :label "Open" :vert-only t) (tool-bar-add-item-from-menu 'dired "diropen" nil :vert-only t) (tool-bar-add-item-from-menu 'kill-this-buffer "close" nil :vert-only t) (tool-bar-add-item-from-menu 'save-buffer "save" nil :vert-only t + :label "Save" :visible '(or buffer-file-name (not (eq 'special (get major-mode 'mode-class))))) + (define-key-after (default-value 'tool-bar-map) [separator-1] menu-bar-separator) (tool-bar-add-item-from-menu 'undo "undo" nil :vert-only t :visible '(not (eq 'special (get major-mode 'mode-class)))) + (define-key-after (default-value 'tool-bar-map) [separator-2] menu-bar-separator) (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [cut]) "cut" nil :vert-only t :visible '(not (eq 'special (get major-mode @@ -284,6 +284,7 @@ "paste" nil :vert-only t :visible '(not (eq 'special (get major-mode 'mode-class)))) + (define-key-after (default-value 'tool-bar-map) [separator-3] menu-bar-separator) (tool-bar-add-item-from-menu 'nonincremental-search-forward "search" nil :label "Search") ;;(tool-bar-add-item-from-menu 'ispell-buffer "spell") === modified file 'src/ChangeLog' --- src/ChangeLog 2010-12-16 19:37:13 +0000 +++ src/ChangeLog 2010-12-17 04:04:06 +0000 @@ -1,3 +1,26 @@ +2010-12-17 Chong Yidong + + * keyboard.c (parse_tool_bar_item): Allow menu separators in + tool-bar maps. + (menu_separator_name_p): New function, from gtkutil.c. + (separator_names): Move from gtkutil.c. + + * keyboard.h (menu_separator_name_p): Add prototype. + + * gtkutil.c (XG_BIN_CHILD): New macro. + (xg_get_menu_item_label, xg_update_menubar) + (xg_update_menu_item, xg_tool_bar_menu_proxy) + (xg_show_toolbar_item, update_frame_tool_bar): Use it. + (separator_names, xg_separator_p): Move to keyboard.c. + (create_menus, xg_update_submenu, update_frame_tool_bar): Use + menu_separator_name_p. + + * nsmenu.m (name_is_separator): Function deleted. + (addItemWithWidgetValue): Use menu_separator_name_p. + + * w32menu.c (name_is_separator): Function deleted. + (add_menu_item): Use menu_separator_name_p. + 2010-12-16 Jan Djärv * nsterm.m (ns_draw_window_cursor): If the cursor color is the === modified file 'src/dispextern.h' --- src/dispextern.h 2010-12-13 15:27:36 +0000 +++ src/dispextern.h 2010-12-17 04:04:06 +0000 @@ -2881,7 +2881,8 @@ /* The binding. */ TOOL_BAR_ITEM_BINDING, - /* Button type. One of nil, `:radio' or `:toggle'. */ + /* Button type. One of nil (default button), t (a separator), + `:radio', or `:toggle'. The latter two currently do nothing. */ TOOL_BAR_ITEM_TYPE, /* Help string. */ === modified file 'src/gtkutil.c' --- src/gtkutil.c 2010-11-30 17:01:18 +0000 +++ src/gtkutil.c 2010-12-17 04:04:06 +0000 @@ -72,6 +72,8 @@ #define remove_submenu(w) gtk_menu_item_remove_submenu ((w)) #endif +#define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x)) + /*********************************************************************** Display handling functions @@ -2128,54 +2130,6 @@ return w; } -/* Return non-zero if LABEL specifies a separator (GTK only has one - separator type) */ - -static const char* separator_names[] = { - "space", - "no-line", - "single-line", - "double-line", - "single-dashed-line", - "double-dashed-line", - "shadow-etched-in", - "shadow-etched-out", - "shadow-etched-in-dash", - "shadow-etched-out-dash", - "shadow-double-etched-in", - "shadow-double-etched-out", - "shadow-double-etched-in-dash", - "shadow-double-etched-out-dash", - 0, -}; - -static int -xg_separator_p (const char *label) -{ - if (! label) return 0; - else if (strlen (label) > 3 - && strncmp (label, "--", 2) == 0 - && label[2] != '-') - { - int i; - - label += 2; - for (i = 0; separator_names[i]; ++i) - if (strcmp (label, separator_names[i]) == 0) - return 1; - } - else - { - /* Old-style separator, maybe. It's a separator if it contains - only dashes. */ - while (*label == '-') - ++label; - if (*label == 0) return 1; - } - - return 0; -} - static int xg_detached_menus; /* Returns non-zero if there are detached menus. */ @@ -2374,7 +2328,7 @@ GtkWidget *w; if (pop_up_p && !item->contents && !item->call_data - && !xg_separator_p (item->name)) + && !menu_separator_name_p (item->name)) { char *utf8_label; /* A title for a popup. We do the same as GTK does when @@ -2387,7 +2341,7 @@ gtk_widget_set_sensitive (w, FALSE); if (utf8_label) g_free (utf8_label); } - else if (xg_separator_p (item->name)) + else if (menu_separator_name_p (item->name)) { group = NULL; /* GTK only have one separator type. */ @@ -2499,7 +2453,7 @@ static const char * xg_get_menu_item_label (GtkMenuItem *witem) { - GtkLabel *wlabel = GTK_LABEL (gtk_bin_get_child (GTK_BIN (witem))); + GtkLabel *wlabel = GTK_LABEL (XG_BIN_CHILD (witem)); return gtk_label_get_label (wlabel); } @@ -2652,7 +2606,7 @@ Rename X to B (minibuf to C-mode menu). If the X menu hasn't been invoked, the menu under B is up to date when leaving the minibuffer. */ - GtkLabel *wlabel = GTK_LABEL (gtk_bin_get_child (GTK_BIN (witem))); + GtkLabel *wlabel = GTK_LABEL (XG_BIN_CHILD (witem)); char *utf8_label = get_utf8_string (val->name); GtkWidget *submenu = gtk_menu_item_get_submenu (witem); @@ -2751,7 +2705,7 @@ const char *old_key = 0; xg_menu_item_cb_data *cb_data; - wchild = gtk_bin_get_child (GTK_BIN (w)); + wchild = XG_BIN_CHILD (w); utf8_label = get_utf8_string (val->name); utf8_key = get_utf8_string (val->key); @@ -2910,7 +2864,7 @@ if (GTK_IS_SEPARATOR_MENU_ITEM (w)) { - if (! xg_separator_p (cur->name)) + if (! menu_separator_name_p (cur->name)) break; } else if (GTK_IS_CHECK_MENU_ITEM (w)) @@ -2933,7 +2887,7 @@ GtkWidget *sub; if (cur->button_type != BUTTON_TYPE_NONE || - xg_separator_p (cur->name)) + menu_separator_name_p (cur->name)) break; xg_update_menu_item (cur, w, select_cb, highlight_cb, cl_data); @@ -3725,9 +3679,8 @@ static gboolean xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data) { - GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (toolitem)); - GtkButton *wbutton = GTK_BUTTON (gtk_bin_get_child (GTK_BIN (weventbox))); - GtkWidget *vb = gtk_bin_get_child (GTK_BIN (wbutton)); + GtkButton *wbutton = GTK_BUTTON (XG_BIN_CHILD (XG_BIN_CHILD (toolitem))); + GtkWidget *vb = XG_BIN_CHILD (wbutton); GtkWidget *c1; GtkLabel *wlbl = GTK_LABEL (xg_get_tool_bar_widgets (vb, &c1)); GtkImage *wimage = GTK_IMAGE (c1); @@ -4180,9 +4133,9 @@ int show_label = ! EQ (style, Qimage) && ! (vert_only && horiz); int show_image = ! EQ (style, Qtext); - GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (ti)); - GtkWidget *wbutton = gtk_bin_get_child (GTK_BIN (weventbox)); - GtkWidget *vb = gtk_bin_get_child (GTK_BIN (wbutton)); + GtkWidget *weventbox = XG_BIN_CHILD (ti); + GtkWidget *wbutton = XG_BIN_CHILD (weventbox); + GtkWidget *vb = XG_BIN_CHILD (wbutton); GtkWidget *wimage; GtkWidget *wlbl = xg_get_tool_bar_widgets (vb, &wimage); GtkWidget *new_box = NULL; @@ -4330,7 +4283,6 @@ char *icon_name = NULL; Lisp_Object rtl; GtkWidget *wbutton = NULL; - GtkWidget *weventbox; Lisp_Object specified_file; const char *label = (STRINGP (PROP (TOOL_BAR_ITEM_LABEL)) ? SSDATA (PROP (TOOL_BAR_ITEM_LABEL)) : ""); @@ -4338,16 +4290,34 @@ ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i); + /* If this is a separator, use a gtk separator item. */ + if (EQ (PROP (TOOL_BAR_ITEM_TYPE), Qt)) + { + if (ti == NULL || !GTK_IS_SEPARATOR_TOOL_ITEM (ti)) + { + if (ti) + gtk_container_remove (GTK_CONTAINER (wtoolbar), + GTK_WIDGET (ti)); + ti = gtk_separator_tool_item_new (); + gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, i); + } + gtk_widget_show (GTK_WIDGET (ti)); + continue; + } + + /* Otherwise, the tool-bar item is an ordinary button. */ + + if (ti && GTK_IS_SEPARATOR_TOOL_ITEM (ti)) + { + gtk_container_remove (GTK_CONTAINER (wtoolbar), GTK_WIDGET (ti)); + ti = NULL; + } + if (ti) - { - weventbox = gtk_bin_get_child (GTK_BIN (ti)); - wbutton = gtk_bin_get_child (GTK_BIN (weventbox)); - } - - + wbutton = XG_BIN_CHILD (XG_BIN_CHILD (ti)); + + /* Ignore invalid image specifications. */ image = PROP (TOOL_BAR_ITEM_IMAGES); - - /* Ignore invalid image specifications. */ if (!valid_image_p (image)) { if (wbutton) gtk_widget_hide (wbutton); @@ -4426,7 +4396,7 @@ { /* Insert an empty (non-image) button */ ti = xg_make_tool_item (f, NULL, NULL, "", i, 0); - gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1); + gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, i); } continue; } @@ -4460,17 +4430,17 @@ gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); ti = xg_make_tool_item (f, w, &wbutton, label, i, vert_only); - gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1); + gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, i); gtk_widget_set_sensitive (wbutton, enabled_p); } else { - GtkWidget *vb = gtk_bin_get_child (GTK_BIN (wbutton)); + GtkWidget *vb = XG_BIN_CHILD (wbutton); GtkWidget *wimage; GtkWidget *wlbl = xg_get_tool_bar_widgets (vb, &wimage); - Pixmap old_img = (Pixmap)g_object_get_data (G_OBJECT (wimage), - XG_TOOL_BAR_IMAGE_DATA); + Pixmap old_img = (Pixmap) g_object_get_data (G_OBJECT (wimage), + XG_TOOL_BAR_IMAGE_DATA); gpointer old_stock_name = g_object_get_data (G_OBJECT (wimage), XG_TOOL_BAR_STOCK_NAME); gpointer old_icon_name = g_object_get_data (G_OBJECT (wimage), === modified file 'src/keyboard.c' --- src/keyboard.c 2010-12-13 15:27:36 +0000 +++ src/keyboard.c 2010-12-17 04:04:06 +0000 @@ -7464,6 +7464,54 @@ static Lisp_Object menu_bar_items_vector; static int menu_bar_items_index; + +static const char* separator_names[] = { + "space", + "no-line", + "single-line", + "double-line", + "single-dashed-line", + "double-dashed-line", + "shadow-etched-in", + "shadow-etched-out", + "shadow-etched-in-dash", + "shadow-etched-out-dash", + "shadow-double-etched-in", + "shadow-double-etched-out", + "shadow-double-etched-in-dash", + "shadow-double-etched-out-dash", + 0, +}; + +/* Return non-zero if LABEL specifies a separator. */ + +int +menu_separator_name_p (const char *label) +{ + if (!label) + return 0; + else if (strlen (label) > 3 + && strncmp (label, "--", 2) == 0 + && label[2] != '-') + { + int i; + label += 2; + for (i = 0; separator_names[i]; ++i) + if (strcmp (label, separator_names[i]) == 0) + return 1; + } + else + { + /* It's a separator if it contains only dashes. */ + while (*label == '-') + ++label; + return (*label == 0); + } + + return 0; +} + + /* Return a vector of menu items for a menu bar, appropriate to the current buffer. Each item has three elements in the vector: KEY STRING MAPLIST. @@ -8201,10 +8249,14 @@ Rule out items that aren't lists, don't start with `menu-item' or whose rest following `tool-bar-item' is not a list. */ - if (!CONSP (item) - || !EQ (XCAR (item), Qmenu_item) - || (item = XCDR (item), - !CONSP (item))) + if (!CONSP (item)) + return 0; + + /* As an exception, allow old-style menu separators. */ + if (STRINGP (XCAR (item))) + item = Fcons (XCAR (item), Qnil); + else if (!EQ (XCAR (item), Qmenu_item) + || (item = XCDR (item), !CONSP (item))) return 0; /* Create tool_bar_item_properties vector if necessary. Reset it to @@ -8234,10 +8286,18 @@ } PROP (TOOL_BAR_ITEM_CAPTION) = caption; - /* Give up if rest following the caption is not a list. */ + /* If the rest following the caption is not a list, the menu item is + either a separator, or invalid. */ item = XCDR (item); if (!CONSP (item)) - return 0; + { + if (menu_separator_name_p (SDATA (caption))) + { + PROP (TOOL_BAR_ITEM_TYPE) = Qt; + return 1; + } + return 0; + } /* Store the binding. */ PROP (TOOL_BAR_ITEM_BINDING) = XCAR (item); @@ -8270,10 +8330,10 @@ if (NILP (menu_item_eval_property (value))) return 0; } - else if (EQ (key, QChelp)) + else if (EQ (key, QChelp)) /* `:help HELP-STRING'. */ PROP (TOOL_BAR_ITEM_HELP) = value; - else if (EQ (key, QCvert_only)) + else if (EQ (key, QCvert_only)) /* `:vert-only t/nil'. */ PROP (TOOL_BAR_ITEM_VERT_ONLY) = value; else if (EQ (key, QClabel)) === modified file 'src/keyboard.h' --- src/keyboard.h 2010-11-18 16:57:00 +0000 +++ src/keyboard.h 2010-12-17 04:04:06 +0000 @@ -492,6 +492,7 @@ extern int timers_run; +extern int menu_separator_name_p (const char *); extern int parse_menu_item (Lisp_Object, int); extern void echo_now (void); === modified file 'src/nsmenu.m' --- src/nsmenu.m 2010-12-02 09:33:57 +0000 +++ src/nsmenu.m 2010-12-17 04:04:06 +0000 @@ -507,21 +507,6 @@ } -/* Utility (from macmenu.c): is this item a separator? */ -static int -name_is_separator ( const char *name) -{ - const char *start = name; - - /* Check if name string consists of only dashes ('-'). */ - while (*name == '-') name++; - /* Separators can also be of the form "--:TripleSuperMegaEtched" - or "--deep-shadow". We don't implement them yet, se we just treat - them like normal separators. */ - return (*name == '\0' || start + 2 == name); -} - - /* ========================================================================== Menu: class implementation @@ -624,7 +609,7 @@ NSMenuItem *item; widget_value *wv = (widget_value *)wvptr; - if (name_is_separator (wv->name)) + if (menu_separator_name_p (wv->name)) { item = [NSMenuItem separatorItem]; [self addItem: item]; === modified file 'src/w32menu.c' --- src/w32menu.c 2010-10-14 14:32:27 +0000 +++ src/w32menu.c 2010-12-17 04:04:06 +0000 @@ -1326,20 +1326,6 @@ #endif /* !HAVE_DIALOGS */ -/* Is this item a separator? */ -static int -name_is_separator (const char *name) -{ - const char *start = name; - - /* Check if name string consists of only dashes ('-'). */ - while (*name == '-') name++; - /* Separators can also be of the form "--:TripleSuperMegaEtched" - or "--deep-shadow". We don't implement them yet, se we just treat - them like normal separators. */ - return (*name == '\0' || start + 2 == name); -} - /* UTF8: 0xxxxxxx, 110xxxxx 10xxxxxx, 1110xxxx, 10xxxxxx, 10xxxxxx */ static void utf8to16 (unsigned char * src, int len, WCHAR * dest) @@ -1388,7 +1374,7 @@ int return_value; size_t nlen, orig_len; - if (name_is_separator (wv->name)) + if (menu_separator_name_p (wv->name)) { fuFlags = MF_SEPARATOR; out_string = NULL; === modified file 'src/xdisp.c' --- src/xdisp.c 2010-12-13 15:27:36 +0000 +++ src/xdisp.c 2010-12-17 04:04:06 +0000 @@ -10317,6 +10317,10 @@ int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)); int hmargin, vmargin, relief, idx, end; + /* Ignore separator items. */ + if (EQ (PROP (TOOL_BAR_ITEM_TYPE), Qt)) + continue; + /* If image is a vector, choose the image according to the button state. */ image = PROP (TOOL_BAR_ITEM_IMAGES);