Source

hm--html-menus / hm--html-menu.el

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
;;;  hm--html-menu ---  A menu for the hm--html-mode.
;;;  
;;;  $Id$
;;;
;;;  Copyright (C) 1993 - 1998  Heiko Muenkel
;;;  email: muenkel@tnt.uni-hannover.de
;;;
;;;  This program is free software; you can redistribute it and/or modify
;;;  it under the terms of the GNU General Public License as published by
;;;  the Free Software Foundation; either version 2, or (at your option)
;;;  any later version.
;;;
;;;  This program is distributed in the hope that it will be useful,
;;;  but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;;  GNU General Public License for more details.
;;;
;;;  You should have received a copy of the GNU General Public License
;;;  along with this program; if not, write to the Free Software
;;;  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;;;
;;; 
;;; Description:
;;;
;;;	Defines pulldown and popup menus for the html mode (hm--html-mode).
;;;
;;;	You should also have the w3 package from William M. Perry, for
;;;	browsing html- files in the xemacs and the program Xmosaic together
;;;	with the file html-view.el from Ron Tapia for browsing html- files
;;;	in the Xmosaic.
;;; 
;;; Installation: 
;;;   
;;;	Put this file in one of your load path directories.
;;;
;;;     Look at the files hm--html-mode.el and hm--html-configuration
;;;     for further installation points.
;;;

;;
;; Menu "HTML"
;;

(defvar hm--html-pulldown-menu nil "*A List with the HTML-Menu.")
(defvar hm--html-menu-region-expert nil "*A List with the HTML-Menu.")
(defvar hm--html-menu-region-novice nil "*A List with the HTML-Menu.")
(defvar hm--html-menu-noregion-expert nil "*A List with the HTML-Menu.")
(defvar hm--html-menu-noregion-novice nil "*A List with the HTML-Menu.")

