From: Po Lu Date: Sun, 24 Dec 2023 07:21:24 +0000 (+0800) Subject: Introduce a toolbar for Log Edit mode X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b7fc3ab787d8dd926e1912e51e99f0efcf57cb02;p=emacs.git Introduce a toolbar for Log Edit mode * etc/NEWS: Announce new change. * etc/images/README: List the sources of the new image files. * etc/images/commit.xpm: * etc/images/commit.pbm: * etc/images/gen-changelog.xpm: * etc/images/gen-changelog.pbm: * etc/images/ins-changelog.xpm: * etc/images/ins-changelog.pbm: * etc/images/load-changelog.xpm: * etc/images/load-changelog.pbm: * etc/images/view-diff.xpm: New files. * lisp/vc/log-edit.el (log-edit-menu): Insert a menu item for "Generate ChangeLog". (log-edit-tool-bar-map): New keymap. (log-edit-mode): Install this keymap as the tool bar map. --- diff --git a/etc/NEWS b/etc/NEWS index 6df17aa3f0a..f82564946b7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -468,6 +468,11 @@ you can add this to your init script: ** VC +--- +*** Log-Edit buffers now display a tool bar. +This tool bar contains items for committing log entries and editing or +generating log entries, among other editing operations. + --- *** New user option 'vc-git-shortlog-switches'. This is a string or a list of strings that specifies the Git log diff --git a/etc/images/README b/etc/images/README index 5886f641536..71115540344 100644 --- a/etc/images/README +++ b/etc/images/README @@ -67,21 +67,25 @@ Emacs images and their source in the GNOME icons stock/ directory: attach.xpm document/stock_attach bookmark_add.xpm actions/bookmark_add cancel.xpm slightly modified generic/stock_stop - connect.xpm net/stock_connect + commit.xpm code/stock_run connect-to-url.xpm net/stock_connect-to-url + connect.xpm net/stock_connect contact.xpm net/stock_contact data-save.xpm data/stock_data-save delete.xpm generic/stock_delete describe.xpm generic/stock_properties disconnect.xpm net/stock_disconnect exit.xpm generic/stock_exit + gen-changelog.xpm text/stock_autoformat + ins-changelog.xpm form/stock_show-form-dialog + load-changelog.xpm text/stock_insert_endnote lock-broken.xpm data/stock_lock-broken lock-ok.xpm data/stock_lock-ok lock.xpm data/stock_lock - redo.xpm generic/stock_redo - search-replace.xpm slightly modified generic/stock_search-and-replace next-page.xpm navigation/stock_next-page + redo.xpm generic/stock_redo refresh.xpm generic/stock_refresh + search-replace.xpm slightly modified generic/stock_search-and-replace separator.xpm ? show.xpm slightly modified document/stock_new sort-ascending.xpm slightly modified data/stock_sort-ascending @@ -89,6 +93,7 @@ Emacs images and their source in the GNOME icons stock/ directory: sort-criteria.xpm data/stock_sort-criteria sort-descending.xpm slightly modified data/stock_sort-descending sort-row-ascending.xpm data/stock_sort-row-ascending + view-diff.xpm text/stock_list_enum-restart zoom-in.xpm navigation/stock_zoom-in zoom-out.xpm navigation/stock_zoom-out diff --git a/etc/images/commit.pbm b/etc/images/commit.pbm new file mode 100644 index 00000000000..11fe690ac1b Binary files /dev/null and b/etc/images/commit.pbm differ diff --git a/etc/images/commit.xpm b/etc/images/commit.xpm new file mode 100644 index 00000000000..1730f155811 --- /dev/null +++ b/etc/images/commit.xpm @@ -0,0 +1,101 @@ +/* XPM */ +static char *commit[] = { +/* columns rows colors chars-per-pixel */ +"24 24 71 1 ", +" c None", +". c black", +"X c gray13", +"o c gray14", +"O c #252525", +"+ c gray25", +"@ c gray33", +"# c #555555", +"$ c #565656", +"% c #5A5A5A", +"& c #5D5D5D", +"* c gray40", +"= c #6C6C6C", +"- c #DF421E", +"; c #46A046", +": c #625B81", +"> c #887FA3", +", c #848484", +"< c gray53", +"1 c #888888", +"2 c #8E8E8E", +"3 c #979797", +"4 c #9A9A9A", +"5 c #A0A0A0", +"6 c gray65", +"7 c #A9A9A9", +"8 c #AEAEAE", +"9 c gray75", +"0 c #BBB6CA", +"q c #C2C2C1", +"w c gray76", +"e c #C3C3C2", +"r c #C3C3C3", +"t c gray77", +"y c #C7C7C6", +"u c #C8C8C8", +"i c gray79", +"p c #C5C1D2", +"a c #CAC6D6", +"s c gray84", +"d c #D8D8D8", +"f c gray88", +"g c #E1E1E1", +"h c #E6E6E6", +"j c #EDEDEB", +"k c #EEEEED", +"l c #EFEFEF", +"z c #ECEAF0", +"x c #ECEBF0", +"c c #F0EFF3", +"v c gray94", +"b c #F1F1F0", +"n c #F2F2F1", +"m c #F4F4F3", +"M c #F4F3F6", +"N c #F5F5F4", +"B c gray96", +"V c #F6F6F5", +"C c #F6F6F6", +"Z c gray97", +"A c #F8F8F7", +"S c #F7F6F8", +"D c #F8F8F8", +"F c #F9F9F9", +"G c gray98", +"H c #FCFCFB", +"J c gray99", +"K c #FDFDFC", +"L c #FDFDFD", +"P c #FEFEFE", +"I c white", +/* pixels */ +" ...... ", +" .xx00. ", +" ..xp>>..", +" .Spa>>>.", +"+++++++++## .Mp>>. ", +"IIIIIIIIIGs. ", +"IIIIIIIIIGhv5. .. ", +"IIIIIIIIIGdIB3o ", +"IIIIIIIIIBiIIg1X ", +";:IIIIIIIB9gsiw2 ", +"IIIIIIIIHB7*&#%<. ", +":::G::::GBvsy64=. ", +"GGGGGGGGGGGGGGG8. ", +"--::G:::GGGGGGGw. ", +"GGGGGGGGGGGGGGGy. ", +"::A::AAAAAAAAAAy. ", +"BBBBBBBBBBBBBBBy. ", +"BBBBBBBBBBBBBBBw. ", +":mmmmmmmmmmmmmmw. ", +"vvvvvvvvvvvvvvvw. ", +"---v:v:::v:::vvw. ", +"lllllllllllllllw. ", +"::::l--:lllllllw. ", +"jjjjjjjjjjjjjjjw. " +}; diff --git a/etc/images/gen-changelog.pbm b/etc/images/gen-changelog.pbm new file mode 100644 index 00000000000..40bea125b06 Binary files /dev/null and b/etc/images/gen-changelog.pbm differ diff --git a/etc/images/gen-changelog.xpm b/etc/images/gen-changelog.xpm new file mode 100644 index 00000000000..65ea7c16f04 --- /dev/null +++ b/etc/images/gen-changelog.xpm @@ -0,0 +1,152 @@ +/* XPM */ +static char *gen_changelog[] = { +/* columns rows colors chars-per-pixel */ +"24 24 122 2 ", +" c None", +". c black", +"X c gray10", +"o c #353535", +"O c #442D0E", +"+ c #5E4417", +"@ c #7D5A22", +"# c #645435", +"$ c #464646", +"% c #505050", +"& c gray32", +"* c #535353", +"= c gray33", +"- c #585858", +"; c gray35", +": c #675E46", +"> c gray39", +", c #6E6E6C", +"< c gray43", +"1 c gray44", +"2 c #787775", +"3 c #797979", +"4 c #7B7B7B", +"5 c #88601F", +"6 c #A27E36", +"7 c #9A8558", +"8 c #9F8B5F", +"9 c #A09069", +"0 c #BAA069", +"q c #C7AF7A", +"w c #CCB176", +"e c #868583", +"r c #868686", +"t c gray53", +"y c #8B8A86", +"u c #888888", +"i c #898989", +"p c #8B8B88", +"a c gray54", +"s c #8B8B8B", +"d c #8C8C89", +"f c gray55", +"g c #8D8D8D", +"h c #8E8E8E", +"j c gray56", +"k c #909090", +"l c gray57", +"z c #929292", +"x c #939393", +"c c #969592", +"v c gray58", +"b c #959595", +"n c #979797", +"m c #9B9996", +"M c #9C9B97", +"N c #B8B39B", +"B c #A4A4A4", +"V c gray65", +"C c #A8A7A3", +"Z c #AAAAAA", +"A c #B0AFAC", +"S c gray70", +"D c #B4B4B4", +"F c #B6B6B6", +"G c #C0BFBD", +"H c #D6C08E", +"J c #D9C28B", +"K c #DEC58D", +"L c #D8C291", +"P c #DFCA96", +"I c #E1CC99", +"U c #C2C1BD", +"Y c #F3E5BE", +"T c #C5C5C5", +"R c #C6C6C6", +"E c gray79", +"W c #CACACA", +"Q c gray80", +"! c #CECECE", +"~ c #D2D0D0", +"^ c #DBDAD8", +"/ c gray86", +"( c gainsboro", +") c #DDDDDD", +"_ c #F4E7C2", +"` c #EBE8D3", +"' c gray88", +"] c #E1E1E1", +"[ c #E2E2E2", +"{ c gray89", +"} c #E4E4E4", +"| c gray90", +" . c #E6E6E6", +".. c #E7E7E7", +"X. c #EAE8E3", +"o. c gray91", +"O. c #E9E9E9", +"+. c #EAEAEA", +"@. c gray92", +"#. c #EFEDE9", +"$. c #ECECEC", +"%. c gray93", +"&. c #EEEEEE", +"*. c #EFEFEF", +"=. c #FEFCE8", +"-. c #FEFEED", +";. c gray94", +":. c #F1F1F1", +">. c gray95", +",. c #F3F3F3", +"<. c #F4F4F4", +"1. c gray96", +"2. c #F6F6F6", +"3. c gray97", +"4. c #F8F8F8", +"5. c #F9F9F9", +"6. c gray98", +"7. c #FBFBFB", +"8. c gray99", +"9. c #FDFDFD", +"0. c #FEFEFE", +"q. c white", +/* pixels */ +" . . . . . . . . . . . . . . . . . . . . ", +". [ >.>.>.>.>.>.>.<.<.<.<.<.<.<.<.<.<.<.) . ", +". >.[ [ [ [ [ } } } } o.o.o.o.o.$.$.$.$.$.. ", +". >.[ r r r r i i ; . & i o.o.$.$.$.$.>.>.. ", +". >.[ [ [ } } } [ . N . [ $.$.$.$.$.>.>.>.. ", +". >.[ r i i i i < . ` . = g g g g >.>.>.>.. ", +". >.} } } } } 3 . . -.. . 3 o.>.>.>.>.>.<.. ", +". >.} i i ; . . : _ =.6 # . . D >.>.>.<.<.. ", +". <.} } o.. 7 q J P Y w I K 8 . T <.<.<.<.. ", +". <.} i i & . . O @ 0 5 + . . n <.<.<.<.<.. ", +". <.o.o.o.o.[ k . . H . X $ . <.<.<.<.<.4.. ", +". <.o.i g g g g > . L . ; d C . <.<.4.4.4.. ", +". <.o.$.$.$.$.$.o.. 9 o . 2 G U . 4.4.4.4.. ", +". <.o.g g g g g g & . 1 T . i ~ C . 4.4.9.. ", +". <.$.$.$.$.>.>.>.>.T ) T T . M ^ A . 9.9.. ", +". <.$.g g g g k >.<.<.<.) ) S . C #.c . 9.. ", +". 4.>.>.>.>.>.<.<.<.<.4.4.[ E D . M X.e . . ", +". 4.>.k k k k k k k k n n n [ Q B . m X.< . ", +". >.>.<.<.<.<.<.<.4.4.4.4.9.9.} Q B . c X.2 . ", +". E $.4.<.<.<.4.4.4.4.4.9.9.9.9.} Q Z . y X.2 . ", +" . . . . . . . . . . . . . . . . . . . . y X.. ", +" . . ", +" ", +" " +}; diff --git a/etc/images/ins-changelog.pbm b/etc/images/ins-changelog.pbm new file mode 100644 index 00000000000..fb97cf7d5d8 --- /dev/null +++ b/etc/images/ins-changelog.pbm @@ -0,0 +1,3 @@ +P4 +24 24 +ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿàÿàÿàÿçÿàÿçóÿàÿçóÿàÿçóÿàÿçóÿàÿàÿÿÿÿÿÿ \ No newline at end of file diff --git a/etc/images/ins-changelog.xpm b/etc/images/ins-changelog.xpm new file mode 100644 index 00000000000..24deee3c344 --- /dev/null +++ b/etc/images/ins-changelog.xpm @@ -0,0 +1,67 @@ +/* XPM */ +static char *ins_changelog[] = { +/* columns rows colors chars-per-pixel */ +"24 24 37 1 ", +" c None", +". c black", +"X c #161616", +"o c gray25", +"O c #4B4B49", +"+ c #5D5D5D", +"@ c #494066", +"# c #767676", +"$ c gray52", +"% c #A0A0A0", +"& c gray66", +"* c gray68", +"= c #BBBBBB", +"- c #BCBCBC", +"; c gray74", +": c #C1C1C1", +"> c gray76", +", c #C3C3C3", +"< c gray88", +"1 c #E2E2E2", +"2 c gray89", +"3 c #E4E4E4", +"4 c gray90", +"5 c #E6E6E6", +"6 c #E7E7E7", +"7 c gray91", +"8 c #EAEAEA", +"9 c gray92", +"0 c #ECECEC", +"q c gray93", +"w c #EEEEEE", +"e c #EFEFEF", +"r c gray94", +"t c #F1F1F1", +"y c #FBFBFB", +"u c #FDFDFD", +"i c #FEFEFE", +/* pixels */ +" ", +" ", +" @ @@ @@ @@ @@ ", +" @ ", +" @ ", +" @ @ ", +" @ ", +" ......... ", +" @ .iiiiiii2>. ", +" @ .itttttt>y&. ", +" .itttttt*#+o. ", +" @ .it@@@@t2$OX. ", +" @ .iteeeeeeee=. ", +" .ie@@@@@@@e=. ", +" @ .ieeeeeeee9=. ", +" @ .ie@@@@@@@9=. ", +" .i999999499=. ", +" @@ @@ @@.i9@@@@@@@4=. ", +" .i944444444=. ", +" .i4@@@@@@@4=. ", +" .i444444222=. ", +" .>-----====%. ", +" ........... ", +" " +}; diff --git a/etc/images/load-changelog.pbm b/etc/images/load-changelog.pbm new file mode 100644 index 00000000000..43f1a1b221f Binary files /dev/null and b/etc/images/load-changelog.pbm differ diff --git a/etc/images/load-changelog.xpm b/etc/images/load-changelog.xpm new file mode 100644 index 00000000000..6d317b6afa2 --- /dev/null +++ b/etc/images/load-changelog.xpm @@ -0,0 +1,82 @@ +/* XPM */ +static char *load_changelog[] = { +/* columns rows colors chars-per-pixel */ +"24 24 52 1 ", +" c None", +". c black", +"X c #434343", +"o c gray33", +"O c #DF421E", +"+ c #8B8B8B", +"@ c gray55", +"# c #8D8D8D", +"$ c #8E8E8E", +"% c gray56", +"& c #909090", +"* c gray57", +"= c #929292", +"- c #939393", +"; c gray58", +": c #959595", +"> c gray66", +", c #B7B7B7", +"< c gray74", +"1 c #C0C0C0", +"2 c gray79", +"3 c #CACACA", +"4 c gray84", +"5 c gray85", +"6 c #DADADA", +"7 c #DDDDDD", +"8 c #DFDFDF", +"9 c gray90", +"0 c gray91", +"q c #E9E9E9", +"w c #EAEAEA", +"e c gray92", +"r c #ECECEC", +"t c gray93", +"y c #EEEEEE", +"u c #EFEFEF", +"i c gray94", +"p c #F1F1F1", +"a c gray95", +"s c #F3F3F3", +"d c #F4F4F4", +"f c gray96", +"g c #F6F6F6", +"h c gray97", +"j c #F8F8F8", +"k c #F9F9F9", +"l c gray98", +"z c #FBFBFB", +"x c gray99", +"c c #FDFDFD", +"v c #FEFEFE", +"b c white", +/* pixels */ +" .. .. .. .. ", +" .d3..51..7>..d,.. ", +" .d00tttttiiiiddd4. ", +" .d0+$$$$$$&&&$jjt. ", +" .d00ttiiiidddjjX5. ", +" .d0$$$&9OOOOcjj........", +" .dttiiidddddjjjo7. .", +" .dttiiiddddddjjc5. .", +" .jiidddddjjjcccc7. .", +" .ji&&&&&&;;;;;cc7. .", +" .jiiiddddjjjjccc7. .", +" .ji&&&&&;;;;cccc7. .", +" .iiidddjjjjccccct. .", +" .3tjdjjjjjccccct<. .", +" ................ .", +" .", +" .", +" . .", +" .. .", +" OOOOOOOOOOOOO ......", +" OOOOOOOOOOOOO .. ", +" . ", +" ", +" " +}; diff --git a/etc/images/view-diff.pbm b/etc/images/view-diff.pbm new file mode 100644 index 00000000000..35aabdabb1e Binary files /dev/null and b/etc/images/view-diff.pbm differ diff --git a/etc/images/view-diff.xpm b/etc/images/view-diff.xpm new file mode 100644 index 00000000000..3ebd0b3002b --- /dev/null +++ b/etc/images/view-diff.xpm @@ -0,0 +1,93 @@ +/* XPM */ +static char *view_diff[] = { +/* columns rows colors chars-per-pixel */ +"24 24 63 1 ", +" c None", +". c black", +"X c gray43", +"o c #6F6F6F", +"O c gray44", +"+ c #717171", +"@ c #727272", +"# c gray45", +"$ c #747474", +"% c gray46", +"& c #767676", +"* c #777777", +"= c gray47", +"- c #DF421E", +"; c #E3846E", +": c #838383", +"> c gray74", +", c #E19989", +"< c #E29A8A", +"1 c #E39B8B", +"2 c #E59C8B", +"3 c #E49C8C", +"4 c #E4AB9E", +"5 c #E8AEA1", +"6 c #C5C5C5", +"7 c gray79", +"8 c gray81", +"9 c #DADADA", +"0 c gray86", +"q c #DDDDDD", +"w c #EAD4CE", +"e c gray88", +"r c #E1E1E1", +"t c #E2E2E2", +"y c gray89", +"u c #E4E4E4", +"i c gray90", +"p c #E6E6E6", +"a c #E7E7E7", +"s c gray91", +"d c #E9E9E9", +"f c #EAEAEA", +"g c gray92", +"h c #ECECEC", +"j c gray93", +"k c #EEEEEE", +"l c #EFEFEF", +"z c gray94", +"x c #F1F1F1", +"c c gray95", +"v c #F3F3F3", +"b c #F4F4F4", +"n c gray96", +"m c #F6F6F6", +"M c gray97", +"N c #F8F8F8", +"B c #F9F9F9", +"V c gray98", +"C c #FBFBFB", +"Z c gray99", +"A c #FDFDFD", +"S c #FEFEFE", +"D c white", +/* pixels */ +" .................... ", +".tcccccccbbbbbbbbbbbq. ", +".ctttttiiiidddddhhhhh. ", +".ctttti8Xidddddhhhhcc. ", +".cttti8XXdd+++++++ccc. ", +".ctiiiiiXddhhhhhhcccc. ", +".c,---id+dd++++++$ccb. ", +".ci,--dd+dhhhhchcccbb. ", +".bi-,-dddhh+++$cbcbbb. ", +".b-4d3dhhhhhccccbbbbb. ", +".b-ddhhhhhhccccbbbNNN. ", +".b-ddhhhhccccbbbbNNNN. ", +".b;-whh6$0cccbbbbNNNN. ", +".bd2-5h+c$b:$$$$$=NNZ. ", +".bhhhhccq$bbbbbNNNNZZ. ", +".bhhhcc0$qb$$$$==NZZZ. ", +".Nccccc$$$bNNNNNZZZZZ. ", +".NcccbbbbbNNNZZZZZZZZ. ", +".ccbbbbbbNNNZZZZZZZZh. ", +".7hNbbbNNNNNZZZZZZZh>. ", +" .................... ", +" ", +" ", +" " +}; diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index 39e0799ba73..c2665c802f6 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el @@ -76,6 +76,8 @@ "--" ["Insert ChangeLog" log-edit-insert-changelog :help "Insert a log message by looking at the ChangeLog"] + ["Generate ChangeLog" log-edit-generate-changelog-from-diff + :help "Generate a log message from the diff and insert it into this buffer"] ["Add to ChangeLog" log-edit-add-to-changelog :help "Insert this log message into the appropriate ChangeLog file"] "--" @@ -93,6 +95,65 @@ ["Search comment backward" log-edit-comment-search-backward :help "Search backwards through comment history for substring match of str"])) +(defvar log-edit-tool-bar-map + (let ((map (make-sparse-keymap))) + (tool-bar-local-item-from-menu 'find-file "new" map + nil :label "New File" + :vert-only t) + (tool-bar-local-item-from-menu 'menu-find-file-existing "open" map + nil :label "Open" :vert-only t) + (tool-bar-local-item-from-menu 'dired "diropen" map nil :vert-only t) + (tool-bar-local-item-from-menu 'kill-this-buffer "close" map nil + :vert-only t) + (define-key-after map [separator-1] menu-bar-separator) + (tool-bar-local-item-from-menu 'log-edit-done "commit" + map log-edit-mode-map :vert-only t + :help + "Complete the actual action") + (define-key-after map [separator-2] menu-bar-separator) + (tool-bar-local-item-from-menu 'log-edit-insert-changelog + "ins-changelog" + map log-edit-mode-map :vert-only t + :help + "Complete the actual action") + (tool-bar-local-item-from-menu 'log-edit-insert-changelog + "load-changelog" + map log-edit-mode-map :vert-only t + :help + "Insert log message from ChangeLog file") + (tool-bar-local-item-from-menu 'log-edit-generate-changelog-from-diff + "gen-changelog" + map log-edit-mode-map :vert-only t + :help + "Generate a log message from diff") + (tool-bar-local-item-from-menu 'log-edit-add-to-changelog + "ins-changelog" + map log-edit-mode-map :vert-only t + :help + "Insert this log message into the ChangeLog") + (define-key-after map [separator-3] menu-bar-separator) + (tool-bar-local-item-from-menu 'log-edit-show-diff + "view-diff" + map log-edit-mode-map :vert-only t + :help + "View the diff for the files to be committed") + (tool-bar-local-item-from-menu 'log-edit-show-files + "info" + map log-edit-mode-map :vert-only t + :help + "View the list of files to be committed") + (define-key-after map [separator-4] menu-bar-separator) + (tool-bar-local-item-from-menu 'undo "undo" map nil) + (define-key-after map [separator-5] menu-bar-separator) + (tool-bar-local-item-from-menu (lookup-key menu-bar-edit-menu [cut]) + "cut" map nil) + (tool-bar-local-item-from-menu (lookup-key menu-bar-edit-menu [copy]) + "copy" map nil) + (tool-bar-local-item-from-menu (lookup-key menu-bar-edit-menu [paste]) + "paste" map nil) + map) + "Like the default `tool-bar-map', but with additions for Log-Edit mode.") + (defcustom log-edit-confirm 'changed "If non-nil, `log-edit-done' will request confirmation. If `changed', only request confirmation if the list of files has @@ -511,7 +572,9 @@ the \\[vc-prefix-map] prefix for VC commands, for example). (setq-local fill-paragraph-function #'log-edit-fill-entry) (make-local-variable 'log-edit-comment-ring-index) (add-hook 'kill-buffer-hook 'log-edit-remember-comment nil t) - (hack-dir-local-variables-non-file-buffer)) + (hack-dir-local-variables-non-file-buffer) + ;; Replace the tool bar map with `log-edit-tool-bar-map'. + (setq-local tool-bar-map log-edit-tool-bar-map)) (defun log-edit--insert-filled-defuns (func-names) "Insert FUNC-NAMES, following ChangeLog formatting."