X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/72c20d0be811966afccdb7551d3341d10d3be9a9..7b45cc583c4f16cc070a9925431ca944f510a685:/lisp/menu-bar.el diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index fe2b6a6681..cc7233e193 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1,6 +1,6 @@ ;;; menu-bar.el --- define a default menu bar -;; Copyright (C) 1993-1995, 2000-2015 Free Software Foundation, Inc. +;; Copyright (C) 1993-1995, 2000-2016 Free Software Foundation, Inc. ;; Author: Richard M. Stallman ;; Maintainer: emacs-devel@gnu.org @@ -244,7 +244,7 @@ (setq menu-bar-last-search-type 'string) ;; Ideally, this whole command would be equivalent to `C-s RET'. (let ((isearch-forward (not backward)) - (isearch-regexp-function search-default-regexp-mode) + (isearch-regexp-function search-default-mode) (isearch-regexp nil)) (if (or (equal string "") (not string)) (funcall (isearch-search-fun-default) (car search-ring)) @@ -535,19 +535,25 @@ (defun clipboard-yank () "Insert the clipboard contents, or the last stretch of killed text." (interactive "*") - (let ((gui-select-enable-clipboard t)) + (let ((gui-select-enable-clipboard t) + (interprogram-paste-function (or interprogram-paste-function + #'gui-selection-value))) (yank))) (defun clipboard-kill-ring-save (beg end &optional region) "Copy region to kill ring, and save in the GUI's clipboard." (interactive "r\np") - (let ((gui-select-enable-clipboard t)) + (let ((gui-select-enable-clipboard t) + (interprogram-cut-function (or interprogram-cut-function + #'gui-select-text))) (kill-ring-save beg end region))) (defun clipboard-kill-region (beg end &optional region) "Kill the region, and save it in the GUI's clipboard." (interactive "r\np") - (let ((gui-select-enable-clipboard t)) + (let ((gui-select-enable-clipboard t) + (interprogram-cut-function (or interprogram-cut-function + #'gui-select-text))) (kill-region beg end region))) (defun menu-bar-enable-clipboard () @@ -1250,6 +1256,52 @@ mail status in mode line")) :enable (not (truncated-partial-width-window-p)))) menu)) +(defvar menu-bar-search-options-menu + (let ((menu (make-sparse-keymap "Search Options"))) + + (dolist (x '((character-fold-to-regexp "Fold Characters" "Character folding") + (isearch-symbol-regexp "Whole Symbols" "Whole symbol") + (word-search-regexp "Whole Words" "Whole word"))) + (bindings--define-key menu (vector (nth 0 x)) + `(menu-item ,(nth 1 x) + (lambda () + (interactive) + (setq search-default-mode #',(nth 0 x)) + (message ,(format "%s search enabled" (nth 2 x)))) + :help ,(format "Enable %s search" (downcase (nth 2 x))) + :button (:radio . (eq search-default-mode #',(nth 0 x)))))) + + (bindings--define-key menu [regexp-search] + '(menu-item "Regular Expression" + (lambda () + (interactive) + (setq search-default-mode t) + (message "Regular-expression search enabled")) + :help "Enable regular-expression search" + :button (:radio . (eq search-default-mode t)))) + + (bindings--define-key menu [regular-search] + '(menu-item "Literal Search" + (lambda () + (interactive) + (when search-default-mode + (setq search-default-mode nil) + (when (symbolp search-default-mode) + (message "Literal search enabled")))) + :help "Disable special search modes" + :button (:radio . (not search-default-mode)))) + + (bindings--define-key menu [custom-separator] + menu-bar-separator) + (bindings--define-key menu [case-fold-search] + (menu-bar-make-toggle + toggle-case-fold-search case-fold-search + "Ignore Case" + "Case-Insensitive Search %s" + "Ignore letter-case in search commands")) + + menu)) + (defvar menu-bar-options-menu (let ((menu (make-sparse-keymap "Options"))) (bindings--define-key menu [customize] @@ -1361,12 +1413,9 @@ mail status in mode line")) (:visible (and (boundp 'cua-enable-cua-keys) (not cua-enable-cua-keys))))) - (bindings--define-key menu [case-fold-search] - (menu-bar-make-toggle - toggle-case-fold-search case-fold-search - "Ignore Case for Search" - "Case-Insensitive Search %s" - "Ignore letter-case in search commands")) + (bindings--define-key menu [search-options] + `(menu-item "Default Search Options" + ,menu-bar-search-options-menu)) (bindings--define-key menu [line-wrapping] `(menu-item "Line Wrapping in This Buffer"