(setq hm--html-menu-noregion-expert
       '("HTML Noregion Expert Menu"
	 ("Anchors"
	  ["Relative link..." hm--html-add-relative-link t]
	  ["General link..." hm--html-add-normal-link t]
	  ["Drag & Drop"
	   idd-start-mouse-drag-and-drop
	   :active t
	   :keys "\\[idd-mouse-drag-and-drop]"]
	  "----"
	  ["Html link..." hm--html-add-html-link t]
	  ["Info link..." hm--html-add-info-link t]
	  ["Gopher link..." hm--html-add-gopher-link t]
	  ["File link..." hm--html-add-file-link t]
	  "----"
	  ["Ftp link..." hm--html-add-ftp-link t]
	  ["News link..." hm--html-add-news-link t]
	  ["Mailbox link..." hm--html-add-mail-box-link t]
	  ["Mailto link..." hm--html-add-mailto-link t]
	  ["Wais link (direct)..." hm--html-add-direct-wais-link t]
	  ["Wais link (gateway)..." hm--html-add-wais-link t]
	  "----"
	  ["CGI link..." hm--html-add-cgi-link t]
	  ["Proggate link..." hm--html-add-proggate-link t]
	  ["Local Proggate link..." hm--html-add-local-proggate-link t]
	  "----"
	  ["Link target..." hm--html-add-link-target t]
	  )
	 ("Frame"
	  ["Full html frame..." hm--html-add-full-html-frame t]
	  ["Frame template..." 
	   (hm--html-insert-template hm--html-frame-template-file)
	   (file-exists-p hm--html-frame-template-file)]
	  "----"
	  ["Doctype" hm--html-add-doctype t]
	  ["Html" hm--html-add-html t]
	  ["Head" hm--html-add-head t]
	  ["Body" hm--html-add-body t]
	  "----"
	  ["Title and Header..." hm--html-add-title-and-header t]
	  ["Title..." hm--html-add-title t]
	  ["Header..." hm--html-add-header t]
	  ["Address" hm--html-add-address t]
	  ["Signature" hm--html-add-signature t]
	  "----"
	  ["Meta information..." hm--html-add-meta t]
	  ["Node Link..." hm--html-add-normal-node-link t]
	  ["Isindex..." hm--html-add-isindex t]
	  ["Document Base..." hm--html-add-base t]
	  "----"
	  ["Created comment" hm--html-insert-created-comment t]
	  ["Changed comment" hm--html-insert-changed-comment t]
	  ["Modified line" hm--html-insert-modified-line t]
	  ["New date in title" hm--html-new-date t]
	  )
	 ("Structure"
	  ["Menu or list item" hm--html-add-list-or-menu-item t]
	  ["Menu" hm--html-add-menu t]
	  ["Unordered list" hm--html-add-list t]
	  ["Ordered list" hm--html-add-numberlist t]
	  ["Directory list" hm--html-add-directory-list t]
	  "----"
	  ["Description list" hm--html-add-description-list t]
	  ["Description title" hm--html-add-description-title t]
	  ["Description entry" hm--html-add-description-entry t]
	  ["Description title + entry" 
	   hm--html-add-description-title-and-entry t]
	  "----"
	  ["Table..." hm--html-add-table t]
	  ["Table title..." hm--html-add-table-title t]
	  ["Table header..." hm--html-add-table-header t]
	  ["Table first row..." hm--html-add-first-table-row t]
	  ["Table additional row..." hm--html-add-additional-table-row t]
	  ("Additional Commands"
	   ["Table row frame..." hm--html-add-row-frame t]
	   ["Table header entry..." hm--html-add-header-entry t]
	   ["Table row entry..." hm--html-add-row-entry t]
	   ["Span columns..." hm--html-table-add-colspan-attribute t]
	   ["Span rows..." hm--html-table-add-rowspan-attribute t]
	   )
	  "----"
	  ["Paragraph container" hm--html-add-paragraph t]
	  ["Paragraph start tag" hm--html-add-paragraph-separator t]
	  ["Document division" hm--html-add-document-division t]
	  ["New line" hm--html-add-line-break t]
	  ["Horizontal rule" hm--html-add-horizontal-rule t]
	  )
	 ("Formatting Paragraphs"
;	  ["Without links" hm--html-add-plaintext t]
	  ["Preformatted" hm--html-add-preformatted t]
          ["Blockquote" hm--html-add-blockquote t]
	  "----"
	  ["Basefont..." hm--html-add-basefont t]
	  ["Font..." hm--html-add-font t]
	  ["Center" hm--html-add-center t]
	  ["Style" hm--html-add-style t]
	  "----"
	  ["HTML Comment" hm--html-add-comment t]
;	  ["Listing" hm--html-add-listing t]
;	  ["Abstract" hm--html-add-abstract t]
	  )
	 ("Formatting Words"
	  ["Bold" hm--html-add-bold t]
	  ["Italic" hm--html-add-italic t]
          ["Typewriter" hm--html-add-fixed t]
	  ["Small" hm--html-add-small t]
	  ["Big" hm--html-add-big t]
	  ["Superscript" hm--html-add-superscript t]
	  ["Subscript" hm--html-add-subscript t]
	  "----"
	  ["Underline" hm--html-add-underline t]
	  ["Strikethru" hm--html-add-strikethru t]
	  "----"
;          ["Emphasized" hm--html-add-emphasized t]
;          ["Strong" hm--html-add-strong t]
;	   "----"
	  ("Phrase"
	   ["Emphasized" hm--html-add-emphasized t]
	   ["Strong" hm--html-add-strong t]
	   "----"
	   ["Definition" hm--html-add-definition t]
	   ["Keyboard" hm--html-add-keyboard t]
	   ["Variable" hm--html-add-variable t]
	   ["Code" hm--html-add-code t]
	   ["Sample" hm--html-add-sample t]
	   ["Citation" hm--html-add-citation t]
	   )
;; All the following commands are still implemented, but most
;; of them are not defined in HTM 3.2
;; You've to load hm--html-not-standard.el to use them
;	  ("Computing"
;	   ["Definition" hm--html-add-definition t]
;	   ["Keyboard" hm--html-add-keyboard t]
;	   ["Command" hm--html-add-command t]
;	   ["Argument" hm--html-add-argument t]
;	   ["Option" hm--html-add-option t]
;	   ["Variable" hm--html-add-variable t]
;	   ["Instance" hm--html-add-instance t]
;	   ["Code" hm--html-add-code t]
;	   ["Sample" hm--html-add-sample t]
;	   )
;	  ("Literature"
;	   ["Quote" hm--html-add-quote t]
;	   ["Acronym" hm--html-add-acronym t]
;	   ["Abbreviation" hm--html-add-abbreviation t]
;	   ["Citation" hm--html-add-citation t]
;	   ["Literature" hm--html-add-literature t]
;	   ["Publication" hm--html-add-publication t]
;	   ["ISBN" hm--html-add-isbn t]
;	   )
;	  ("Person"
;	   ["Person" hm--html-add-person t]
;	   ["Author" hm--html-add-author t]
;	   ["Editor" hm--html-add-editor t]
;	   ["Credits" hm--html-add-credits t]
;	   ["Copyright" hm--html-add-copyright t]
;	   )
;	  "----"
;	  ["Footnote" hm--html-add-footnote t]
;	  ["Margin" hm--html-add-margin t]
;	  "----"
;	  ["HTML Comment" hm--html-add-comment t]
	  )
	 ("Include"
	  ["Top aligned image..." hm--html-add-image-top t]
	  ["Middle aligned image..." hm--html-add-image-middle t]
	  ["Bottom aligned image..." hm--html-add-image-bottom t]
	  ["Image as map? ..." hm--html-add-image t]
	  ["Drag & Drop"
	   idd-start-mouse-drag-and-drop
	   :active t
	   :keys "\\[idd-mouse-drag-and-drop]"]
	  "----"
	  ["Image map..." hm--html-add-image-map t]
	  ["Map..." hm--html-add-map t]
	  ["Area..." hm--html-add-area t]
	  "----"
	  ["Applet..." hm--html-add-applet t]
	  ["Parameter..." hm--html-add-applet-parameter t]
	  ["Script" hm--html-add-script t]
;	  "----"
;	  ["File..."  hm--html-add-server-side-include-file t]
;	  ["Command..." hm--html-add-server-side-include-command t]
;	  ["Command with isindex parameter..." 
;	   hm--html-add-server-side-include-command-with-isindex-parameter
;	   t]
	  )
	 ("Forms"
	  ["Form..." hm--html-add-form t]
	  "----"
	  ["Text field..." hm--html-form-add-input-text t]
	  ["Password field..." hm--html-form-add-input-password t]
	  ["Isindex field..." hm--html-form-add-input-isindex t]
	  ["Integer field..." hm--html-form-add-input-integer t]
	  ["Float field..." hm--html-form-add-input-float t]
	  ["Date field..." hm--html-form-add-input-date t]
	  ["Url field..." hm--html-form-add-input-url t]
	  ["Scribble field..." hm--html-form-add-input-scribble t]
	  "----"
	  ["Checkbox button..." hm--html-form-add-input-checkbox t]
	  ["Radio button..." hm--html-form-add-input-radio t]
	  ["Reset button..." hm--html-form-add-input-reset t]
	  ["Submit button..." hm--html-form-add-input-submit t]
	  ["Image button..." hm--html-form-add-input-image t]
	  ["Audio button..." hm--html-form-add-input-audio t]
	  "----"
	  ["Option Menu..." hm--html-form-add-select-option-menu t]
	  ["Scrolled List..." hm--html-form-add-select-scrolled-list t]
	  ["Option..." hm--html-form-add-select-option t]
	  "----"
	  ["Textarea..." hm--html-form-add-textarea t]
	  )
	 ))


