[LyX/master] Implement buffer-write force

Juergen Spitzmueller spitz at lyx.org
Tue Mar 31 05:41:19 UTC 2020


commit fe09ddf1b9c7ccbc0ba86b35f9a1bfe93791d639
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Tue Mar 31 08:01:17 2020 +0200

    Implement buffer-write force
---
 lib/bind/cua.bind            |    2 +-
 lib/bind/emacs.bind          |    4 ++--
 lib/bind/mac.bind            |    2 +-
 lib/bind/xemacs.bind         |    2 +-
 src/LyXAction.cpp            |    3 ++-
 src/frontends/qt/GuiView.cpp |    4 +++-
 6 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/lib/bind/cua.bind b/lib/bind/cua.bind
index 31a493b..918ca02 100644
--- a/lib/bind/cua.bind
+++ b/lib/bind/cua.bind
@@ -105,7 +105,7 @@ Format 5
 
 #bind "F1"			"help"			# Not yet implemented!
 #bind "C-F1"			"help-context"		# Not yet implemented!
-\bind "F2"			"buffer-write"
+\bind "F2"			"buffer-write force"
 \bind "F3"			"word-find"
 \bind "C-F4"			"buffer-close"
 \bind "M-F4"			"lyx-quit"
diff --git a/lib/bind/emacs.bind b/lib/bind/emacs.bind
index 60f849b..e7c587d 100644
--- a/lib/bind/emacs.bind
+++ b/lib/bind/emacs.bind
@@ -136,8 +136,8 @@ Format 4
 
 #bind "F1"                     "help"                          # Not yet implemented!
 #bind "C-F1"                   "help-context"                  # Not yet implemented!
-#\bind "F2"                     "buffer-write"
-#\bind "F3"                     "file-open"
+\bind "F2"                     "buffer-write force"
+#\bind "F3"                    "file-open"
 #bind "F4"                     "------"
 #bind "F5"                     "------"
 #bind "F6"                     "------"
diff --git a/lib/bind/mac.bind b/lib/bind/mac.bind
index bceea69..0d7459f 100644
--- a/lib/bind/mac.bind
+++ b/lib/bind/mac.bind
@@ -271,7 +271,7 @@ Format 4
 
 #bind "F1"                           "help"         # Not yet implemented!
 #bind "C-F1"                         "help-context" # Not yet implemented!
-\bind "F2"                           "buffer-write"
+\bind "F2"                           "buffer-write force"
 \bind "C-F4"                         "buffer-close"
 \bind "C-A-Up"                       "scroll line up"
 \bind "C-A-Down"                     "scroll line down"
diff --git a/lib/bind/xemacs.bind b/lib/bind/xemacs.bind
index 776f5d5..13decd3 100644
--- a/lib/bind/xemacs.bind
+++ b/lib/bind/xemacs.bind
@@ -130,7 +130,7 @@ Format 4
 
 #bind "F1"                     "help"                          # Not yet implemented!
 #bind "C-F1"                   "help-context"                  # Not yet implemented!
-#\bind "F2"                     "buffer-write"
+\bind "F2"                     "buffer-write force"
 #\bind "F3"                     "file-open"
 #bind "F4"                     "------"
 #bind "F5"                     "------"
diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
index a9789ad..6089e5e 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -892,7 +892,8 @@ void LyXAction::init()
  * \li Notion: Saves the current buffer to disk, using the filename that
                is already associated with the buffer, asking for one if
                none is yet assigned.
- * \li Syntax: buffer-write
+ * \li Syntax: buffer-write [force]
+ * \li Params: force: write even if buffer is clean.
  * \endvar
  */
 		{ LFUN_BUFFER_WRITE, "buffer-write", ReadOnly, Buffer },
diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index c7a1bd9..78e0817 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -1996,7 +1996,9 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
 	}
 
 	case LFUN_BUFFER_WRITE:
-		enable = doc_buffer && (doc_buffer->isUnnamed() || !doc_buffer->isClean());
+		enable = doc_buffer && (doc_buffer->isUnnamed()
+					|| (!doc_buffer->isClean()
+					    || cmd.argument() == "force"));
 		break;
 
 	//FIXME: This LFUN should be moved to GuiApplication.


More information about the lyx-cvs mailing list