(setq hm--html-menu-noregion-novice
       '("HTML No-region Novice Menu"
	 ("Anchors"
	  ["Relative link..." hm--html-add-relative-link t]
	  ["Drag & Drop"
	   idd-start-mouse-drag-and-drop 
	   :active t
	   :keys "\\[idd-mouse-drag-and-drop]"]
	  "----"
	  ["Html link..." hm--html-add-html-link t]
	  ["File link..." hm--html-add-file-link t]
	  )
	 ("Frame"
	  ["Full html frame..." hm--html-add-full-html-frame t]
	  "----"
	  ["Title and Header..." hm--html-add-title-and-header t]
	  ["Signature" hm--html-add-signature t]
	  )
	 ("Structure"
	  ["Menu item" hm--html-add-list-or-menu-item t]
	  ["Menu" hm--html-add-menu t]
	  "----"
	  ["Paragraph Container" hm--html-add-paragraph t]
	  )
	 ("Formatting Paragraphs"
;	  ["Without links" hm--html-add-plaintext t]
	  ["Preformatted" hm--html-add-preformatted t]
	  )
	 ("Formatting Words"
	  ["Bold" hm--html-add-bold t]
	  ["Italic" hm--html-add-italic t]
	  ["Underline" hm--html-add-underline t]
          ["Typewriter" hm--html-add-fixed t]
	  )))

(setq hm--html-menu-region-expert
       '("HTML Region Expert Menu"
	 ("Anchors"
	  ["Relative link..." hm--html-add-relative-link-to-region t]
	  ["General link..." hm--html-add-normal-link-to-region t]
	  ["Drag & Drop"
	   idd-start-mouse-drag-and-drop 
	   :active t
	   :keys "\\[idd-mouse-drag-and-drop]"]
	  "----"
	  ["Html link..." hm--html-add-html-link-to-region t]
	  ["Info link..." hm--html-add-info-link-to-region t]
	  ["Gopher link..." hm--html-add-gopher-link-to-region t]
	  ["File link..." hm--html-add-file-link-to-region t]
	  "----"
	  ["Ftp link..." hm--html-add-ftp-link-to-region t]
	  ["News link..." hm--html-add-news-link-to-region t]
	  ["Mailbox link..." hm--html-add-mail-box-link-to-region t]
	  ["Mailto link..." hm--html-add-mailto-link-to-region t]
	  ["WAIS link (direct)..." hm--html-add-direct-wais-link-to-region t]
	  ["WAIS link (gateway)..." hm--html-add-wais-link-to-region t]
	  "----"
	  ["CGI link..." hm--html-add-cgi-link-to-region t]
	  ["Proggate link..." hm--html-add-proggate-link-to-region t]
	  ["Local Proggate link..." 
	   hm--html-add-local-proggate-link-to-region 
	   t]
	  "----"
	  ["Link target..." hm--html-add-link-target-to-region t]
	  )
	 ("Frame"
	  ["Full html frame..." hm--html-add-full-html-frame-with-region t]
	  "----"
	  ["Head" hm--html-add-head-to-region t]
	  ["Body" hm--html-add-body-to-region t]
	  "----"
	  ["Title and Header..." hm--html-add-title-and-header-to-region t]
	  ["Title" hm--html-add-title-to-region t]
	  ["Header..." hm--html-add-header-to-region t]
	  ["Address" hm--html-add-address-to-region t]
	  )
	 ("Structure"
	  ["Menu item" hm--html-add-list-or-menu-item-to-region t]
	  ["Menu" hm--html-add-menu-to-region t]
	  ["Unordered list" hm--html-add-list-to-region t]
	  ["Ordered list" hm--html-add-numberlist-to-region t]
	  ["Directory list" hm--html-add-directorylist-to-region t]
	  "----"
	  ["Description list" hm--html-add-description-list-to-region t]
	  ["Description title" hm--html-add-description-title-to-region t]
	  ["Description entry" hm--html-add-description-entry-to-region t]
	  "----"
	  ["Table..." hm--html-add-table-to-region t]
	  ["Table Title..." hm--html-add-table-title-to-region t]
	  ("Additional Commands"
	   ["Table row frame..." hm--html-add-row-frame-to-region t]
	   )
	  "----"
	  ["Paragraph container" hm--html-add-paragraph-to-region t]
	  ["Document division" hm--html-add-document-division-to-region t]
	  )
	 ("Formatting Paragraphs"
;	  ["Without links" hm--html-add-plaintext-to-region t]
	  ["Preformatted" hm--html-add-preformatted-to-region t]
          ["Blockquote" hm--html-add-blockquote-to-region t]
	  "----"
	  ["Font..." hm--html-add-font-to-region t]
	  ["Center" hm--html-add-center-to-region t]
	  ["Style" hm--html-add-style-to-region t]
	  "----"
	  ["HTML Comment" hm--html-add-comment-to-region t]
;	  ["Listing" hm--html-add-listing-to-region t]
;	  ["Abstract" hm--html-add-abstract-to-region t]
	  )
	 ("Formatting Words"
	  ["Bold" hm--html-add-bold-to-region t]
	  ["Italic" hm--html-add-italic-to-region t]
          ["Typewriter" hm--html-add-fixed-to-region t]
	  ["Small" hm--html-add-small-to-region t]
	  ["Big" hm--html-add-big-to-region t]
	  ["Superscript" hm--html-add-superscript-to-region t]
	  ["Subscript" hm--html-add-subscript-to-region t]
	  "----"
	  ["Underline" hm--html-add-underline-to-region t]
	  ["Strikethru" hm--html-add-strikethru-to-region t]
	  ;;	  ["Render" hm--html-add-render-to-region t]
	  "----"
;          ["Emphasized" hm--html-add-emphasized-to-region t]
;          ["Strong" hm--html-add-strong-to-region t]
;	  "----"
	  ("Phrase"
	   ["Emphasized" hm--html-add-emphasized-to-region t]
	   ["Strong" hm--html-add-strong-to-region t]
	   "----"
	   ["Definition" hm--html-add-definition-to-region t]
	   ["Keyboard" hm--html-add-keyboard-to-region t]
	   ["Variable" hm--html-add-variable-to-region t]	  
	   ["Code" hm--html-add-code-to-region t]
	   ["Sample" hm--html-add-sample-to-region t]
	   ["Citation" hm--html-add-citation-to-region t]
	   )
;; All the following commands are still implemented, but most
;; of them are not defined in HTM 3.2
;	  ("Computing"
;	   ["Definition" hm--html-add-definition-to-region t]
;	   ["Keyboard" hm--html-add-keyboard-to-region t]
;	   ["Command" hm--html-add-command-to-region t]
;	   ["Argument" hm--html-add-argument-to-region t]
;	   ["Option" hm--html-add-option-to-region t]
;	   ["Variable" hm--html-add-variable-to-region t]	  
;	   ["Instance" hm--html-add-instance-to-region t]
;	   ["Code" hm--html-add-code-to-region t]
;	   ["Sample" hm--html-add-sample-to-region t]
;	   )
;	  ("Literature"
;	   ["Quote" hm--html-add-quote-to-region t]
;	   ["Acronym" hm--html-add-acronym-to-region t]
;	   ["Abbrevation" hm--html-add-abbrevation-to-region t]
;	   ["Citation" hm--html-add-citation-to-region t]
;	   ["Literature" hm--html-add-literature-to-region t]
;	   ["Publication" hm--html-add-publication-to-region t]
;	   ["ISBN" hm--html-add-isbn-to-region t]
;	   )
;	  ("Person"
;	   ["Person" hm--html-add-person-to-region t]
;	   ["Author" hm--html-add-author-to-region t]
;	   ["Editor" hm--html-add-editor-to-region t]
;	   ["Credits" hm--html-add-credits-to-region t]
;	   ["Copyright" hm--html-add-copyright-to-region t]
;	   )
;	  "----"
;	  ["Footnote" hm--html-add-footnote-to-region t]
;	  ["Margin" hm--html-add-margin-to-region t]
;	  "----"
;	  ["HTML Comment" hm--html-add-comment-to-region t]
	  )
	 ("Include"
	  ["Map..." hm--html-add-map-to-region t]
	  "----"
	  ["Applet..." hm--html-add-applet-to-region t]
	  ["Script" hm--html-add-script-to-region t]
	  )
	 ("Forms"
	  ["Form..." hm--html-add-form-to-region t])
	 ))


(setq hm--html-menu-region-novice
      '("HTML Region Novice Menu"
	 ("Anchors"
	  ["Relative link..." hm--html-add-relative-link-to-region t]
	  ["Drag & Drop"
	   idd-start-mouse-drag-and-drop 
	   :active t
	   :keys "\\[idd-mouse-drag-and-drop]"]
	  "----"
	  ["Html link..." hm--html-add-html-link-to-region t]
	  ["File link..." hm--html-add-file-link-to-region t]
	  )
	 ("Frame"
	  ["Full html frame..." hm--html-add-full-html-frame-with-region t]
	  "----"
	  ["Title and Header..." hm--html-add-title-and-header-to-region t]
	  )
	 ("Structure"
	  ["Menu item" hm--html-add-list-or-menu-item-to-region t]
	  ["Menu" hm--html-add-menu-to-region t]
	  )
	 ("Formatting Paragraphs"
;	  ["Without links" hm--html-add-plaintext-to-region t]
	  ["Preformatted" hm--html-add-preformatted-to-region t]
	  )
	 ("Formatting Words"
	  ["Bold" hm--html-add-bold-to-region t]
	  ["Italic" hm--html-add-italic-to-region t]
	  ["Underline" hm--html-add-underline-to-region t]
          ["Typewriter" hm--html-add-fixed-to-region t]
	  )
	 ))


(if (adapt-xemacsp)
    ;; The reason for this if form is, that the Emacs 19 can't
    ;; work correct with `:keys "\\[idd-help-mouse-drag-and-drop]"'
    (setq hm--html-pulldown-menu
	  '("HTML Config Menu"
	    ("Set popup menu"
	     ["Novice menu" 
	      hm--html-use-novice-menu
	      :active t
	      :style radio
	      :selected (not hm--html-expert)]
	     ["Expert menu"
	      hm--html-use-expert-menu
	      :active t
	      :style radio
	      :selected hm--html-expert]
	     )
	    ["Reload config files" hm--html-load-config-files t]
	    ["Templates (fixed dirs) ..."
	     hm--html-insert-template-from-fixed-dirs
	     t]
	    ["Templates ..." hm--html-insert-template t]
	    ["Drag & Drop"
	     idd-start-mouse-drag-and-drop
	     :active t
	     :keys "\\[idd-mouse-drag-and-drop]"]
	    ["Drag & Drop Help"
	     idd-start-help-mouse-drag-and-drop
	     :active t
	     :keys "\\[idd-help-mouse-drag-and-drop]"]
	    "----"
	    ["Remove numeric names" hm--html-remove-numeric-names t]
	    ["Quotify hrefs" hm--html-quotify-hrefs t]
	    "----"
	    ["Submit bug report..." hm--html-submit-bug-report t]
	    ["WWW Package Docs" hm--html-view-www-package-docu t]
	    "----"
	    ("Preview Document"     
	     ["Netscape view buffer" (hm--html-send-buffer-to-netscape 
				      (current-buffer)) t]
	     "----"
	     ["Xmosaic start" html-view-start-mosaic t]
	     ["Xmosaic view buffer" html-view-view-buffer t]
	     ["Xmosaic view file" html-view-view-file t]
	     ["Xmosaic goto url" html-view-goto-url t]
	     ["Xmosaic get display" html-view-get-display t]
	     "----"
	     ["W3 start" w3 t]
	     ["W3 view buffer" w3-preview-this-buffer t]
	     ["W3 open remote file..." w3-fetch t]
	     ["W3 open local..." w3-open-local t]
	     ["W3 use hotlist..." w3-use-hotlist t]
	     )
	    ))
  (setq hm--html-pulldown-menu
	'("HTML Config Menu"
	  ("Set popup menu"
	   ["Novice menu" 
	    hm--html-use-novice-menu
	    :active t
	    :style radio
	    :selected (not hm--html-expert)]
	   ["Expert menu"
	    hm--html-use-expert-menu
	    :active t
	    :style radio
	    :selected hm--html-expert]
	   )
	  ["Reload config files" hm--html-load-config-files t]
	  ["Templates (fixed dirs) ..."
	   hm--html-insert-template-from-fixed-dirs
	   t]
	  ["Templates ..." hm--html-insert-template t]
	  ["Drag & Drop"
	   idd-start-mouse-drag-and-drop
	   :active t]
	  ["Drag & Drop Help"
	   idd-start-help-mouse-drag-and-drop
	   :active t]
	  "----"
	  ["Remove numeric names" hm--html-remove-numeric-names t]
	  ["Quotify hrefs" hm--html-quotify-hrefs t]
	  "----"
	  ["Submit bug report..." hm--html-submit-bug-report t]
	  ["WWW Package Docs" hm--html-view-www-package-docu t]
	  "----"
	  ("Preview Document"     
	   ["Netscape view buffer" (hm--html-send-buffer-to-netscape 
				    (current-buffer)) t]
	   "----"
	   ["Xmosaic start" html-view-start-mosaic t]
	   ["Xmosaic view buffer" html-view-view-buffer t]
	   ["Xmosaic view file" html-view-view-file t]
	   ["Xmosaic goto url" html-view-goto-url t]
	   ["Xmosaic get display" html-view-get-display t]
	   "----"
	   ["W3 start" w3 t]
	   ["W3 view buffer" w3-preview-this-buffer t]
	   ["W3 open remote file..." w3-fetch t]
	   ["W3 open local..." w3-open-local t]
	   ["W3 use hotlist..." w3-use-hotlist t]
	   )
	  ))
  )	

(if (adapt-xemacsp)
    (defun hm--install-html-menu (menu-name)
      (if (and (featurep 'menubar)
	       current-menubar 
	       (not (assoc menu-name current-menubar)))
	  (progn
	    (set-buffer-menubar (copy-sequence current-menubar))
	    (add-submenu nil
			 (cons menu-name (cdr hm--html-pulldown-menu))
			 "HTML"))))

  (defun hm--install-html-menu (menu-name)
    (if (eq major-mode 'hm--html-mode)
	(easy-menu-define hm--html-menu-map
			  hm--html-mode-map
			  "The hm--html-mode pulldown menu."
			  (cons menu-name
				(cdr hm--html-pulldown-menu)))
      (easy-menu-define hm--html-minor-menu-map
			hm--html-minor-mode-map
			"The hm--html-minor-mode pulldown menu."
			(cons menu-name
			      (cdr hm--html-pulldown-menu))))
    ))

(if (adapt-emacsp)
    (progn

      (setq hm--html-menu-noregion-expert-map
		  (make-lucid-menu-keymap (car hm--html-menu-noregion-expert)
					  (cdr hm--html-menu-noregion-expert)))

      (setq hm--html-menu-region-expert-map
	    (make-lucid-menu-keymap (car hm--html-menu-region-expert)
				    (cdr hm--html-menu-region-expert)))

      (setq hm--html-menu-noregion-novice-map
	    (make-lucid-menu-keymap (car hm--html-menu-noregion-novice)
				    (cdr hm--html-menu-noregion-novice)))

      (setq hm--html-menu-region-novice-map
	    (make-lucid-menu-keymap (car hm--html-menu-region-novice)
				    (cdr hm--html-menu-region-novice)))

      ;; Speeds up the first popup of a menu
      (if hm--html-expert
	  (progn
	    (x-popup-menu nil hm--html-menu-noregion-expert-map)
	    (x-popup-menu nil hm--html-menu-region-expert-map)
	    )
	(x-popup-menu nil hm--html-menu-noregion-novice-map)
	(x-popup-menu nil hm--html-menu-region-novice-map))


      )

  (defun hm--html-popup-menu (event)
    "Pops the HTML- menu up, if no region is active."
    (interactive "@e")
    (if hm--html-expert
	(popup-menu hm--html-menu-noregion-expert)
      (popup-menu hm--html-menu-noregion-novice)))


  (defun hm--html-popup-menu-region (event)
    "Pops the HTML- menu up, if a region is active."
    (interactive "@e")
    (if hm--html-expert
	(popup-menu hm--html-menu-region-expert)
      (popup-menu hm--html-menu-region-novice)))
  )


(if (adapt-xemacsp)
    (progn

      (defun hm--html-use-novice-menu ()
	"Changes the HTML popup menu to the novice menu."
	(interactive)
	(setq hm--html-expert nil)
	)	


      (defun hm--html-use-expert-menu ()
	"Changes the HTML popup menu to the expert menu."
	(interactive)
	(setq hm--html-expert t)
	)
      )

  ;; For the Emacs 19
  (defun hm--html-use-novice-menu ()
    "Changes the HTML popup menu to the novice menu."
    (interactive)
    (setq hm--html-expert nil)
    (define-key hm--html-region-mode-map
      hm--html-emacs19-popup-region-menu-button
      hm--html-menu-region-novice-map)
    (define-key hm--html-minor-region-mode-map
	  hm--html-emacs19-popup-region-menu-button
	  hm--html-menu-region-novice-map)
    (if (not hm--html-region-mode)
	(define-key hm--html-mode-map
	  hm--html-emacs19-popup-noregion-menu-button
	  hm--html-menu-noregion-novice-map))
    (if (not hm--html-minor-region-mode)
	(define-key hm--html-minor-mode-map 
	  hm--html-emacs19-popup-noregion-menu-button
	  hm--html-menu-noregion-novice-map))
    )

  (defun hm--html-use-expert-menu ()
    "Changes the HTML popup menu to the expert menu."
    (interactive)
    (setq hm--html-expert t)
    (define-key hm--html-region-mode-map
      hm--html-emacs19-popup-region-menu-button
      hm--html-menu-region-expert-map)
    (define-key hm--html-minor-region-mode-map
	  hm--html-emacs19-popup-region-menu-button 
	  hm--html-menu-region-expert-map)
    (if (not hm--html-region-mode)
	(define-key hm--html-mode-map
	  hm--html-emacs19-popup-noregion-menu-button
	  hm--html-menu-noregion-expert-map))
    (if (not hm--html-minor-region-mode)
	(define-key hm--html-minor-mode-map 
	  hm--html-emacs19-popup-noregion-menu-button
	  hm--html-menu-noregion-expert-map))
    )
  )


(defvar hm--html-use-psgml t
  "Set this to t, if functions from the psgml-mode should be used.")

;;; Popup the menus in the minor mode

(if (adapt-xemacsp)
    (progn

      (defadvice sgml-xemacs-get-popup-value (around
					      hm--html-popup-menu-advice
					      activate)
	"Calls `hm--html-sgml-xemacs-get-popup-value' instead of the original.
`hm--html-sgml-xemacs-get-popup-value' is only called, if the
`hm--html-minor-mode' is active. 
`hm--html-sgml-xemacs-get-popup-value' adds the 'hm--html-mode' popup
menus to the psgml popup menu."
	(if hm--html-minor-mode
	    (setq ad-return-value
		  (hm--html-sgml-xemacs-get-popup-value (ad-get-arg 0)))
	  ad-do-it))
      
      (defun hm--html-sgml-xemacs-get-popup-value (menudesc)
	(let ((value nil)
	      (event nil))
	  ;; (popup-menu menudesc)
	  (if (boundp 'hm--html-popup-menu)
	      (popup-menu (append hm--html-popup-menu  ; for the hm--html-menu 
				  (list "=="           ;
					(car menudesc) ;
					"==")          ;
				  (cdr menudesc)))     ;
	    (popup-menu menudesc))
	  (while (popup-up-p)
	    (setq event (next-command-event event))
	    (cond ((misc-user-event-p event)
		   (cond
		    ((eq (event-object event) 'abort)
		     (signal 'quit nil))
		    ((eq (event-object event) 'menu-no-selection-hook)
		     nil)
		    ((and (commandp (event-object event))       ; for the 
			  (boundp 'hm--html-mark))		;
		     (set-mark hm--html-mark)			;
		     (goto-char hm--html-point)			;
		     (call-interactively (event-object event))  ; hm--html-menu
;		     (signal 'quit nil)                         ; items
		     )
		    (t
		     (eval (event-object event)))))
		  ((button-release-event-p event) ; don't beep twice
		   nil)
		  ((and (fboundp 'event-matches-key-specifier-p)
			(event-matches-key-specifier-p event (quit-char)))
		   (signal 'quit nil))
		  (t
		   (beep)
		   (message "please make a choice from the menu."))))
	  value))
      )

  ;; For the Emacs 19
  (defun hm--html-add-major-menu-to-minor-menus ()
    "Adds an entry to get the general major menu in the minor mode menus.
This function is only used in the Emacs 19."
    (define-key  hm--html-menu-noregion-novice-map
      [mouse-major-mode-menu]
      '("Major Mode Menu" . mouse-major-mode-menu))
    (define-key  hm--html-menu-noregion-expert-map
      [mouse-major-mode-menu]
      '("Major Mode Menu" . mouse-major-mode-menu))
    (define-key  hm--html-menu-region-novice-map
      [mouse-major-mode-menu]
      '("Major Mode Menu" . mouse-major-mode-menu))
    (define-key  hm--html-menu-region-expert-map
      [mouse-major-mode-menu]
      '("Major Mode Menu" . mouse-major-mode-menu)))

  (defun hm--html-remove-major-menu-from-minor-menus ()
    "Removes the entry to get the general major menu in the minor mode menus.
This function is only used in the Emacs 19."
    (define-key  hm--html-menu-noregion-novice-map
      [mouse-major-mode-menu] 'undefined)
    (define-key  hm--html-menu-noregion-expert-map
      [mouse-major-mode-menu] 'undefined)
    (define-key  hm--html-menu-region-novice-map
      [mouse-major-mode-menu] 'undefined)
    (define-key  hm--html-menu-region-expert-map
      [mouse-major-mode-menu] 'undefined))
  )

(if (adapt-xemacsp)
    (progn

      (defvar hm--html-gpmr (symbol-function 'get-popup-menu-response))
      
      (defun hm--html-call-wrapped-sgml-menu (event)
	(flet ((get-popup-menu-response (menudesc &optional event)
		  (setq menudesc
			(append hm--html-popup-menu  
				(list "=="           
				      (car menudesc) 
				      "==")          
				(cdr menudesc)))
		  (setq event (funcall hm--html-gpmr
			       menudesc event))
		  (if (and (misc-user-event-p event)
			   (commandp (event-object event))
			   (boundp 'hm--html-mark))
		      (progn
			(set-mark hm--html-mark)
			(goto-char hm--html-point)
			(call-interactively (event-object event)))
		    event)))
	  (sgml-tags-menu event)))

      (defun hm--html-popup-minor-html-menu (event)
	"Pops the HTML- menu up, if no region is active."
	(interactive "@e")
	(if (eq major-mode 'html-mode)
	    (if hm--html-use-psgml
		(let ((hm--html-popup-menu (if hm--html-expert
					       hm--html-menu-noregion-expert
					     hm--html-menu-noregion-novice))
		      (hm--html-point (point))
		      (hm--html-mark (mark)))
		  (hm--html-call-wrapped-sgml-menu event))
	      (if hm--html-expert
		  (popup-menu hm--html-menu-noregion-expert)
		(popup-menu hm--html-menu-noregion-novice))
	      )
	  ;; popup-menu will fail, if mode-popup-menu contains a
	  ;; :filter and mode-popup-menu isn't at the top of
	  ;; the menu
	  (popup-menu (append mode-popup-menu
			      (list "==="
				    (if hm--html-expert
					(car hm--html-menu-region-expert)
				      (car hm--html-menu-region-novice))
				    "===")
			      (if hm--html-expert
				  (cdr hm--html-menu-region-expert)
				(cdr hm--html-menu-region-novice)
				)))))
	    
      
      
      (defun hm--html-popup-minor-html-menu-region (event)
	"Pops the HTML- menu up, if a region is active."
	(interactive "@e")
	(if (eq major-mode 'html-mode)
	    (if hm--html-use-psgml
		(let ((hm--html-popup-menu (if hm--html-expert
					       hm--html-menu-region-expert
					     hm--html-menu-region-novice))
		      (hm--html-point (point))
		      (hm--html-mark (mark)))
		  (hm--html-call-wrapped-sgml-menu event))
	      (if hm--html-expert
		  (popup-menu hm--html-menu-region-expert)
		(popup-menu hm--html-menu-region-novice))
	      )
	  ;; popup-menu will fail, if mode-popup-menu contains a
	  ;; :filter and mode-popup-menu isn't at the top of
	  ;; the menu
	  (popup-menu (append mode-popup-menu
			      (list "==="
				    (if hm--html-expert
					(car hm--html-menu-region-expert)
				      (car hm--html-menu-region-novice))
				    "===")
			      (if hm--html-expert
				  (cdr hm--html-menu-region-expert)
				(cdr hm--html-menu-region-novice)
			      )))))
      
      ))


(run-hooks 'hm--html-menu-load-hook)


;;; Announce the feature hm--html-menu
(provide 'hm--html-menu)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.