Add dotfiles for desktop
This commit is contained in:
parent
9d4fcfef47
commit
a7526d4a98
2370 changed files with 63293 additions and 0 deletions
0
desktop/.config/.gsd-keyboard.settings-ported
Normal file
0
desktop/.config/.gsd-keyboard.settings-ported
Normal file
50
desktop/.config/alacritty/alacritty.toml
Normal file
50
desktop/.config/alacritty/alacritty.toml
Normal file
|
@ -0,0 +1,50 @@
|
|||
# Source https//github.com/tyrannicaltoucan/vim-deep-space
|
||||
|
||||
# Default colors
|
||||
[colors.primary]
|
||||
background = '#1b202a'
|
||||
foreground = '#9aa7bd'
|
||||
|
||||
# Colors the cursor will use if `custom_cursor_colors` is true
|
||||
[colors.cursor]
|
||||
text = '#232936'
|
||||
cursor = '#51617d'
|
||||
|
||||
# Normal colors
|
||||
[colors.normal]
|
||||
black = '#1b202a'
|
||||
red = '#b15e7c'
|
||||
green = '#709d6c'
|
||||
yellow = '#b5a262'
|
||||
blue = '#608cc3'
|
||||
magenta = '#8f72bf'
|
||||
cyan = '#56adb7'
|
||||
white = '#9aa7bd'
|
||||
|
||||
# Bright colors
|
||||
[colors.bright]
|
||||
black = '#232936'
|
||||
red = '#b3785d'
|
||||
green = '#709d6c'
|
||||
yellow = '#d5b875'
|
||||
blue = '#608cc3'
|
||||
magenta = '#c47ebd'
|
||||
cyan = '#51617d'
|
||||
white = '#9aa7bd'
|
||||
|
||||
[font]
|
||||
size = 12
|
||||
|
||||
[font.normal]
|
||||
family = "CaskaydiaCove Nerd Font"
|
||||
# style = "bold"
|
||||
|
||||
[shell]
|
||||
program = "/usr/bin/zsh"
|
||||
|
||||
[window]
|
||||
opacity = 0.8
|
||||
|
||||
[window.padding]
|
||||
x = 20
|
||||
y = 20
|
45
desktop/.config/alacritty/alacritty.toml.bk
Normal file
45
desktop/.config/alacritty/alacritty.toml.bk
Normal file
|
@ -0,0 +1,45 @@
|
|||
# Colors (Gruvbox Material Hard Dark)
|
||||
|
||||
# Default colors
|
||||
[colors.primary]
|
||||
background = '#1d2021'
|
||||
foreground = '#d4be98'
|
||||
|
||||
# Normal colors
|
||||
[colors.normal]
|
||||
black = '#32302f'
|
||||
red = '#ea6962'
|
||||
green = '#a9b665'
|
||||
yellow = '#d8a657'
|
||||
blue = '#7daea3'
|
||||
magenta = '#d3869b'
|
||||
cyan = '#89b482'
|
||||
white = '#d4be98'
|
||||
|
||||
# Bright colors (same as normal colors)
|
||||
[colors.bright]
|
||||
black = '#32302f'
|
||||
red = '#ea6962'
|
||||
green = '#a9b665'
|
||||
yellow = '#d8a657'
|
||||
blue = '#7daea3'
|
||||
magenta = '#d3869b'
|
||||
cyan = '#89b482'
|
||||
white = '#d4be98'
|
||||
|
||||
[font]
|
||||
size = 12
|
||||
|
||||
[font.normal]
|
||||
family = "CaskaydiaCove Nerd Font"
|
||||
style = "bold"
|
||||
|
||||
[shell]
|
||||
program = "/bin/bash"
|
||||
|
||||
# [window]
|
||||
# opacity = 0.8
|
||||
|
||||
[window.padding]
|
||||
x = 20
|
||||
y = 20
|
11
desktop/.config/autostart/Nextcloud.desktop
Normal file
11
desktop/.config/autostart/Nextcloud.desktop
Normal file
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Name=Nextcloud
|
||||
GenericName=File Synchronizer
|
||||
Exec="/usr/bin/nextcloud" --background
|
||||
Terminal=false
|
||||
Icon=Nextcloud
|
||||
Categories=Network
|
||||
Type=Application
|
||||
StartupNotify=false
|
||||
X-GNOME-Autostart-enabled=true
|
||||
X-GNOME-Autostart-Delay=10
|
2
desktop/.config/nano/nanorc
Normal file
2
desktop/.config/nano/nanorc
Normal file
|
@ -0,0 +1,2 @@
|
|||
include "/usr/share/nano/*.nanorc"
|
||||
include "/usr/share/nano/extra/*.nanorc"
|
143
desktop/.config/sway/config
Normal file
143
desktop/.config/sway/config
Normal file
|
@ -0,0 +1,143 @@
|
|||
# variables
|
||||
set $mod Mod4
|
||||
set $left h
|
||||
set $down j
|
||||
set $up k
|
||||
set $right l
|
||||
set $term alacritty -e 'tmux'
|
||||
set $term_no_tmux alacritty
|
||||
set $menu exec tofi-drun | xargs swaymsg exec --
|
||||
|
||||
font pango:Iosevka Nerd Font 9
|
||||
|
||||
# setting the solid.
|
||||
# output * bg #a89984 solid_color
|
||||
|
||||
# use this if you are into wallpapers.
|
||||
output * bg $HOME/.config/sway/wallpaper.jpg fill
|
||||
|
||||
# common bindings
|
||||
bindsym $mod+Return exec $term
|
||||
bindsym $mod+Shift+Return exec $term_no_tmux
|
||||
bindsym $mod+d exec $menu
|
||||
bindsym $mod+Shift+q kill
|
||||
bindsym $mod+Shift+c reload
|
||||
bindsym $mod+Shift+e exec swaynag -t warning -m 'Exit Sway?' -B 'Yes, exit sway' 'swaymsg exit' --font="Iosevka Nerd Font"
|
||||
|
||||
floating_modifier $mod normal
|
||||
|
||||
# more bindings
|
||||
bindsym $mod+$left focus left
|
||||
bindsym $mod+$down focus down
|
||||
bindsym $mod+$up focus up
|
||||
bindsym $mod+$right focus right
|
||||
bindsym $mod+Left focus left
|
||||
bindsym $mod+Down focus down
|
||||
bindsym $mod+Up focus up
|
||||
bindsym $mod+Right focus right
|
||||
bindsym $mod+Shift+$left move left
|
||||
bindsym $mod+Shift+$down move down
|
||||
bindsym $mod+Shift+$up move up
|
||||
bindsym $mod+Shift+$right move right
|
||||
bindsym $mod+Shift+Left move left
|
||||
bindsym $mod+Shift+Down move down
|
||||
bindsym $mod+Shift+Up move up
|
||||
bindsym $mod+Shift+Right move right
|
||||
bindsym $mod+1 workspace number 1
|
||||
bindsym $mod+2 workspace number 2
|
||||
bindsym $mod+3 workspace number 3
|
||||
bindsym $mod+4 workspace number 4
|
||||
bindsym $mod+5 workspace number 5
|
||||
bindsym $mod+6 workspace number 6
|
||||
bindsym $mod+7 workspace number 7
|
||||
bindsym $mod+8 workspace number 8
|
||||
bindsym $mod+9 workspace number 9
|
||||
bindsym $mod+0 workspace number 10
|
||||
bindsym $mod+Shift+1 move container to workspace number 1
|
||||
bindsym $mod+Shift+2 move container to workspace number 2
|
||||
bindsym $mod+Shift+3 move container to workspace number 3
|
||||
bindsym $mod+Shift+4 move container to workspace number 4
|
||||
bindsym $mod+Shift+5 move container to workspace number 5
|
||||
bindsym $mod+Shift+6 move container to workspace number 6
|
||||
bindsym $mod+Shift+7 move container to workspace number 7
|
||||
bindsym $mod+Shift+8 move container to workspace number 8
|
||||
bindsym $mod+Shift+9 move container to workspace number 9
|
||||
bindsym $mod+Shift+0 move container to workspace number 10
|
||||
bindsym $mod+Shift+v floating toggle
|
||||
bindsym $mod+b splith
|
||||
bindsym $mod+v splitv
|
||||
bindsym $mod+s layout stacking
|
||||
bindsym $mod+w layout tabbed
|
||||
bindsym $mod+e layout toggle split
|
||||
bindsym $mod+f fullscreen
|
||||
bindsym $mod+space focus mode_toggle
|
||||
bindsym $mod+a focus parent
|
||||
bindsym $mod+r mode "resize"
|
||||
|
||||
mode "resize" {
|
||||
bindsym $left resize shrink width 20px
|
||||
bindsym $down resize grow height 20px
|
||||
bindsym $up resize shrink height 20px
|
||||
bindsym $right resize grow width 20px
|
||||
|
||||
bindsym Left resize shrink width 20px
|
||||
bindsym Down resize grow height 20px
|
||||
bindsym Up resize shrink height 20px
|
||||
bindsym Right resize grow width 20px
|
||||
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
|
||||
bar {
|
||||
swaybar_command waybar
|
||||
|
||||
# swaybar_command swaybar
|
||||
#
|
||||
# status_command /usr/bin/i3status-rs $HOME/.config/i3status/config.toml
|
||||
# position top
|
||||
# font pango:CaskaydiaCove Nerd Font 12
|
||||
#
|
||||
# colors {
|
||||
# background #050505
|
||||
#
|
||||
# focused_workspace #97a97c #87986a #050505
|
||||
# }
|
||||
}
|
||||
|
||||
# startup executions
|
||||
# exec swww init
|
||||
|
||||
default_border pixel 1
|
||||
default_floating_border pixel 1
|
||||
|
||||
# Thin borders:
|
||||
smart_borders on
|
||||
smart_gaps off
|
||||
|
||||
## Window decoration
|
||||
#class border backgr text indicator child_border
|
||||
client.focused #333845 #333845 #ffffff #2e9ef4 #8fbcbb
|
||||
client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a
|
||||
client.unfocused #2f343a #222222 #888888 #333845 #333845
|
||||
client.urgent #2f343a #900000 #ffffff #900000 #900000
|
||||
client.placeholder #000000 #0c0c0c #ffffff #000000 #333845
|
||||
client.background #ffffff
|
||||
|
||||
# swayfx config
|
||||
|
||||
blur enable
|
||||
blur_passes 3
|
||||
blur_radius 5
|
||||
layer_effects "waybar" shadows enable;
|
||||
corner_radius 12
|
||||
default_dim_inactive 0.1
|
||||
shadows enable
|
||||
|
||||
# window gaps
|
||||
gaps inner 4
|
||||
gaps outer 4
|
||||
|
||||
# includes
|
||||
include /etc/sway/config.d/*
|
||||
include $HOME/.config/sway/config.d/*
|
12
desktop/.config/sway/config.d/input
Normal file
12
desktop/.config/sway/config.d/input
Normal file
|
@ -0,0 +1,12 @@
|
|||
input type:keyboard {
|
||||
repeat_delay 250
|
||||
repeat_rate 50
|
||||
xkb_layout "it"
|
||||
xkb_options "grp:alt_shift_toggle,caps:escape"
|
||||
}
|
||||
|
||||
input type:touchpad {
|
||||
dwt disable
|
||||
tap enabled
|
||||
natural_scroll disable
|
||||
}
|
BIN
desktop/.config/sway/wallpaper.jpg
Normal file
BIN
desktop/.config/sway/wallpaper.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.2 MiB |
BIN
desktop/.config/sway/wallpaper2.jpg
Normal file
BIN
desktop/.config/sway/wallpaper2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 MiB |
17
desktop/.config/tofi/config
Normal file
17
desktop/.config/tofi/config
Normal file
|
@ -0,0 +1,17 @@
|
|||
font = CaskaydiaCove Nerd Font Bold
|
||||
font-size = 12
|
||||
|
||||
background-color = #1d2021
|
||||
corner-radius = 6
|
||||
|
||||
outline-width = 0
|
||||
|
||||
border-width = 2
|
||||
border-color = #202020
|
||||
|
||||
text-color = #ede0d4
|
||||
selection-color = #97a97c
|
||||
prompt-text = "Run: "
|
||||
|
||||
width = 50%
|
||||
height = 40%
|
15
desktop/.config/user-dirs.dirs
Normal file
15
desktop/.config/user-dirs.dirs
Normal file
|
@ -0,0 +1,15 @@
|
|||
# This file is written by xdg-user-dirs-update
|
||||
# If you want to change or add directories, just edit the line you're
|
||||
# interested in. All local changes will be retained on the next run.
|
||||
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
|
||||
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
|
||||
# absolute path. No other format is supported.
|
||||
#
|
||||
XDG_DESKTOP_DIR="$HOME/Scrivania"
|
||||
XDG_DOWNLOAD_DIR="$HOME/Scaricati"
|
||||
XDG_TEMPLATES_DIR="$HOME/Modelli"
|
||||
XDG_PUBLICSHARE_DIR="$HOME/Pubblici"
|
||||
XDG_DOCUMENTS_DIR="$HOME/Documenti"
|
||||
XDG_MUSIC_DIR="$HOME/Musica"
|
||||
XDG_PICTURES_DIR="$HOME/Immagini"
|
||||
XDG_VIDEOS_DIR="$HOME/Video"
|
1
desktop/.config/user-dirs.locale
Normal file
1
desktop/.config/user-dirs.locale
Normal file
|
@ -0,0 +1 @@
|
|||
it_IT
|
140
desktop/.config/waybar/config
Normal file
140
desktop/.config/waybar/config
Normal file
|
@ -0,0 +1,140 @@
|
|||
{
|
||||
"layer": "top",
|
||||
"position": "bottom",
|
||||
"margin-left": 10,
|
||||
"margin-right": 10,
|
||||
"margin-bottom": 10,
|
||||
"height": 30,
|
||||
"spacing": 5,
|
||||
"modules-left": [
|
||||
"sway/workspaces",
|
||||
"sway/mode",
|
||||
"sway/window"
|
||||
],
|
||||
"modules-center": [],
|
||||
"modules-right": [
|
||||
"idle_inhibitor",
|
||||
"pulseaudio",
|
||||
"battery",
|
||||
"backlight",
|
||||
"clock",
|
||||
"custom/power",
|
||||
"custom/grimshot",
|
||||
"custom/notification",
|
||||
"tray"
|
||||
],
|
||||
"idle_inhibitor": {
|
||||
"format": "{icon} ",
|
||||
"format-icons": {
|
||||
"activated": "",
|
||||
"deactivated": ""
|
||||
}
|
||||
},
|
||||
"battery": {
|
||||
"states": {
|
||||
"warning": 30,
|
||||
"critical": 15
|
||||
},
|
||||
"format": "{capacity}% {icon}",
|
||||
"format-charging": "{capacity}% ",
|
||||
"format-plugged": "{capacity}% ",
|
||||
"format-icons": [
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"on-click": "~/.config/sway/scripts/tofi-ppctl.sh"
|
||||
},
|
||||
"clock": {
|
||||
"interval": 10,
|
||||
"format-alt": "{:%d/%m/%Y %H:%M:%S}",
|
||||
"format": "{:%d/%m %H:%M}",
|
||||
"tooltip-format": "{:%e %B %Y}",
|
||||
"on-click-right": "gsimplecal"
|
||||
},
|
||||
"sway/workspaces": {
|
||||
"disable-scroll": true,
|
||||
"disable-markup": false,
|
||||
"all-outputs": false,
|
||||
"format": " {icon} "
|
||||
},
|
||||
"sway/mode": {
|
||||
"format": "{}",
|
||||
"tooltip": false
|
||||
},
|
||||
"sway/window": {
|
||||
"format": "{}",
|
||||
"max-length": 120
|
||||
},
|
||||
"wlr/workspaces": {
|
||||
"all-outputs": false,
|
||||
"on-click": "activate",
|
||||
"sort-by-number": true
|
||||
},
|
||||
"pulseaudio": {
|
||||
"scroll-step": 1,
|
||||
"format": "{volume}% {icon}",
|
||||
"format-bluetooth": "{volume}% {icon} {format_source}",
|
||||
"format-bluetooth-muted": " {icon} {format_source}",
|
||||
"format-muted": " {format_source}",
|
||||
"format-source": "{volume}% ",
|
||||
"format-source-muted": "",
|
||||
"format-icons": {
|
||||
"headphone": "",
|
||||
"hands-free": "",
|
||||
"headset": " ",
|
||||
"phone": "",
|
||||
"portable": "",
|
||||
"car": "",
|
||||
"default": [
|
||||
""
|
||||
]
|
||||
},
|
||||
"on-click": "pavucontrol",
|
||||
"on-scroll-up": "pamixer -ui 2",
|
||||
"on-scroll-down": "pamixer -ud 2"
|
||||
},
|
||||
"backlight": {
|
||||
"format": "{percent}% ",
|
||||
"on-scroll-down": "brightnessctl -c backlight set 1%-",
|
||||
"on-scroll-up": "brightnessctl -c backlight set +1%"
|
||||
},
|
||||
"custom/power": {
|
||||
"format": "⏻",
|
||||
"on-click": "exec ~/.config/waybar/scripts/power-menu.sh",
|
||||
"tooltip": false
|
||||
},
|
||||
"custom/grimshot": {
|
||||
"format": "",
|
||||
"tooltip": false,
|
||||
"on-click": "grimshot --notify save area - | swappy -f -",
|
||||
"on-click-middle": "grimshot --notify save screen - | swappy -f -",
|
||||
"on-click-right": "grimshot --notify save window - | swappy -f -"
|
||||
},
|
||||
"custom/notification": {
|
||||
"tooltip": false,
|
||||
"format": "{icon}",
|
||||
"format-icons": {
|
||||
"notification": "<span foreground='red'><sup></sup></span>",
|
||||
"none": "",
|
||||
"dnd-notification": "<span foreground='red'><sup></sup></span>",
|
||||
"dnd-none": "",
|
||||
"inhibited-notification": "<span foreground='red'><sup></sup></span>",
|
||||
"inhibited-none": "",
|
||||
"dnd-inhibited-notification": "<span foreground='red'><sup></sup></span>",
|
||||
"dnd-inhibited-none": ""
|
||||
},
|
||||
"return-type": "json",
|
||||
"exec-if": "which swaync-client",
|
||||
"exec": "swaync-client -swb",
|
||||
"on-click": "swaync-client -t -sw",
|
||||
"on-click-right": "swaync-client -d -sw",
|
||||
"escape": true
|
||||
},
|
||||
"tray": {
|
||||
"icon-size": 14,
|
||||
"spacing": 10
|
||||
}
|
||||
}
|
21
desktop/.config/waybar/scripts/PBPbattery.sh
Executable file
21
desktop/.config/waybar/scripts/PBPbattery.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
|
||||
#!/bin/bash
|
||||
#simple Shellscript for waybar/i3blocks/polybar on Pinebook pro
|
||||
#05012020 geri123@gmx.net Gerhard S.
|
||||
|
||||
PERCENT=$(cat /sys/class/power_supply/cw2015-battery/capacity)
|
||||
STATUS=$(cat /sys/class/power_supply/cw2015-battery/status)
|
||||
case $((
|
||||
$PERCENT >= 0 && $PERCENT <= 20 ? 1 :
|
||||
$PERCENT > 20 && $PERCENT <= 40 ? 2 :
|
||||
$PERCENT > 40 && $PERCENT <= 60 ? 3 :
|
||||
$PERCENT > 60 && $PERCENT <= 80 ? 4 : 5)) in
|
||||
#
|
||||
(1) echo $STATUS:"":$PERCENT%;;
|
||||
(2) echo $STATUS:"":$PERCENT%;;
|
||||
(3) echo $STATUS:"":$PERCENT%;;
|
||||
(4) echo $STATUS:"":$PERCENT%;;
|
||||
(5) echo $STATUS:"":$PERCENT%;;
|
||||
esac
|
||||
|
||||
|
2
desktop/.config/waybar/scripts/keyhint.sh
Executable file
2
desktop/.config/waybar/scripts/keyhint.sh
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
yad --title="EndeavourOS Sway-WM keybindings:" --no-buttons --geometry=400x345-15-400 --list --column=key: --column=description: --column=command: "ESC" "close this app" "" "=" "modkey" "(set mod Mod4)" "+enter" "Terminal" "(xfce4-terminal)" "+d" "Application Menu" "(wofi)" "+p" "Activities" "(wofi)" "+o" "" "Open Broswer" "+n" "" "Open Files" "+q" "close focused app" "(kill)" "[Shift]+Print-key" "screenshot" "(grim)" "+Shift+e" "power-menu" "(wofi)" "+t" "open keybinding helper" "full list"
|
16
desktop/.config/waybar/scripts/power-menu.sh
Executable file
16
desktop/.config/waybar/scripts/power-menu.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
entries="Logout Suspend Reboot Shutdown"
|
||||
|
||||
selected=$(printf '%s\n' $entries | wofi --conf=$HOME/.config/wofi/config.power --style=$HOME/.config/wofi/style.widgets.css | awk '{print tolower($1)}')
|
||||
|
||||
case $selected in
|
||||
logout)
|
||||
swaymsg exit;;
|
||||
suspend)
|
||||
exec systemctl suspend;;
|
||||
reboot)
|
||||
exec systemctl reboot;;
|
||||
shutdown)
|
||||
exec systemctl poweroff -i;;
|
||||
esac
|
13
desktop/.config/waybar/scripts/weather.sh
Executable file
13
desktop/.config/waybar/scripts/weather.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
LOC="$1"
|
||||
# HTML encode string as %20
|
||||
LOCATION=$(sed -e "s/ /%20/g" <<<"$LOC")
|
||||
content=$(curl -sS "https://thisdavej.azurewebsites.net/api/weather/current?loc=$LOCATION°=C")
|
||||
ICON=$(curl -s 'https://wttr.in/?format=1' | sed 's/[+0-9a-cA-Z°-]//g' )
|
||||
# echo $ICON
|
||||
TEMP=$(echo $content | jq -r '. | "\(.temperature)°\(.degType)"' | sed 's/"//g')
|
||||
TOOLTIP=$(echo $content | jq -r '. | "\(.temperature)°\(.degType)\n\(.skytext)"' | sed 's/"//g')
|
||||
CLASS=$(echo $content | jq .skytext)
|
||||
echo '{"text": "'$TEMP'", "tooltip": "'$ICON $TOOLTIP $LOC'", "class": '$CLASS' }'
|
||||
|
197
desktop/.config/waybar/style.css
Normal file
197
desktop/.config/waybar/style.css
Normal file
|
@ -0,0 +1,197 @@
|
|||
* {
|
||||
border: none;
|
||||
/* border-radius: 10; */
|
||||
font-family: "Symbols Nerd Font", "monospace";
|
||||
font-size: 12px;
|
||||
min-height: 18px;
|
||||
}
|
||||
|
||||
.bold {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
#clock,
|
||||
#battery,
|
||||
#tray,
|
||||
#idle_inhibitor,
|
||||
#pulseaudio,
|
||||
#backlight,
|
||||
#mpris,
|
||||
#custom-power,
|
||||
#custom-grimshot,
|
||||
#custom-notification {
|
||||
color: @foreground;
|
||||
background: @background;
|
||||
margin-left: 0px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
margin-bottom: 0px;
|
||||
border-radius: 10px;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
window#waybar.hidden {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
#window {
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
border-radius: 10px;
|
||||
transition: none;
|
||||
color: @foreground;
|
||||
background: @background;
|
||||
}
|
||||
|
||||
window#waybar.empty {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
window#waybar.empty #window {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
border: 0px;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
#workspaces {
|
||||
font-size: 16px;
|
||||
border-radius: 10px;
|
||||
background: @background;
|
||||
transition: none;
|
||||
padding: 0 6px;
|
||||
}
|
||||
|
||||
#workspaces button {
|
||||
color: @foreground;
|
||||
border-radius: 2px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#workspaces button:active {
|
||||
color: inherit;
|
||||
background-color: #4b4e5e;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
#workspaces button:hover {
|
||||
transition: none;
|
||||
background-color: #4b4e5e;
|
||||
}
|
||||
|
||||
#workspaces button.focused {
|
||||
border: 2px solid blue;
|
||||
border-top: 0;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
#workspaces button.urgent {
|
||||
background: @color1;
|
||||
color: @background;
|
||||
}
|
||||
|
||||
#workspaces button.occupied {
|
||||
background-color: @color1;
|
||||
font-size: 4px;
|
||||
}
|
||||
|
||||
#window {
|
||||
border: 2px solid #9C59D1;
|
||||
border-top: 0;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
#mpris {
|
||||
background-color: @background;
|
||||
color: #ffef97;
|
||||
border: 2px solid #ffef97;
|
||||
}
|
||||
|
||||
#idle_inhibitor {
|
||||
background-color: @background;
|
||||
color: #f697ff;
|
||||
border: 2px solid #f697ff;
|
||||
}
|
||||
|
||||
#pulseaudio {
|
||||
background-color: @background;
|
||||
color: #c497ff;
|
||||
border: 2px solid #c497ff;
|
||||
/* padding-right: 12px; */
|
||||
}
|
||||
|
||||
#battery {
|
||||
background-color: @background;
|
||||
color: #97c4ff;
|
||||
border: 2px solid #97c4ff;
|
||||
/* padding-right: 16px; */
|
||||
}
|
||||
|
||||
#battery.warning {
|
||||
background-color: #fff677;
|
||||
color: @background;
|
||||
}
|
||||
|
||||
#battery.critical:not(.charging) {
|
||||
animation-name: blink;
|
||||
animation-duration: 0.5s;
|
||||
animation-timing-function: linear;
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: alternate;
|
||||
}
|
||||
|
||||
@keyframes blink {
|
||||
to {
|
||||
background-color: #BF616A;
|
||||
color: #B5E8E0;
|
||||
}
|
||||
}
|
||||
|
||||
#backlight {
|
||||
background-color: @background;
|
||||
color: #97fff1;
|
||||
border: 2px solid #97fff1;
|
||||
/* padding-right: 12px; */
|
||||
}
|
||||
|
||||
#clock {
|
||||
background-color: @background;
|
||||
color: #97ffa0;
|
||||
border: 2px solid #97ffa0;
|
||||
}
|
||||
|
||||
#custom-power {
|
||||
background-color: @background;
|
||||
color: #ffef97;
|
||||
border: 2px solid #ffef97;
|
||||
}
|
||||
|
||||
#custom-grimshot {
|
||||
background-color: @background;
|
||||
color: #ffb897;
|
||||
border: 2px solid #ffb897;
|
||||
/* padding-right: 14px; */
|
||||
}
|
||||
|
||||
#custom-notification {
|
||||
background-color: @background;
|
||||
color: #ff9797;
|
||||
border: 2px solid #ff9797;
|
||||
}
|
||||
|
||||
|
||||
#tray {
|
||||
/* background-color: #ff8282; */
|
||||
padding-right: 10px;
|
||||
|
||||
border: 2px solid #5BCEFA;
|
||||
border-top: 0;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
}
|
2
desktop/.emacs.d/auto-save-list/.saves-12876-archlive~
Normal file
2
desktop/.emacs.d/auto-save-list/.saves-12876-archlive~
Normal file
|
@ -0,0 +1,2 @@
|
|||
/home/andrea/cloudstorage/cloud.carduccidante.edu.it/Presidenza/Sorgenti/relazione_finale_sostegno_inviti/main.go
|
||||
/home/andrea/cloudstorage/cloud.carduccidante.edu.it/Presidenza/Sorgenti/relazione_finale_sostegno_inviti/#main.go#
|
4
desktop/.emacs.d/auto-save-list/.saves-13882-archlive~
Normal file
4
desktop/.emacs.d/auto-save-list/.saves-13882-archlive~
Normal file
|
@ -0,0 +1,4 @@
|
|||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/sandbox/probo-test/data/scripts/assessments.tengo
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/sandbox/probo-test/data/scripts/#assessments.tengo#
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/sandbox/probo-test/6
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/sandbox/probo-test/#6#
|
4
desktop/.emacs.d/auto-save-list/.saves-1786-archlive~
Normal file
4
desktop/.emacs.d/auto-save-list/.saves-1786-archlive~
Normal file
|
@ -0,0 +1,4 @@
|
|||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/probo/cmd/rank/rank.go
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/probo/cmd/rank/#rank.go#
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/probo/pkg/models/response.go
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/probo/pkg/models/#response.go#
|
20
desktop/.emacs.d/auto-save-list/.saves-2079-archlive~
Normal file
20
desktop/.emacs.d/auto-save-list/.saves-2079-archlive~
Normal file
|
@ -0,0 +1,20 @@
|
|||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/probo/cmd/session/session.go
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/probo/cmd/session/#session.go#
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/sugarfoam/components/viewport/viewport.go
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/sugarfoam/components/viewport/#viewport.go#
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/sandbox/sf-table/main.go
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/sandbox/sf-table/#main.go#
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/probo/go.work
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/probo/#go.work#
|
||||
/home/andrea/go/pkg/mod/github.com/charmbracelet/bubbles@v0.18.1-0.20240309002305-b9e62cbfe181/viewport/viewport.go
|
||||
/home/andrea/go/pkg/mod/github.com/charmbracelet/bubbles@v0.18.1-0.20240309002305-b9e62cbfe181/viewport/#viewport.go#
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/sandbox/probo-test/data/json/math_test.json
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/sandbox/probo-test/data/json/#math_test.json#
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/sugarfoam/components/table/table.go
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/sugarfoam/components/table/#table.go#
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/sugarfoam/examples/starwars/main.go
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/sugarfoam/examples/starwars/#main.go#
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/probo/cmd/filter/filter.go
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/probo/cmd/filter/#filter.go#
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/sandbox/probo-test/data/participants/charles.json
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/sandbox/probo-test/data/participants/#charles.json#
|
4
desktop/.emacs.d/auto-save-list/.saves-2559-archlive~
Normal file
4
desktop/.emacs.d/auto-save-list/.saves-2559-archlive~
Normal file
|
@ -0,0 +1,4 @@
|
|||
/home/andrea/cloudstorage/cloud.carduccidante.edu.it/Presidenza/Sorgenti/documento_15_maggio/main.go
|
||||
/home/andrea/cloudstorage/cloud.carduccidante.edu.it/Presidenza/Sorgenti/documento_15_maggio/#main.go#
|
||||
/home/andrea/cloudstorage/cloud.carduccidante.edu.it/Presidenza/Sorgenti/documento_15_maggio/documento_15_maggio.md
|
||||
/home/andrea/cloudstorage/cloud.carduccidante.edu.it/Presidenza/Sorgenti/documento_15_maggio/#documento_15_maggio.md#
|
2
desktop/.emacs.d/auto-save-list/.saves-4658-archlive~
Normal file
2
desktop/.emacs.d/auto-save-list/.saves-4658-archlive~
Normal file
|
@ -0,0 +1,2 @@
|
|||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/probo/pkg/store/file/file.go
|
||||
/home/andrea/cloudstorage/housecloud.andreafazzi.eu/dev/probo/pkg/store/file/#file.go#
|
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/.yas-setup-3079b6b0-b4a974a6.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/.yas-setup-3079b6b0-b4a974a6.eln
Executable file
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-706f6804-7352d0d5.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-706f6804-7352d0d5.eln
Executable file
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-bbdb-6a994888-91c0dccf.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-bbdb-6a994888-91c0dccf.eln
Executable file
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-capf-a8a64fbf-1f5b5ace.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-capf-a8a64fbf-1f5b5ace.eln
Executable file
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-clang-5a00ee36-93b0806b.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-clang-5a00ee36-93b0806b.eln
Executable file
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-cmake-9d96a3b3-37adefb7.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-cmake-9d96a3b3-37adefb7.eln
Executable file
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-dabbrev-2de7cd3e-1ca754cd.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-dabbrev-2de7cd3e-1ca754cd.eln
Executable file
Binary file not shown.
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-etags-55bae33d-c29954e0.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-etags-55bae33d-c29954e0.eln
Executable file
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-files-b3e63d11-f78d7f88.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-files-b3e63d11-f78d7f88.eln
Executable file
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-gtags-402207c8-db3f0de4.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-gtags-402207c8-db3f0de4.eln
Executable file
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-keywords-e59fb2f6-0dafc33e.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-keywords-e59fb2f6-0dafc33e.eln
Executable file
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-oddmuse-3d9ab06f-6731a06a.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-oddmuse-3d9ab06f-6731a06a.eln
Executable file
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-semantic-783be358-a573f90d.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-semantic-783be358-a573f90d.eln
Executable file
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-template-bd5d7407-18d25400.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/company-template-bd5d7407-18d25400.eln
Executable file
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/go-mode-e758c47c-936c298c.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/go-mode-e758c47c-936c298c.eln
Executable file
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/jq-mode-b72bba20-7965373e.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/jq-mode-b72bba20-7965373e.eln
Executable file
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/json-mode-bb36e9fb-4209de01.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/json-mode-bb36e9fb-4209de01.eln
Executable file
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/json-snatcher-3e89f511-acdf01a2.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/json-snatcher-3e89f511-acdf01a2.eln
Executable file
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/markdown-mode-85d07a9e-db5cd8cb.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/markdown-mode-85d07a9e-db5cd8cb.eln
Executable file
Binary file not shown.
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/yasnippet-67ff3bbf-4d6a8b58.eln
Executable file
BIN
desktop/.emacs.d/eln-cache/29.3-4b59e32f/yasnippet-67ff3bbf-4d6a8b58.eln
Executable file
Binary file not shown.
Binary file not shown.
4982
desktop/.emacs.d/elpa/archives/gnu/archive-contents
Normal file
4982
desktop/.emacs.d/elpa/archives/gnu/archive-contents
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1 @@
|
|||
Good signature from 645357D2883A0966 GNU ELPA Signing Agent (2023) <elpasign@elpa.gnu.org> (trust undefined) created at 2024-06-26T11:05:03+0200 using EDDSA
|
5780
desktop/.emacs.d/elpa/archives/melpa/archive-contents
Normal file
5780
desktop/.emacs.d/elpa/archives/melpa/archive-contents
Normal file
File diff suppressed because it is too large
Load diff
2609
desktop/.emacs.d/elpa/archives/nongnu/archive-contents
Normal file
2609
desktop/.emacs.d/elpa/archives/nongnu/archive-contents
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1 @@
|
|||
Good signature from 645357D2883A0966 GNU ELPA Signing Agent (2023) <elpasign@elpa.gnu.org> (trust undefined) created at 2024-06-26T11:10:04+0200 using EDDSA
|
54
desktop/.emacs.d/elpa/company-20240625.0/company-abbrev.el
Normal file
54
desktop/.emacs.d/elpa/company-20240625.0/company-abbrev.el
Normal file
|
@ -0,0 +1,54 @@
|
|||
;;; company-abbrev.el --- company-mode completion backend for abbrev -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2015, 2021, 2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'company)
|
||||
(require 'cl-lib)
|
||||
(require 'abbrev)
|
||||
|
||||
(defun company-abbrev-insert (_match)
|
||||
"Replace MATCH with the expanded abbrev."
|
||||
(expand-abbrev))
|
||||
|
||||
;;;###autoload
|
||||
(defun company-abbrev (command &optional arg &rest _ignored)
|
||||
"`company-mode' completion backend for abbrev."
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-abbrev
|
||||
'company-abbrev-insert))
|
||||
(prefix (company-grab-symbol))
|
||||
(candidates (apply
|
||||
#'nconc
|
||||
(mapcar (lambda (table)
|
||||
(delete "" (all-completions arg table)))
|
||||
(abbrev--active-tables))))
|
||||
(kind 'snippet)
|
||||
(meta (abbrev-expansion arg))
|
||||
(post-completion (expand-abbrev))))
|
||||
|
||||
(provide 'company-abbrev)
|
||||
;;; company-abbrev.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-abbrev.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-abbrev.elc
Normal file
Binary file not shown.
324
desktop/.emacs.d/elpa/company-20240625.0/company-autoloads.el
Normal file
324
desktop/.emacs.d/elpa/company-20240625.0/company-autoloads.el
Normal file
|
@ -0,0 +1,324 @@
|
|||
;;; company-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*-
|
||||
;; Generated by the `loaddefs-generate' function.
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path)))
|
||||
|
||||
|
||||
|
||||
;;; Generated autoloads from company.el
|
||||
|
||||
(autoload 'company-mode "company" "\
|
||||
\"complete anything\"; is an in-buffer completion framework.
|
||||
|
||||
Completion starts automatically, depending on the values
|
||||
`company-idle-delay' and `company-minimum-prefix-length'.
|
||||
|
||||
Completion can be controlled with the commands:
|
||||
`company-complete-common', `company-complete-selection', `company-complete',
|
||||
`company-select-next', `company-select-previous'. If these commands are
|
||||
called before `company-idle-delay', completion will also start.
|
||||
|
||||
Completions can be searched with `company-search-candidates' or
|
||||
`company-filter-candidates'. These can be used while completion is
|
||||
inactive, as well.
|
||||
|
||||
The completion data is retrieved using `company-backends' and displayed
|
||||
using `company-frontends'. If you want to start a specific backend, call
|
||||
it interactively or use `company-begin-backend'.
|
||||
|
||||
By default, the completions list is sorted alphabetically, unless the
|
||||
backend chooses otherwise, or `company-transformers' changes it later.
|
||||
|
||||
regular keymap (`company-mode-map'):
|
||||
|
||||
\\{company-mode-map}
|
||||
keymap during active completions (`company-active-map'):
|
||||
|
||||
\\{company-active-map}
|
||||
|
||||
This is a minor mode. If called interactively, toggle the
|
||||
`Company mode' mode. If the prefix argument is positive, enable
|
||||
the mode, and if it is zero or negative, disable the mode.
|
||||
|
||||
If called from Lisp, toggle the mode if ARG is `toggle'. Enable
|
||||
the mode if ARG is nil, omitted, or is a positive number.
|
||||
Disable the mode if ARG is a negative number.
|
||||
|
||||
To check whether the minor mode is enabled in the current buffer,
|
||||
evaluate `company-mode'.
|
||||
|
||||
The mode's hook is called both when the mode is enabled and when
|
||||
it is disabled.
|
||||
|
||||
(fn &optional ARG)" t)
|
||||
(put 'global-company-mode 'globalized-minor-mode t)
|
||||
(defvar global-company-mode nil "\
|
||||
Non-nil if Global Company mode is enabled.
|
||||
See the `global-company-mode' command
|
||||
for a description of this minor mode.
|
||||
Setting this variable directly does not take effect;
|
||||
either customize it (see the info node `Easy Customization')
|
||||
or call the function `global-company-mode'.")
|
||||
(custom-autoload 'global-company-mode "company" nil)
|
||||
(autoload 'global-company-mode "company" "\
|
||||
Toggle Company mode in all buffers.
|
||||
With prefix ARG, enable Global Company mode if ARG is positive;
|
||||
otherwise, disable it.
|
||||
|
||||
If called from Lisp, toggle the mode if ARG is `toggle'.
|
||||
Enable the mode if ARG is nil, omitted, or is a positive number.
|
||||
Disable the mode if ARG is a negative number.
|
||||
|
||||
Company mode is enabled in all buffers where `company-mode-on' would
|
||||
do it.
|
||||
|
||||
See `company-mode' for more information on Company mode.
|
||||
|
||||
(fn &optional ARG)" t)
|
||||
(autoload 'company-manual-begin "company" "\
|
||||
Start the completion interface.
|
||||
|
||||
Unlike `company-complete-selection' or `company-complete', this command
|
||||
doesn't cause any immediate changes to the buffer text." t)
|
||||
(autoload 'company-complete "company" "\
|
||||
Insert the common part of all candidates or the current selection.
|
||||
The first time this is called, the common part is inserted, the second
|
||||
time, or when the selection has been changed, the selected candidate is
|
||||
inserted." t)
|
||||
(register-definition-prefixes "company" '("company-"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-abbrev.el
|
||||
|
||||
(autoload 'company-abbrev "company-abbrev" "\
|
||||
`company-mode' completion backend for abbrev.
|
||||
|
||||
(fn COMMAND &optional ARG &rest IGNORED)" t)
|
||||
(register-definition-prefixes "company-abbrev" '("company-abbrev-insert"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-bbdb.el
|
||||
|
||||
(autoload 'company-bbdb "company-bbdb" "\
|
||||
`company-mode' completion backend for BBDB.
|
||||
|
||||
(fn COMMAND &optional ARG &rest IGNORE)" t)
|
||||
(register-definition-prefixes "company-bbdb" '("company-bbdb-"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-capf.el
|
||||
|
||||
(register-definition-prefixes "company-capf" '("company-"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-clang.el
|
||||
|
||||
(register-definition-prefixes "company-clang" '("company-clang"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-cmake.el
|
||||
|
||||
(register-definition-prefixes "company-cmake" '("company-cmake"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-css.el
|
||||
|
||||
(autoload 'company-css "company-css" "\
|
||||
`company-mode' completion backend for `css-mode'.
|
||||
|
||||
(fn COMMAND &optional ARG &rest IGNORED)" t)
|
||||
(register-definition-prefixes "company-css" '("company-css-"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-dabbrev.el
|
||||
|
||||
(autoload 'company-dabbrev "company-dabbrev" "\
|
||||
dabbrev-like `company-mode' completion backend.
|
||||
|
||||
(fn COMMAND &optional ARG &rest IGNORED)" t)
|
||||
(register-definition-prefixes "company-dabbrev" '("company-dabbrev-"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-dabbrev-code.el
|
||||
|
||||
(autoload 'company-dabbrev-code "company-dabbrev-code" "\
|
||||
dabbrev-like `company-mode' backend for code.
|
||||
The backend looks for all symbols in the current buffer that aren't in
|
||||
comments or strings.
|
||||
|
||||
(fn COMMAND &optional ARG &rest IGNORED)" t)
|
||||
(register-definition-prefixes "company-dabbrev-code" '("company-dabbrev-code-"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-etags.el
|
||||
|
||||
(autoload 'company-etags "company-etags" "\
|
||||
`company-mode' completion backend for etags.
|
||||
|
||||
(fn COMMAND &optional ARG &rest IGNORED)" t)
|
||||
(register-definition-prefixes "company-etags" '("company-etags-"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-files.el
|
||||
|
||||
(autoload 'company-files "company-files" "\
|
||||
`company-mode' completion backend existing file names.
|
||||
Completions works for proper absolute and relative files paths.
|
||||
File paths with spaces are only supported inside strings.
|
||||
|
||||
(fn COMMAND &optional ARG &rest IGNORED)" t)
|
||||
(register-definition-prefixes "company-files" '("company-file"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-gtags.el
|
||||
|
||||
(autoload 'company-gtags "company-gtags" "\
|
||||
`company-mode' completion backend for GNU Global.
|
||||
|
||||
(fn COMMAND &optional ARG &rest IGNORED)" t)
|
||||
(register-definition-prefixes "company-gtags" '("company-gtags-"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-ispell.el
|
||||
|
||||
(autoload 'company-ispell "company-ispell" "\
|
||||
`company-mode' completion backend using Ispell.
|
||||
|
||||
(fn COMMAND &optional ARG &rest IGNORED)" t)
|
||||
(register-definition-prefixes "company-ispell" '("company-"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-keywords.el
|
||||
|
||||
(autoload 'company-keywords "company-keywords" "\
|
||||
`company-mode' backend for programming language keywords.
|
||||
|
||||
(fn COMMAND &optional ARG &rest IGNORED)" t)
|
||||
(register-definition-prefixes "company-keywords" '("company-keywords-"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-nxml.el
|
||||
|
||||
(autoload 'company-nxml "company-nxml" "\
|
||||
`company-mode' completion backend for `nxml-mode'.
|
||||
|
||||
(fn COMMAND &optional ARG &rest IGNORED)" t)
|
||||
(register-definition-prefixes "company-nxml" '("company-nxml-"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-oddmuse.el
|
||||
|
||||
(autoload 'company-oddmuse "company-oddmuse" "\
|
||||
`company-mode' completion backend for `oddmuse-mode'.
|
||||
|
||||
(fn COMMAND &optional ARG &rest IGNORED)" t)
|
||||
(register-definition-prefixes "company-oddmuse" '("company-oddmuse-"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-semantic.el
|
||||
|
||||
(autoload 'company-semantic "company-semantic" "\
|
||||
`company-mode' completion backend using CEDET Semantic.
|
||||
|
||||
(fn COMMAND &optional ARG &rest IGNORED)" t)
|
||||
(register-definition-prefixes "company-semantic" '("company-semantic-"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-template.el
|
||||
|
||||
(register-definition-prefixes "company-template" '("company-template-"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-tempo.el
|
||||
|
||||
(autoload 'company-tempo "company-tempo" "\
|
||||
`company-mode' completion backend for tempo.
|
||||
|
||||
(fn COMMAND &optional ARG &rest IGNORED)" t)
|
||||
(register-definition-prefixes "company-tempo" '("company-tempo-"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-tng.el
|
||||
|
||||
(autoload 'company-tng-frontend "company-tng" "\
|
||||
When the user changes the selection at least once, this
|
||||
frontend will display the candidate in the buffer as if it's
|
||||
already there and any key outside of `company-active-map' will
|
||||
confirm the selection and finish the completion.
|
||||
|
||||
(fn COMMAND)")
|
||||
(define-obsolete-function-alias 'company-tng-configure-default 'company-tng-mode "0.10.0" "Applies the default configuration to enable company-tng.")
|
||||
(defvar company-tng-mode nil "\
|
||||
Non-nil if Company-Tng mode is enabled.
|
||||
See the `company-tng-mode' command
|
||||
for a description of this minor mode.
|
||||
Setting this variable directly does not take effect;
|
||||
either customize it (see the info node `Easy Customization')
|
||||
or call the function `company-tng-mode'.")
|
||||
(custom-autoload 'company-tng-mode "company-tng" nil)
|
||||
(autoload 'company-tng-mode "company-tng" "\
|
||||
This minor mode enables `company-tng-frontend'.
|
||||
|
||||
This is a global minor mode. If called interactively, toggle the
|
||||
`Company-Tng mode' mode. If the prefix argument is positive,
|
||||
enable the mode, and if it is zero or negative, disable the mode.
|
||||
|
||||
If called from Lisp, toggle the mode if ARG is `toggle'. Enable
|
||||
the mode if ARG is nil, omitted, or is a positive number.
|
||||
Disable the mode if ARG is a negative number.
|
||||
|
||||
To check whether the minor mode is enabled in the current buffer,
|
||||
evaluate `(default-value \\='company-tng-mode)'.
|
||||
|
||||
The mode's hook is called both when the mode is enabled and when
|
||||
it is disabled.
|
||||
|
||||
(fn &optional ARG)" t)
|
||||
(register-definition-prefixes "company-tng" '("company-tng-"))
|
||||
|
||||
|
||||
;;; Generated autoloads from company-yasnippet.el
|
||||
|
||||
(autoload 'company-yasnippet "company-yasnippet" "\
|
||||
`company-mode' backend for `yasnippet'.
|
||||
|
||||
This backend should be used with care, because as long as there are
|
||||
snippets defined for the current major mode, this backend will always
|
||||
shadow backends that come after it. Recommended usages:
|
||||
|
||||
* In a buffer-local value of `company-backends', grouped with a backend or
|
||||
several that provide actual text completions.
|
||||
|
||||
(add-hook \\='js-mode-hook
|
||||
(lambda ()
|
||||
(set (make-local-variable \\='company-backends)
|
||||
\\='((company-dabbrev-code company-yasnippet)))))
|
||||
|
||||
* After keyword `:with', grouped with other backends.
|
||||
|
||||
(push \\='(company-semantic :with company-yasnippet) company-backends)
|
||||
|
||||
* Not in `company-backends', just bound to a key.
|
||||
|
||||
(global-set-key (kbd \"C-c y\") \\='company-yasnippet)
|
||||
|
||||
(fn COMMAND &optional ARG &rest IGNORE)" t)
|
||||
(register-definition-prefixes "company-yasnippet" '("company-yasnippet-"))
|
||||
|
||||
;;; End of scraped data
|
||||
|
||||
(provide 'company-autoloads)
|
||||
|
||||
;; Local Variables:
|
||||
;; version-control: never
|
||||
;; no-byte-compile: t
|
||||
;; no-update-autoloads: t
|
||||
;; no-native-compile: t
|
||||
;; coding: utf-8-emacs-unix
|
||||
;; End:
|
||||
|
||||
;;; company-autoloads.el ends here
|
63
desktop/.emacs.d/elpa/company-20240625.0/company-bbdb.el
Normal file
63
desktop/.emacs.d/elpa/company-20240625.0/company-bbdb.el
Normal file
|
@ -0,0 +1,63 @@
|
|||
;;; company-bbdb.el --- company-mode completion backend for BBDB in message-mode -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2013-2016, 2020, 2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Jan Tatarik <jan.tatarik@gmail.com>
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
(require 'company)
|
||||
(require 'cl-lib)
|
||||
|
||||
(declare-function bbdb-record-get-field "bbdb")
|
||||
(declare-function bbdb-dwim-mail "bbdb-com")
|
||||
|
||||
(defgroup company-bbdb nil
|
||||
"Completion backend for BBDB."
|
||||
:group 'company)
|
||||
|
||||
(defcustom company-bbdb-modes '(message-mode)
|
||||
"Major modes in which `company-bbdb' may complete."
|
||||
:type '(repeat (symbol :tag "Major mode"))
|
||||
:package-version '(company . "0.8.8"))
|
||||
|
||||
(defun company-bbdb--candidates (arg)
|
||||
(cl-mapcan (lambda (record)
|
||||
(mapcar (lambda (mail) (bbdb-dwim-mail record mail))
|
||||
(bbdb-record-get-field record 'mail)))
|
||||
(eval `(let ((arg ,arg))
|
||||
(bbdb-search (bbdb-records) :all-names arg :mail arg))
|
||||
t)))
|
||||
|
||||
;;;###autoload
|
||||
(defun company-bbdb (command &optional arg &rest _ignore)
|
||||
"`company-mode' completion backend for BBDB."
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-bbdb))
|
||||
(prefix (and (memq major-mode company-bbdb-modes)
|
||||
(featurep 'bbdb-com)
|
||||
(let ((case-fold-search t))
|
||||
(looking-back
|
||||
"^\\([^ :]*-\\)?\\(To\\|B?Cc\\|From\\):.*? *\\([^,;]*\\)"
|
||||
(line-beginning-position)))
|
||||
(match-string-no-properties 3)))
|
||||
(candidates (company-bbdb--candidates arg))
|
||||
(sorted t)
|
||||
(no-cache t)))
|
||||
|
||||
(provide 'company-bbdb)
|
||||
;;; company-bbdb.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-bbdb.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-bbdb.elc
Normal file
Binary file not shown.
244
desktop/.emacs.d/elpa/company-20240625.0/company-capf.el
Normal file
244
desktop/.emacs.d/elpa/company-20240625.0/company-capf.el
Normal file
|
@ -0,0 +1,244 @@
|
|||
;;; company-capf.el --- company-mode completion-at-point-functions backend -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2013-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; The CAPF back-end provides a bridge to the standard
|
||||
;; completion-at-point-functions facility, and thus can support any major mode
|
||||
;; that defines a proper completion function, including emacs-lisp-mode,
|
||||
;; css-mode and nxml-mode.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'company)
|
||||
(require 'cl-lib)
|
||||
|
||||
(defgroup company-capf nil
|
||||
"Completion backend as adapter for `completion-at-point-functions'."
|
||||
:group 'company)
|
||||
|
||||
(defcustom company-capf-disabled-functions '(tags-completion-at-point-function
|
||||
ispell-completion-at-point)
|
||||
"List of completion functions which should be ignored in this backend.
|
||||
|
||||
By default it contains the functions that duplicate the built-in backends
|
||||
but don't support the corresponding configuration options and/or alter the
|
||||
intended priority of the default backends' configuration."
|
||||
:type 'hook)
|
||||
|
||||
;; Amortizes several calls to a c-a-p-f from the same position.
|
||||
(defvar company--capf-cache nil)
|
||||
|
||||
;; FIXME: Provide a way to save this info once in Company itself
|
||||
;; (https://github.com/company-mode/company-mode/pull/845).
|
||||
(defvar-local company-capf--current-completion-data nil
|
||||
"Value last returned by `company-capf' when called with `candidates'.
|
||||
For most properties/actions, this is just what we need: the exact values
|
||||
that accompanied the completion table that's currently is use.
|
||||
|
||||
`company-capf', however, could be called at some different positions during
|
||||
a completion session (most importantly, by `company-sort-by-occurrence'),
|
||||
so we can't just use the preceding variable instead.")
|
||||
|
||||
(defvar-local company-capf--current-completion-metadata nil
|
||||
"Metadata computed with the current prefix and data above.")
|
||||
|
||||
(defun company--capf-data ()
|
||||
(let ((cache company--capf-cache))
|
||||
(if (and (equal (current-buffer) (car cache))
|
||||
(equal (point) (car (setq cache (cdr cache))))
|
||||
(equal (buffer-chars-modified-tick) (car (setq cache (cdr cache)))))
|
||||
(cadr cache)
|
||||
(let ((data (company--capf-data-real)))
|
||||
(setq company--capf-cache
|
||||
(list (current-buffer) (point) (buffer-chars-modified-tick) data))
|
||||
data))))
|
||||
|
||||
(defun company--capf-data-real ()
|
||||
(let ((data (run-hook-wrapped 'completion-at-point-functions
|
||||
;; Ignore disabled and misbehaving functions.
|
||||
#'company--capf-wrapper 'optimist)))
|
||||
(when (and (consp (cdr data)) (integer-or-marker-p (nth 1 data))) data)))
|
||||
|
||||
(defun company--capf-wrapper (fun which)
|
||||
;; E.g. tags-completion-at-point-function subverts company-etags in the
|
||||
;; default value of company-backends, where the latter comes later.
|
||||
(unless (memq fun company-capf-disabled-functions)
|
||||
(let ((buffer-read-only t)
|
||||
(inhibit-read-only nil)
|
||||
(completion-in-region-function
|
||||
(lambda (beg end coll pred)
|
||||
(throw 'company--illegal-completion-in-region
|
||||
(list fun beg end coll :predicate pred)))))
|
||||
(catch 'company--illegal-completion-in-region
|
||||
(condition-case nil
|
||||
(completion--capf-wrapper fun which)
|
||||
(buffer-read-only nil))))))
|
||||
|
||||
(declare-function python-shell-get-process "python")
|
||||
|
||||
(defun company-capf--save-current-data (data metadata)
|
||||
(setq company-capf--current-completion-data data
|
||||
company-capf--current-completion-metadata metadata)
|
||||
(add-hook 'company-after-completion-hook
|
||||
#'company-capf--clear-current-data nil t))
|
||||
|
||||
(defun company-capf--clear-current-data (_ignored)
|
||||
(setq company-capf--current-completion-data nil
|
||||
company-capf--current-completion-metadata nil))
|
||||
|
||||
(defvar-local company-capf--sorted nil)
|
||||
|
||||
(defun company-capf (command &optional arg &rest _args)
|
||||
"`company-mode' backend using `completion-at-point-functions'."
|
||||
(interactive (list 'interactive))
|
||||
(pcase command
|
||||
(`interactive (company-begin-backend 'company-capf))
|
||||
(`prefix
|
||||
(let ((res (company--capf-data)))
|
||||
(when res
|
||||
(let ((length (plist-get (nthcdr 4 res) :company-prefix-length))
|
||||
(prefix (buffer-substring-no-properties (nth 1 res) (point))))
|
||||
(cond
|
||||
((> (nth 2 res) (point)) 'stop)
|
||||
(length (cons prefix length))
|
||||
(t prefix))))))
|
||||
(`candidates
|
||||
(company-capf--candidates arg))
|
||||
(`sorted
|
||||
company-capf--sorted)
|
||||
(`match
|
||||
;; Ask the for the `:company-match' function. If that doesn't help,
|
||||
;; fallback to sniffing for face changes to get a suitable value.
|
||||
(let ((f (or (plist-get (nthcdr 4 company-capf--current-completion-data)
|
||||
:company-match)
|
||||
#'company--match-from-capf-face)))
|
||||
(funcall f arg)))
|
||||
(`duplicates t)
|
||||
(`no-cache t) ;Not much can be done here, as long as we handle
|
||||
;non-prefix matches.
|
||||
(`meta
|
||||
(let ((f (plist-get (nthcdr 4 company-capf--current-completion-data)
|
||||
:company-docsig)))
|
||||
(when f (funcall f arg))))
|
||||
(`doc-buffer
|
||||
(let ((f (plist-get (nthcdr 4 company-capf--current-completion-data)
|
||||
:company-doc-buffer)))
|
||||
(when f (funcall f arg))))
|
||||
(`location
|
||||
(let ((f (plist-get (nthcdr 4 company-capf--current-completion-data)
|
||||
:company-location)))
|
||||
(when f (funcall f arg))))
|
||||
(`annotation
|
||||
(company-capf--annotation arg))
|
||||
(`kind
|
||||
(let ((f (plist-get (nthcdr 4 company-capf--current-completion-data)
|
||||
:company-kind)))
|
||||
(when f (funcall f arg))))
|
||||
(`deprecated
|
||||
(let ((f (plist-get (nthcdr 4 company-capf--current-completion-data)
|
||||
:company-deprecated)))
|
||||
(when f (funcall f arg))))
|
||||
(`require-match
|
||||
(plist-get (nthcdr 4 (company--capf-data)) :company-require-match))
|
||||
(`init nil) ;Don't bother: plenty of other ways to initialize the code.
|
||||
(`post-completion
|
||||
(company--capf-post-completion arg))
|
||||
))
|
||||
|
||||
(defun company-capf--annotation (arg)
|
||||
(let* ((f (or (plist-get (nthcdr 4 company-capf--current-completion-data)
|
||||
:annotation-function)
|
||||
;; FIXME: Add a test.
|
||||
(cdr (assq 'annotation-function
|
||||
company-capf--current-completion-metadata))))
|
||||
(annotation (when f (funcall f arg))))
|
||||
(if (and company-format-margin-function
|
||||
(equal annotation " <f>") ; elisp-completion-at-point, pre-icons
|
||||
(plist-get (nthcdr 4 company-capf--current-completion-data)
|
||||
:company-kind))
|
||||
nil
|
||||
annotation)))
|
||||
|
||||
(defun company-capf--candidates (input)
|
||||
(let* ((res (company--capf-data))
|
||||
(table (nth 3 res))
|
||||
(pred (plist-get (nthcdr 4 res) :predicate))
|
||||
(meta (and res
|
||||
(completion-metadata
|
||||
(buffer-substring (nth 1 res) (nth 2 res))
|
||||
table pred))))
|
||||
(company-capf--save-current-data res meta)
|
||||
(when res
|
||||
(let* ((interrupt (plist-get (nthcdr 4 res) :company-use-while-no-input))
|
||||
(candidates (company-capf--candidates-1 input table pred
|
||||
(length input)
|
||||
meta
|
||||
(and non-essential
|
||||
(eq interrupt t))))
|
||||
(sortfun (cdr (assq 'display-sort-function meta)))
|
||||
(last (last candidates))
|
||||
(base-size (and (numberp (cdr last)) (cdr last))))
|
||||
(when base-size
|
||||
(setcdr last nil))
|
||||
(setq company-capf--sorted (functionp sortfun))
|
||||
(when sortfun
|
||||
(setq candidates (funcall sortfun candidates)))
|
||||
(if (not (zerop (or base-size 0)))
|
||||
(let ((before (substring input 0 base-size)))
|
||||
(mapcar (lambda (candidate)
|
||||
(concat before candidate))
|
||||
candidates))
|
||||
candidates)))))
|
||||
|
||||
(defun company-capf--candidates-1 (input table pred len meta interrupt-on-input)
|
||||
(if (not interrupt-on-input)
|
||||
(completion-all-completions input table pred len meta)
|
||||
(let (res)
|
||||
(and (while-no-input
|
||||
(setq res
|
||||
(completion-all-completions input table pred len meta))
|
||||
nil)
|
||||
(throw 'interrupted 'new-input))
|
||||
res)))
|
||||
|
||||
(defun company--capf-post-completion (arg)
|
||||
(let* ((res company-capf--current-completion-data)
|
||||
(exit-function (plist-get (nthcdr 4 res) :exit-function))
|
||||
(table (nth 3 res)))
|
||||
(if exit-function
|
||||
;; We can more or less know when the user is done with completion,
|
||||
;; so we do something different than `completion--done'.
|
||||
(funcall exit-function arg
|
||||
;; FIXME: Should probably use an additional heuristic:
|
||||
;; completion-at-point doesn't know when the user picked a
|
||||
;; particular candidate explicitly (it only checks whether
|
||||
;; further completions exist). Whereas company user can press
|
||||
;; RET (or use implicit completion with company-tng).
|
||||
(if (= (car (completion-boundaries arg table nil ""))
|
||||
(length arg))
|
||||
'sole
|
||||
'finished)))))
|
||||
|
||||
(provide 'company-capf)
|
||||
|
||||
;;; company-capf.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-capf.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-capf.elc
Normal file
Binary file not shown.
430
desktop/.emacs.d/elpa/company-20240625.0/company-clang.el
Normal file
430
desktop/.emacs.d/elpa/company-20240625.0/company-clang.el
Normal file
|
@ -0,0 +1,430 @@
|
|||
;;; company-clang.el --- company-mode completion backend for Clang -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'company)
|
||||
(require 'company-template)
|
||||
(require 'cl-lib)
|
||||
|
||||
(defgroup company-clang nil
|
||||
"Completion backend for Clang."
|
||||
:group 'company)
|
||||
|
||||
(defcustom company-clang-executable
|
||||
(executable-find "clang")
|
||||
"Location of clang executable."
|
||||
:type 'file)
|
||||
|
||||
(defcustom company-clang-begin-after-member-access t
|
||||
"When non-nil, start automatic completion after member access operators.
|
||||
|
||||
Automatic completion starts whenever the current symbol is preceded by
|
||||
\".\", \"->\" or \"::\", ignoring `company-minimum-prefix-length'.
|
||||
|
||||
If `company-begin-commands' is a list, it should include `c-electric-lt-gt'
|
||||
and `c-electric-colon', for automatic completion right after \">\" and
|
||||
\":\"."
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom company-clang-use-compile-flags-txt nil
|
||||
"When non-nil, use flags from compile_flags.txt if present.
|
||||
|
||||
The lines from that files will be appended to `company-clang-arguments'.
|
||||
|
||||
And if such file is found, Clang is called from the directory containing
|
||||
it. That allows the flags use relative file names within the project."
|
||||
:type 'boolean
|
||||
:safe 'booleanp)
|
||||
|
||||
(defcustom company-clang-arguments nil
|
||||
"A list of additional arguments to pass to clang when completing.
|
||||
Prefix files (-include ...) can be selected with `company-clang-set-prefix'
|
||||
or automatically through a custom `company-clang-prefix-guesser'."
|
||||
:type '(repeat (string :tag "Argument")))
|
||||
|
||||
(defcustom company-clang-prefix-guesser 'company-clang-guess-prefix
|
||||
"A function to determine the prefix file for the current buffer."
|
||||
:type '(function :tag "Guesser function" nil))
|
||||
|
||||
(defvar company-clang-modes '(c-mode c++-mode objc-mode)
|
||||
"Major modes which clang may complete.")
|
||||
|
||||
(defcustom company-clang-insert-arguments t
|
||||
"When non-nil, insert function arguments as a template after completion."
|
||||
:type 'boolean
|
||||
:package-version '(company . "0.8.0"))
|
||||
|
||||
;; prefix ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defvar company-clang--prefix nil)
|
||||
|
||||
(defsubst company-clang--guess-pch-file (file)
|
||||
(let ((dir (directory-file-name (file-name-directory file))))
|
||||
(when (equal (file-name-nondirectory dir) "Classes")
|
||||
(setq dir (file-name-directory dir)))
|
||||
(car (directory-files dir t "\\([^.]h\\|[^h]\\).pch\\'" t))))
|
||||
|
||||
(defsubst company-clang--file-substring (file beg end)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents-literally file nil beg end)
|
||||
(buffer-string)))
|
||||
|
||||
(defun company-clang-guess-prefix ()
|
||||
"Try to guess the prefix file for the current buffer."
|
||||
;; Prefixes seem to be called .pch. Pre-compiled headers do, too.
|
||||
;; So we look at the magic number to rule them out.
|
||||
(let* ((file (company-clang--guess-pch-file buffer-file-name))
|
||||
(magic-number (and file (company-clang--file-substring file 0 4))))
|
||||
(unless (member magic-number '("CPCH" "gpch"))
|
||||
file)))
|
||||
|
||||
(defun company-clang-set-prefix (&optional prefix)
|
||||
"Use PREFIX as a prefix (-include ...) file for clang completion."
|
||||
(interactive (let ((def (funcall company-clang-prefix-guesser)))
|
||||
(unless (stringp def)
|
||||
(setq def default-directory))
|
||||
(list (read-file-name "Prefix file: "
|
||||
(when def (file-name-directory def))
|
||||
def t (when def (file-name-nondirectory def))))))
|
||||
;; TODO: pre-compile?
|
||||
(setq company-clang--prefix (and (stringp prefix)
|
||||
(file-regular-p prefix)
|
||||
prefix)))
|
||||
|
||||
;; Clean-up on exit.
|
||||
(add-hook 'kill-emacs-hook 'company-clang-set-prefix)
|
||||
|
||||
;; parsing ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; Do we ever see OVERLOAD (or OVERRIDE)?
|
||||
(defconst company-clang--completion-pattern
|
||||
"^COMPLETION: \\_<\\(%s[a-zA-Z0-9_:]*\\|Pattern\\)\\(?:\\(?: (InBase)\\)? : \\(.*\\)$\\)?$")
|
||||
|
||||
(defconst company-clang--error-buffer-name "*clang-error*")
|
||||
|
||||
(defun company-clang--lang-option ()
|
||||
(if (eq major-mode 'objc-mode)
|
||||
(if (string= "m" (file-name-extension buffer-file-name))
|
||||
"objective-c" "objective-c++")
|
||||
(substring (symbol-name major-mode) 0 -5)))
|
||||
|
||||
(defun company-clang--parse-output (prefix _objc)
|
||||
(goto-char (point-min))
|
||||
(let ((pattern (format company-clang--completion-pattern
|
||||
(regexp-quote prefix)))
|
||||
(case-fold-search nil)
|
||||
(results (make-hash-table :test 'equal :size (/ (point-max) 100)))
|
||||
lines)
|
||||
(while (re-search-forward pattern nil t)
|
||||
(let ((match (match-string-no-properties 1))
|
||||
(meta (match-string-no-properties 2)))
|
||||
(when (equal match "Pattern")
|
||||
(setq match (company-clang--pattern-to-match meta)))
|
||||
(when (string-match ":" match)
|
||||
(setq match (substring match 0 (match-beginning 0))))
|
||||
;; Avoiding duplicates:
|
||||
;; https://github.com/company-mode/company-mode/issues/841
|
||||
(cond
|
||||
;; Either meta != completion (not a macro)
|
||||
((not (equal match meta))
|
||||
(puthash match meta results))
|
||||
;; Or it's the first time we see this completion
|
||||
((eq (gethash match results 'none) 'none)
|
||||
(puthash match nil results)))))
|
||||
(maphash
|
||||
(lambda (match meta)
|
||||
(when meta
|
||||
(put-text-property 0 1 'meta (company-clang--strip-formatting meta) match))
|
||||
(push match lines))
|
||||
results)
|
||||
lines))
|
||||
|
||||
(defun company-clang--pattern-to-match (pat)
|
||||
(let ((start 0)
|
||||
(end nil))
|
||||
(when (string-match "#]" pat)
|
||||
(setq start (match-end 0)))
|
||||
(when (string-match "[ \(]<#" pat start)
|
||||
(setq end (match-beginning 0)))
|
||||
(substring pat start end)))
|
||||
|
||||
(defun company-clang--meta (candidate)
|
||||
(get-text-property 0 'meta candidate))
|
||||
|
||||
(defun company-clang--annotation (candidate)
|
||||
(let ((ann (company-clang--annotation-1 candidate)))
|
||||
(if (not (and ann (string-prefix-p "(*)" ann)))
|
||||
ann
|
||||
(with-temp-buffer
|
||||
(insert ann)
|
||||
(search-backward ")")
|
||||
(let ((pt (1+ (point))))
|
||||
(re-search-forward ".\\_>" nil t)
|
||||
(delete-region pt (point)))
|
||||
(buffer-string)))))
|
||||
|
||||
;; TODO: Parse the original formatting here, rather than guess.
|
||||
;; Strip it every time in the `meta' handler instead.
|
||||
(defun company-clang--annotation-1 (candidate)
|
||||
(let ((meta (company-clang--meta candidate)))
|
||||
(cond
|
||||
((null meta) nil)
|
||||
((string-match "[^:]:[^:]" meta)
|
||||
(substring meta (1+ (match-beginning 0))))
|
||||
((string-match "(anonymous)" meta) nil)
|
||||
((string-match "\\((.*)[ a-z]*\\'\\)" meta)
|
||||
(let ((paren (match-beginning 1)))
|
||||
(if (not (eq (aref meta (1- paren)) ?>))
|
||||
(match-string 1 meta)
|
||||
(with-temp-buffer
|
||||
(insert meta)
|
||||
(goto-char paren)
|
||||
(substring meta (1- (search-backward "<"))))))))))
|
||||
|
||||
(defun company-clang--strip-formatting (text)
|
||||
(replace-regexp-in-string
|
||||
"#]" " "
|
||||
(replace-regexp-in-string "[<{[]#\\|#[>}]" "" text t)
|
||||
t))
|
||||
|
||||
(defun company-clang--handle-error (res args)
|
||||
(goto-char (point-min))
|
||||
(let* ((buf (get-buffer-create company-clang--error-buffer-name))
|
||||
(cmd (concat company-clang-executable " " (mapconcat 'identity args " ")))
|
||||
(pattern (format company-clang--completion-pattern ""))
|
||||
(message-truncate-lines t)
|
||||
(err (if (and (re-search-forward pattern nil t)
|
||||
;; Something in the Windows build?
|
||||
;; Looks like Clang doesn't always include the error text
|
||||
;; before completions (even if exited with error).
|
||||
(> (match-beginning 0) (point-min)))
|
||||
(buffer-substring-no-properties (point-min)
|
||||
(1- (match-beginning 0)))
|
||||
;; Warn the user more aggressively if no match was found.
|
||||
(message "clang failed with error %d: %s" res cmd)
|
||||
(buffer-string))))
|
||||
|
||||
(with-current-buffer buf
|
||||
(let ((inhibit-read-only t))
|
||||
(erase-buffer)
|
||||
(insert (current-time-string)
|
||||
(format "\nclang failed with error %d:\n" res)
|
||||
cmd "\n\n")
|
||||
(insert err)
|
||||
(setq buffer-read-only t)
|
||||
(goto-char (point-min))))))
|
||||
|
||||
(defun company-clang--start-process (prefix callback &rest args)
|
||||
(let* ((objc (derived-mode-p 'objc-mode))
|
||||
(buf (get-buffer-create "*clang-output*"))
|
||||
;; Looks unnecessary in Emacs 25.1 and later.
|
||||
;; (Inconclusive, needs more testing):
|
||||
;; https://github.com/company-mode/company-mode/pull/288#issuecomment-72491808
|
||||
(process-adaptive-read-buffering nil)
|
||||
(existing-process (get-buffer-process buf)))
|
||||
(when existing-process
|
||||
(kill-process existing-process))
|
||||
(with-current-buffer buf
|
||||
(erase-buffer)
|
||||
(setq buffer-undo-list t))
|
||||
(let* ((process-connection-type nil)
|
||||
(process (apply #'start-file-process "company-clang" buf
|
||||
company-clang-executable args)))
|
||||
(set-process-sentinel
|
||||
process
|
||||
(lambda (proc status)
|
||||
(unless (string-match-p "hangup\\|killed" status)
|
||||
(funcall
|
||||
callback
|
||||
(let ((res (process-exit-status proc)))
|
||||
(with-current-buffer buf
|
||||
(unless (eq 0 res)
|
||||
(company-clang--handle-error res args))
|
||||
;; Still try to get any useful input.
|
||||
(company-clang--parse-output prefix objc)))))))
|
||||
(unless (company-clang--auto-save-p)
|
||||
(send-region process (point-min) (point-max))
|
||||
(send-string process "\n")
|
||||
(process-send-eof process)))))
|
||||
|
||||
(defsubst company-clang--build-location (pos)
|
||||
(save-excursion
|
||||
(goto-char pos)
|
||||
(format "%s:%d:%d"
|
||||
(if (company-clang--auto-save-p) buffer-file-name "-")
|
||||
(line-number-at-pos)
|
||||
(1+ (length
|
||||
(encode-coding-region
|
||||
(line-beginning-position)
|
||||
(point)
|
||||
'utf-8
|
||||
t))))))
|
||||
|
||||
(defsubst company-clang--build-complete-args (pos)
|
||||
(append '("-fsyntax-only" "-Xclang" "-code-completion-macros")
|
||||
(unless (company-clang--auto-save-p)
|
||||
(list "-x" (company-clang--lang-option)))
|
||||
(company-clang--arguments)
|
||||
(when (stringp company-clang--prefix)
|
||||
(list "-include" (expand-file-name company-clang--prefix)))
|
||||
(list "-Xclang" (format "-code-completion-at=%s"
|
||||
(company-clang--build-location pos)))
|
||||
(list (if (company-clang--auto-save-p) buffer-file-name "-"))))
|
||||
|
||||
(defun company-clang--arguments ()
|
||||
(let ((fname "compile_flags.txt")
|
||||
(args company-clang-arguments)
|
||||
current-dir-rel)
|
||||
(when company-clang-use-compile-flags-txt
|
||||
(let ((dir (locate-dominating-file default-directory fname)))
|
||||
(when dir
|
||||
(setq current-dir-rel (file-relative-name default-directory dir))
|
||||
(setq default-directory dir)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents fname)
|
||||
(setq args
|
||||
(append
|
||||
args
|
||||
(split-string (buffer-substring-no-properties
|
||||
(point-min) (point-max))
|
||||
"[\n\r]+"
|
||||
t
|
||||
"[ \t]+"))))
|
||||
(unless (equal current-dir-rel "./")
|
||||
(push (format "-I%s" current-dir-rel) args)))))
|
||||
args))
|
||||
|
||||
(defun company-clang--candidates (prefix callback)
|
||||
(and (company-clang--auto-save-p)
|
||||
(buffer-modified-p)
|
||||
(basic-save-buffer))
|
||||
(when (null company-clang--prefix)
|
||||
(company-clang-set-prefix (or (funcall company-clang-prefix-guesser)
|
||||
'none)))
|
||||
(let ((default-directory default-directory))
|
||||
(apply 'company-clang--start-process
|
||||
prefix
|
||||
callback
|
||||
(company-clang--build-complete-args
|
||||
(if (company-clang--check-version 4.0 9.0)
|
||||
(point)
|
||||
(- (point) (length prefix)))))))
|
||||
|
||||
(defun company-clang--prefix ()
|
||||
(if company-clang-begin-after-member-access
|
||||
(company-grab-symbol-cons "\\.\\|->\\|::" 2)
|
||||
(company-grab-symbol)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defconst company-clang-required-version 1.1)
|
||||
|
||||
(defvar company-clang--version nil)
|
||||
|
||||
(defun company-clang--auto-save-p ()
|
||||
(not
|
||||
(company-clang--check-version 2.9 3.1)))
|
||||
|
||||
(defun company-clang--check-version (min apple-min)
|
||||
(pcase-exhaustive company-clang--version
|
||||
(`(apple . ,ver) (>= ver apple-min))
|
||||
(`(normal . ,ver) (>= ver min))))
|
||||
|
||||
(defsubst company-clang-version ()
|
||||
"Return the version of `company-clang-executable'."
|
||||
(with-temp-buffer
|
||||
(call-process company-clang-executable nil t nil "--version")
|
||||
(goto-char (point-min))
|
||||
(if (re-search-forward
|
||||
"\\(clang\\|Apple LLVM\\|bcc32x\\|bcc64\\) version \\([0-9.]+\\)" nil t)
|
||||
(cons
|
||||
(if (equal (match-string-no-properties 1) "Apple LLVM")
|
||||
'apple
|
||||
'normal)
|
||||
(string-to-number (match-string-no-properties 2)))
|
||||
0)))
|
||||
|
||||
(defun company-clang (command &optional arg &rest _ignored)
|
||||
"`company-mode' completion backend for Clang.
|
||||
Clang is a parser for C and ObjC. Clang version 1.1 or newer is required.
|
||||
|
||||
Additional command line arguments can be specified in
|
||||
`company-clang-arguments'. Prefix files (-include ...) can be selected
|
||||
with `company-clang-set-prefix' or automatically through a custom
|
||||
`company-clang-prefix-guesser'.
|
||||
|
||||
With Clang versions before 2.9, we have to save the buffer before
|
||||
performing completion. With Clang 2.9 and later, buffer contents are
|
||||
passed via standard input."
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-clang))
|
||||
(init (when (memq major-mode company-clang-modes)
|
||||
(unless company-clang-executable
|
||||
(error "Company found no clang executable"))
|
||||
(setq company-clang--version (company-clang-version))
|
||||
(unless (company-clang--check-version
|
||||
company-clang-required-version
|
||||
company-clang-required-version)
|
||||
(error "Company requires clang version %s"
|
||||
company-clang-required-version))))
|
||||
(prefix (and (memq major-mode company-clang-modes)
|
||||
buffer-file-name
|
||||
company-clang-executable
|
||||
(not (company-in-string-or-comment))
|
||||
(or (company-clang--prefix) 'stop)))
|
||||
(candidates (cons :async
|
||||
(lambda (cb) (company-clang--candidates arg cb))))
|
||||
(meta (company-clang--meta arg))
|
||||
(kind (company-clang--kind arg))
|
||||
(annotation (company-clang--annotation arg))
|
||||
(post-completion (let ((anno (company-clang--annotation arg)))
|
||||
(when (and company-clang-insert-arguments anno)
|
||||
(insert anno)
|
||||
(if (string-match "\\`:[^:]" anno)
|
||||
(company-template-objc-templatify anno)
|
||||
(company-template-c-like-templatify
|
||||
(concat arg anno))))))))
|
||||
|
||||
(defun company-clang--kind (arg)
|
||||
;; XXX: Not very precise.
|
||||
;; E.g. it will say that an arg-less ObjC method is a variable (perhaps we
|
||||
;; could look around for brackets, etc, if there any actual users who's
|
||||
;; bothered by it).
|
||||
;; And we can't distinguish between local vars and struct fields.
|
||||
;; Or between keywords and macros.
|
||||
(let ((meta (company-clang--meta arg)))
|
||||
(cond
|
||||
((null meta) 'keyword)
|
||||
((string-match "(" meta)
|
||||
(if (string-match-p (format "\\`%s *\\'" (regexp-quote arg))
|
||||
(substring meta 0 (match-beginning 0)))
|
||||
'keyword ; Also macro, actually (no return type).
|
||||
'function))
|
||||
(t 'variable))))
|
||||
|
||||
(provide 'company-clang)
|
||||
;;; company-clang.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-clang.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-clang.elc
Normal file
Binary file not shown.
205
desktop/.emacs.d/elpa/company-20240625.0/company-cmake.el
Normal file
205
desktop/.emacs.d/elpa/company-20240625.0/company-cmake.el
Normal file
|
@ -0,0 +1,205 @@
|
|||
;;; company-cmake.el --- company-mode completion backend for CMake -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2013-2015, 2017-2018, 2020, 2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Chen Bin <chenbin DOT sh AT gmail>
|
||||
;; Version: 0.2
|
||||
|
||||
;; 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 3 of the License, 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, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; company-cmake offers completions for module names, variable names and
|
||||
;; commands used by CMake. And their descriptions.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'company)
|
||||
(require 'cl-lib)
|
||||
|
||||
(defgroup company-cmake nil
|
||||
"Completion backend for CMake."
|
||||
:group 'company)
|
||||
|
||||
(defcustom company-cmake-executable
|
||||
(executable-find "cmake")
|
||||
"Location of cmake executable."
|
||||
:type 'file)
|
||||
|
||||
(defvar company-cmake-executable-arguments
|
||||
'("--help-command-list"
|
||||
"--help-module-list"
|
||||
"--help-property-list"
|
||||
"--help-variable-list")
|
||||
"The arguments we pass to cmake, separately.
|
||||
They affect which types of symbols we get completion candidates for.")
|
||||
|
||||
(defvar company-cmake--completion-pattern
|
||||
"^\\(%s[a-zA-Z0-9_<>]%s\\)$"
|
||||
"Regexp to match the candidates.")
|
||||
|
||||
(defvar company-cmake-modes '(cmake-mode cmake-ts-mode)
|
||||
"Major modes in which cmake may complete.")
|
||||
|
||||
(defvar company-cmake--candidates-cache nil
|
||||
"Cache for the raw candidates.")
|
||||
|
||||
(defvar company-cmake--meta-command-cache nil
|
||||
"Cache for command arguments to retrieve descriptions for the candidates.")
|
||||
|
||||
(defun company-cmake--replace-tags (rlt)
|
||||
(setq rlt (replace-regexp-in-string
|
||||
"\\(.*?\\(IS_GNU\\)?\\)<LANG>\\(.*\\)"
|
||||
(lambda (_match)
|
||||
(mapconcat 'identity
|
||||
(if (match-beginning 2)
|
||||
'("\\1CXX\\3" "\\1C\\3" "\\1G77\\3")
|
||||
'("\\1CXX\\3" "\\1C\\3" "\\1Fortran\\3"))
|
||||
"\n"))
|
||||
rlt t))
|
||||
(setq rlt (replace-regexp-in-string
|
||||
"\\(.*\\)<CONFIG>\\(.*\\)"
|
||||
(mapconcat 'identity '("\\1DEBUG\\2" "\\1RELEASE\\2"
|
||||
"\\1RELWITHDEBINFO\\2" "\\1MINSIZEREL\\2")
|
||||
"\n")
|
||||
rlt))
|
||||
rlt)
|
||||
|
||||
(defun company-cmake--fill-candidates-cache (arg)
|
||||
"Fill candidates cache if needed."
|
||||
(let (rlt)
|
||||
(unless company-cmake--candidates-cache
|
||||
(setq company-cmake--candidates-cache (make-hash-table :test 'equal)))
|
||||
|
||||
;; If hash is empty, fill it.
|
||||
(unless (gethash arg company-cmake--candidates-cache)
|
||||
(with-temp-buffer
|
||||
(let ((res (call-process company-cmake-executable nil t nil arg)))
|
||||
(unless (zerop res)
|
||||
(message "cmake executable exited with error=%d" res)))
|
||||
(setq rlt (buffer-string)))
|
||||
(setq rlt (company-cmake--replace-tags rlt))
|
||||
(puthash arg rlt company-cmake--candidates-cache))
|
||||
))
|
||||
|
||||
(defun company-cmake--parse (prefix content cmd)
|
||||
(let ((pattern (format company-cmake--completion-pattern
|
||||
(regexp-quote prefix)
|
||||
(if (zerop (length prefix)) "+" "*")))
|
||||
(lines (split-string content "\n"))
|
||||
rlt)
|
||||
(dolist (line lines)
|
||||
(when (string-match pattern line)
|
||||
(let ((match (match-string 1 line)))
|
||||
(when match
|
||||
(puthash match cmd company-cmake--meta-command-cache)
|
||||
(push match rlt)))))
|
||||
rlt))
|
||||
|
||||
(defun company-cmake--candidates (prefix)
|
||||
(let (results
|
||||
cmd-opts
|
||||
str)
|
||||
|
||||
(unless company-cmake--meta-command-cache
|
||||
(setq company-cmake--meta-command-cache (make-hash-table :test 'equal)))
|
||||
|
||||
(dolist (arg company-cmake-executable-arguments)
|
||||
(company-cmake--fill-candidates-cache arg)
|
||||
(setq cmd-opts (replace-regexp-in-string "-list$" "" arg) )
|
||||
|
||||
(setq str (gethash arg company-cmake--candidates-cache))
|
||||
(when str
|
||||
(setq results (nconc results
|
||||
(company-cmake--parse prefix str cmd-opts)))))
|
||||
results))
|
||||
|
||||
(defun company-cmake--unexpand-candidate (candidate)
|
||||
(cond
|
||||
((string-match "^CMAKE_\\(C\\|CXX\\|Fortran\\)\\(_.*\\)$" candidate)
|
||||
(setq candidate (concat "CMAKE_<LANG>" (match-string 2 candidate))))
|
||||
|
||||
;; C flags
|
||||
((string-match "^\\(.*_\\)IS_GNU\\(C\\|CXX\\|G77\\)$" candidate)
|
||||
(setq candidate (concat (match-string 1 candidate) "IS_GNU<LANG>")))
|
||||
|
||||
;; C flags
|
||||
((string-match "^\\(.*_\\)OVERRIDE_\\(C\\|CXX\\|Fortran\\)$" candidate)
|
||||
(setq candidate (concat (match-string 1 candidate) "OVERRIDE_<LANG>")))
|
||||
|
||||
((string-match "^\\(.*\\)\\(_DEBUG\\|_RELEASE\\|_RELWITHDEBINFO\\|_MINSIZEREL\\)\\(.*\\)$" candidate)
|
||||
(setq candidate (concat (match-string 1 candidate)
|
||||
"_<CONFIG>"
|
||||
(match-string 3 candidate)))))
|
||||
candidate)
|
||||
|
||||
(defun company-cmake--meta (candidate)
|
||||
(let ((cmd-opts (gethash candidate company-cmake--meta-command-cache))
|
||||
result)
|
||||
(setq candidate (company-cmake--unexpand-candidate candidate))
|
||||
|
||||
;; Don't cache the documentation of every candidate (command)
|
||||
;; Cache in this case will cost too much memory.
|
||||
(with-temp-buffer
|
||||
(call-process company-cmake-executable nil t nil cmd-opts candidate)
|
||||
;; Go to the third line, trim it and return the result.
|
||||
;; Tested with cmake 2.8.9.
|
||||
(goto-char (point-min))
|
||||
(forward-line 2)
|
||||
(setq result (buffer-substring-no-properties (line-beginning-position)
|
||||
(line-end-position)))
|
||||
(setq result (replace-regexp-in-string "^[ \t\n\r]+" "" result))
|
||||
result)))
|
||||
|
||||
(defun company-cmake--doc-buffer (candidate)
|
||||
(let ((cmd-opts (gethash candidate company-cmake--meta-command-cache)))
|
||||
|
||||
(setq candidate (company-cmake--unexpand-candidate candidate))
|
||||
(with-temp-buffer
|
||||
(call-process company-cmake-executable nil t nil cmd-opts candidate)
|
||||
;; Go to the third line, trim it and return the doc buffer.
|
||||
;; Tested with cmake 2.8.9.
|
||||
(goto-char (point-min))
|
||||
(forward-line 2)
|
||||
(company-doc-buffer
|
||||
(buffer-substring-no-properties (line-beginning-position)
|
||||
(point-max))))))
|
||||
|
||||
(defun company-cmake-prefix-dollar-brace-p ()
|
||||
"Test if the current symbol follows ${."
|
||||
(save-excursion
|
||||
(skip-syntax-backward "w_")
|
||||
(and (eq (char-before (point)) ?\{)
|
||||
(eq (char-before (1- (point))) ?$))))
|
||||
|
||||
(defun company-cmake (command &optional arg &rest _ignored)
|
||||
"`company-mode' completion backend for CMake.
|
||||
CMake is a cross-platform, open-source make system."
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-cmake))
|
||||
(init (when (memq major-mode company-cmake-modes)
|
||||
(unless company-cmake-executable
|
||||
(error "Company found no cmake executable"))))
|
||||
(prefix (and (memq major-mode company-cmake-modes)
|
||||
(or (not (company-in-string-or-comment))
|
||||
(company-cmake-prefix-dollar-brace-p))
|
||||
(company-grab-symbol)))
|
||||
(candidates (company-cmake--candidates arg))
|
||||
(meta (company-cmake--meta arg))
|
||||
(doc-buffer (company-cmake--doc-buffer arg))
|
||||
))
|
||||
|
||||
(provide 'company-cmake)
|
||||
;;; company-cmake.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-cmake.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-cmake.elc
Normal file
Binary file not shown.
446
desktop/.emacs.d/elpa/company-20240625.0/company-css.el
Normal file
446
desktop/.emacs.d/elpa/company-20240625.0/company-css.el
Normal file
|
@ -0,0 +1,446 @@
|
|||
;;; company-css.el --- company-mode completion backend for css-mode -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; In Emacs >= 26, company-capf is used instead.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'company)
|
||||
(require 'cl-lib)
|
||||
|
||||
(declare-function web-mode-language-at-pos "web-mode" (&optional pos))
|
||||
|
||||
(defconst company-css-property-alist
|
||||
;; see http://www.w3.org/TR/CSS21/propidx.html
|
||||
'(("azimuth" angle "left-side" "far-left" "left" "center-left" "center"
|
||||
"center-right" "right" "far-right" "right-side" "behind" "leftwards"
|
||||
"rightwards")
|
||||
("background" background-color background-image background-repeat
|
||||
background-attachment background-position
|
||||
background-clip background-origin background-size)
|
||||
("background-attachment" "scroll" "fixed")
|
||||
("background-color" color "transparent")
|
||||
("background-image" uri "none")
|
||||
("background-position" percentage length "left" "center" "right" percentage
|
||||
length "top" "center" "bottom" "left" "center" "right" "top" "center"
|
||||
"bottom")
|
||||
("background-repeat" "repeat" "repeat-x" "repeat-y" "no-repeat")
|
||||
("border" border-width border-style border-color)
|
||||
("border-bottom" border)
|
||||
("border-bottom-color" border-color)
|
||||
("border-bottom-style" border-style)
|
||||
("border-bottom-width" border-width)
|
||||
("border-collapse" "collapse" "separate")
|
||||
("border-color" color "transparent")
|
||||
("border-left" border)
|
||||
("border-left-color" border-color)
|
||||
("border-left-style" border-style)
|
||||
("border-left-width" border-width)
|
||||
("border-right" border)
|
||||
("border-right-color" border-color)
|
||||
("border-right-style" border-style)
|
||||
("border-right-width" border-width)
|
||||
("border-spacing" length length)
|
||||
("border-style" border-style)
|
||||
("border-top" border)
|
||||
("border-top-color" border-color)
|
||||
("border-top-style" border-style)
|
||||
("border-top-width" border-width)
|
||||
("border-width" border-width)
|
||||
("bottom" length percentage "auto")
|
||||
("caption-side" "top" "bottom")
|
||||
("clear" "none" "left" "right" "both")
|
||||
("clip" shape "auto")
|
||||
("color" color)
|
||||
("content" "normal" "none" string uri counter "attr()" "open-quote"
|
||||
"close-quote" "no-open-quote" "no-close-quote")
|
||||
("counter-increment" identifier integer "none")
|
||||
("counter-reset" identifier integer "none")
|
||||
("cue" cue-before cue-after)
|
||||
("cue-after" uri "none")
|
||||
("cue-before" uri "none")
|
||||
("cursor" uri "*" "auto" "crosshair" "default" "pointer" "move" "e-resize"
|
||||
"ne-resize" "nw-resize" "n-resize" "se-resize" "sw-resize" "s-resize"
|
||||
"w-resize" "text" "wait" "help" "progress")
|
||||
("direction" "ltr" "rtl")
|
||||
("display" "inline" "block" "list-item" "run-in" "inline-block" "table"
|
||||
"inline-table" "table-row-group" "table-header-group" "table-footer-group"
|
||||
"table-row" "table-column-group" "table-column" "table-cell"
|
||||
"table-caption" "none")
|
||||
("elevation" angle "below" "level" "above" "higher" "lower")
|
||||
("empty-cells" "show" "hide")
|
||||
("float" "left" "right" "none")
|
||||
("font" font-style font-weight font-size "/" line-height
|
||||
font-family "caption" "icon" "menu" "message-box" "small-caption"
|
||||
"status-bar" "normal" "small-caps"
|
||||
;; CSS3
|
||||
font-stretch)
|
||||
("font-family" family-name generic-family)
|
||||
("font-size" absolute-size relative-size length percentage)
|
||||
("font-style" "normal" "italic" "oblique")
|
||||
("font-weight" "normal" "bold" "bolder" "lighter" "100" "200" "300" "400"
|
||||
"500" "600" "700" "800" "900")
|
||||
("height" length percentage "auto")
|
||||
("left" length percentage "auto")
|
||||
("letter-spacing" "normal" length)
|
||||
("line-height" "normal" number length percentage)
|
||||
("list-style" list-style-type list-style-position list-style-image)
|
||||
("list-style-image" uri "none")
|
||||
("list-style-position" "inside" "outside")
|
||||
("list-style-type" "disc" "circle" "square" "decimal" "decimal-leading-zero"
|
||||
"lower-roman" "upper-roman" "lower-greek" "lower-latin" "upper-latin"
|
||||
"armenian" "georgian" "lower-alpha" "upper-alpha" "none")
|
||||
("margin" margin-width)
|
||||
("margin-bottom" margin-width)
|
||||
("margin-left" margin-width)
|
||||
("margin-right" margin-width)
|
||||
("margin-top" margin-width)
|
||||
("max-height" length percentage "none")
|
||||
("max-width" length percentage "none")
|
||||
("min-height" length percentage)
|
||||
("min-width" length percentage)
|
||||
("orphans" integer)
|
||||
("outline" outline-color outline-style outline-width)
|
||||
("outline-color" color "invert")
|
||||
("outline-style" border-style)
|
||||
("outline-width" border-width)
|
||||
("overflow" "visible" "hidden" "scroll" "auto"
|
||||
;; CSS3:
|
||||
"no-display" "no-content")
|
||||
("padding" padding-width)
|
||||
("padding-bottom" padding-width)
|
||||
("padding-left" padding-width)
|
||||
("padding-right" padding-width)
|
||||
("padding-top" padding-width)
|
||||
("page-break-after" "auto" "always" "avoid" "left" "right")
|
||||
("page-break-before" "auto" "always" "avoid" "left" "right")
|
||||
("page-break-inside" "avoid" "auto")
|
||||
("pause" time percentage)
|
||||
("pause-after" time percentage)
|
||||
("pause-before" time percentage)
|
||||
("pitch" frequency "x-low" "low" "medium" "high" "x-high")
|
||||
("pitch-range" number)
|
||||
("play-during" uri "mix" "repeat" "auto" "none")
|
||||
("position" "static" "relative" "absolute" "fixed")
|
||||
("quotes" string string "none")
|
||||
("richness" number)
|
||||
("right" length percentage "auto")
|
||||
("speak" "normal" "none" "spell-out")
|
||||
("speak-header" "once" "always")
|
||||
("speak-numeral" "digits" "continuous")
|
||||
("speak-punctuation" "code" "none")
|
||||
("speech-rate" number "x-slow" "slow" "medium" "fast" "x-fast" "faster"
|
||||
"slower")
|
||||
("stress" number)
|
||||
("table-layout" "auto" "fixed")
|
||||
("text-align" "left" "right" "center" "justify")
|
||||
("text-indent" length percentage)
|
||||
("text-transform" "capitalize" "uppercase" "lowercase" "none")
|
||||
("top" length percentage "auto")
|
||||
("unicode-bidi" "normal" "embed" "bidi-override")
|
||||
("vertical-align" "baseline" "sub" "super" "top" "text-top" "middle"
|
||||
"bottom" "text-bottom" percentage length)
|
||||
("visibility" "visible" "hidden" "collapse")
|
||||
("voice-family" specific-voice generic-voice "*" specific-voice
|
||||
generic-voice)
|
||||
("volume" number percentage "silent" "x-soft" "soft" "medium" "loud"
|
||||
"x-loud")
|
||||
("white-space" "normal" "pre" "nowrap" "pre-wrap" "pre-line")
|
||||
("widows" integer)
|
||||
("width" length percentage "auto")
|
||||
("word-spacing" "normal" length)
|
||||
("z-index" "auto" integer)
|
||||
;; CSS3
|
||||
("align-content" align-stretch "space-between" "space-around")
|
||||
("align-items" align-stretch "baseline")
|
||||
("align-self" align-items "auto")
|
||||
("animation" animation-name animation-duration animation-timing-function
|
||||
animation-delay animation-iteration-count animation-direction
|
||||
animation-fill-mode)
|
||||
("animation-delay" time)
|
||||
("animation-direction" "normal" "reverse" "alternate" "alternate-reverse")
|
||||
("animation-duration" time)
|
||||
("animation-fill-mode" "none" "forwards" "backwards" "both")
|
||||
("animation-iteration-count" integer "infinite")
|
||||
("animation-name" "none")
|
||||
("animation-play-state" "paused" "running")
|
||||
("animation-timing-function" transition-timing-function
|
||||
"step-start" "step-end" "steps(,)")
|
||||
("backface-visibility" "visible" "hidden")
|
||||
("background-clip" background-origin)
|
||||
("background-origin" "border-box" "padding-box" "content-box")
|
||||
("background-size" length percentage "auto" "cover" "contain")
|
||||
("border-image" border-image-outset border-image-repeat border-image-source
|
||||
border-image-slice border-image-width)
|
||||
("border-image-outset" length)
|
||||
("border-image-repeat" "stretch" "repeat" "round" "space")
|
||||
("border-image-source" uri "none")
|
||||
("border-image-slice" length)
|
||||
("border-image-width" length percentage)
|
||||
("border-radius" length)
|
||||
("border-top-left-radius" length)
|
||||
("border-top-right-radius" length)
|
||||
("border-bottom-left-radius" length)
|
||||
("border-bottom-right-radius" length)
|
||||
("box-decoration-break" "slice" "clone")
|
||||
("box-shadow" length color)
|
||||
("box-sizing" "content-box" "border-box")
|
||||
("break-after" "auto" "always" "avoid" "left" "right" "page" "column"
|
||||
"avoid-page" "avoid-column")
|
||||
("break-before" break-after)
|
||||
("break-inside" "avoid" "auto")
|
||||
("columns" column-width column-count)
|
||||
("column-count" integer)
|
||||
("column-fill" "auto" "balance")
|
||||
("column-gap" length "normal")
|
||||
("column-rule" column-rule-width column-rule-style column-rule-color)
|
||||
("column-rule-color" color)
|
||||
("column-rule-style" border-style)
|
||||
("column-rule-width" border-width)
|
||||
("column-span" "all" "none")
|
||||
("column-width" length "auto")
|
||||
("filter" url "blur()" "brightness()" "contrast()" "drop-shadow()"
|
||||
"grayscale()" "hue-rotate()" "invert()" "opacity()" "saturate()" "sepia()")
|
||||
("flex" flex-grow flex-shrink flex-basis)
|
||||
("flex-basis" percentage length "auto")
|
||||
("flex-direction" "row" "row-reverse" "column" "column-reverse")
|
||||
("flex-flow" flex-direction flex-wrap)
|
||||
("flex-grow" number)
|
||||
("flex-shrink" number)
|
||||
("flex-wrap" "nowrap" "wrap" "wrap-reverse")
|
||||
("font-feature-setting" normal string number)
|
||||
("font-kerning" "auto" "normal" "none")
|
||||
("font-language-override" "normal" string)
|
||||
("font-size-adjust" "none" number)
|
||||
("font-stretch" "normal" "ultra-condensed" "extra-condensed" "condensed"
|
||||
"semi-condensed" "semi-expanded" "expanded" "extra-expanded" "ultra-expanded")
|
||||
("font-synthesis" "none" "weight" "style")
|
||||
("font-variant" font-variant-alternates font-variant-caps
|
||||
font-variant-east-asian font-variant-ligatures font-variant-numeric
|
||||
font-variant-position)
|
||||
("font-variant-alternates" "normal" "historical-forms" "stylistic()"
|
||||
"styleset()" "character-variant()" "swash()" "ornaments()" "annotation()")
|
||||
("font-variant-caps" "normal" "small-caps" "all-small-caps" "petite-caps"
|
||||
"all-petite-caps" "unicase" "titling-caps")
|
||||
("font-variant-east-asian" "jis78" "jis83" "jis90" "jis04" "simplified"
|
||||
"traditional" "full-width" "proportional-width" "ruby")
|
||||
("font-variant-ligatures" "normal" "none" "common-ligatures"
|
||||
"no-common-ligatures" "discretionary-ligatures" "no-discretionary-ligatures"
|
||||
"historical-ligatures" "no-historical-ligatures" "contextual" "no-contextual")
|
||||
("font-variant-numeric" "normal" "ordinal" "slashed-zero"
|
||||
"lining-nums" "oldstyle-nums" "proportional-nums" "tabular-nums"
|
||||
"diagonal-fractions" "stacked-fractions")
|
||||
("font-variant-position" "normal" "sub" "super")
|
||||
("hyphens" "none" "manual" "auto")
|
||||
("justify-content" align-common "space-between" "space-around")
|
||||
("line-break" "auto" "loose" "normal" "strict")
|
||||
("marquee-direction" "forward" "reverse")
|
||||
("marquee-play-count" integer "infinite")
|
||||
("marquee-speed" "slow" "normal" "fast")
|
||||
("marquee-style" "scroll" "slide" "alternate")
|
||||
("opacity" number)
|
||||
("order" number)
|
||||
("outline-offset" length)
|
||||
("overflow-x" overflow)
|
||||
("overflow-y" overflow)
|
||||
("overflow-style" "auto" "marquee-line" "marquee-block")
|
||||
("overflow-wrap" "normal" "break-word")
|
||||
("perspective" "none" length)
|
||||
("perspective-origin" percentage length "left" "center" "right" "top" "bottom")
|
||||
("resize" "none" "both" "horizontal" "vertical")
|
||||
("tab-size" integer length)
|
||||
("text-align-last" "auto" "start" "end" "left" "right" "center" "justify")
|
||||
("text-decoration" text-decoration-color text-decoration-line text-decoration-style)
|
||||
("text-decoration-color" color)
|
||||
("text-decoration-line" "none" "underline" "overline" "line-through" "blink")
|
||||
("text-decoration-style" "solid" "double" "dotted" "dashed" "wavy")
|
||||
("text-overflow" "clip" "ellipsis")
|
||||
("text-shadow" color length)
|
||||
("text-underline-position" "auto" "under" "left" "right")
|
||||
("transform" "matrix(,,,,,)" "translate(,)" "translateX()" "translateY()"
|
||||
"scale()" "scaleX()" "scaleY()" "rotate()" "skewX()" "skewY()" "none")
|
||||
("transform-origin" perspective-origin)
|
||||
("transform-style" "flat" "preserve-3d")
|
||||
("transition" transition-property transition-duration
|
||||
transition-timing-function transition-delay)
|
||||
("transition-delay" time)
|
||||
("transition-duration" time)
|
||||
("transition-timing-function"
|
||||
"ease" "linear" "ease-in" "ease-out" "ease-in-out" "cubic-bezier(,,,)")
|
||||
("transition-property" "none" "all" identifier)
|
||||
("word-wrap" overflow-wrap)
|
||||
("word-break" "normal" "break-all" "keep-all"))
|
||||
"A list of CSS properties and their possible values.")
|
||||
|
||||
(defconst company-css-value-classes
|
||||
'((absolute-size "xx-small" "x-small" "small" "medium" "large" "x-large"
|
||||
"xx-large")
|
||||
(align-common "flex-start" "flex-end" "center")
|
||||
(align-stretch align-common "stretch")
|
||||
(border-style "none" "hidden" "dotted" "dashed" "solid" "double" "groove"
|
||||
"ridge" "inset" "outset")
|
||||
(border-width "thick" "medium" "thin")
|
||||
(color "aqua" "black" "blue" "fuchsia" "gray" "green" "lime" "maroon" "navy"
|
||||
"olive" "orange" "purple" "red" "silver" "teal" "white" "yellow")
|
||||
(counter "counter(,)")
|
||||
(family-name "Courier" "Helvetica" "Times")
|
||||
(generic-family "serif" "sans-serif" "cursive" "fantasy" "monospace")
|
||||
(generic-voice "male" "female" "child")
|
||||
(margin-width "auto") ;; length percentage
|
||||
(relative-size "larger" "smaller")
|
||||
(shape "rect(,,,)")
|
||||
(uri "url()"))
|
||||
"A list of CSS property value classes and their contents.")
|
||||
;; missing, because not completable
|
||||
;; <angle><frequency><identifier><integer><length><number><padding-width>
|
||||
;; <percentage><specific-voice><string><time><uri>
|
||||
|
||||
(defconst company-css-html-tags
|
||||
'("a" "abbr" "acronym" "address" "applet" "area" "b" "base" "basefont" "bdo"
|
||||
"big" "blockquote" "body" "br" "button" "caption" "center" "cite" "code"
|
||||
"col" "colgroup" "dd" "del" "dfn" "dir" "div" "dl" "dt" "em" "fieldset"
|
||||
"font" "form" "frame" "frameset" "h1" "h2" "h3" "h4" "h5" "h6" "head" "hr"
|
||||
"html" "i" "iframe" "img" "input" "ins" "isindex" "kbd" "label" "legend"
|
||||
"li" "link" "map" "menu" "meta" "noframes" "noscript" "object" "ol"
|
||||
"optgroup" "option" "p" "param" "pre" "q" "s" "samp" "script" "select"
|
||||
"small" "span" "strike" "strong" "style" "sub" "sup" "table" "tbody" "td"
|
||||
"textarea" "tfoot" "th" "thead" "title" "tr" "tt" "u" "ul" "var"
|
||||
;; HTML5
|
||||
"section" "article" "aside" "header" "footer" "nav" "figure" "figcaption"
|
||||
"time" "mark" "main")
|
||||
"A list of HTML tags for use in CSS completion.")
|
||||
|
||||
(defconst company-css-pseudo-classes
|
||||
'("active" "after" "before" "first" "first-child" "first-letter" "first-line"
|
||||
"focus" "hover" "lang" "left" "link" "right" "visited")
|
||||
"Identifiers for CSS pseudo-elements and pseudo-classes.")
|
||||
|
||||
(defconst company-css-property-cache (make-hash-table :size 115 :test 'equal))
|
||||
|
||||
(defun company-css-property-values (attribute)
|
||||
"Access the `company-css-property-alist' cached and flattened."
|
||||
(or (gethash attribute company-css-property-cache)
|
||||
(let (results)
|
||||
(dolist (value (cdr (assoc attribute company-css-property-alist)))
|
||||
(if (symbolp value)
|
||||
(dolist (child (or (cdr (assoc value company-css-value-classes))
|
||||
(company-css-property-values
|
||||
(symbol-name value))))
|
||||
(push child results))
|
||||
(push value results)))
|
||||
(setq results (sort results 'string<))
|
||||
(puthash attribute
|
||||
(if (fboundp 'delete-consecutive-dups)
|
||||
(delete-consecutive-dups results)
|
||||
(delete-dups results))
|
||||
company-css-property-cache)
|
||||
results)))
|
||||
|
||||
;;; bracket detection
|
||||
|
||||
(defconst company-css-braces-syntax-table
|
||||
(let ((table (make-syntax-table)))
|
||||
(setf (aref table ?{) '(4 . 125))
|
||||
(setf (aref table ?}) '(5 . 123))
|
||||
table)
|
||||
"A syntax table giving { and } paren syntax.")
|
||||
|
||||
(defun company-css-inside-braces-p ()
|
||||
"Return non-nil, if point is within matched { and }."
|
||||
(ignore-errors
|
||||
(with-syntax-table company-css-braces-syntax-table
|
||||
(let ((parse-sexp-ignore-comments t))
|
||||
(scan-lists (point) -1 1)))))
|
||||
|
||||
;;; tags
|
||||
(defconst company-css-tag-regexp
|
||||
(concat "\\(?:\\`\\|}\\)[[:space:]]*"
|
||||
;; multiple
|
||||
"\\(?:"
|
||||
;; previous tags:
|
||||
"\\(?:#\\|\\_<[[:alpha:]]\\)[[:alnum:]-#]*\\(?:\\[[^]]*\\]\\)?"
|
||||
;; space or selectors
|
||||
"\\(?:[[:space:]]+\\|[[:space:]]*[+,>][[:space:]]*\\)"
|
||||
"\\)*"
|
||||
"\\(\\(?:#\\|\\_<[[:alpha:]]\\)\\(?:[[:alnum:]-#]*\\_>\\)?\\_>\\|\\)"
|
||||
"\\=")
|
||||
"A regular expression matching CSS tags.")
|
||||
|
||||
;;; pseudo id
|
||||
(defconst company-css-pseudo-regexp
|
||||
(concat "\\(?:\\`\\|}\\)[[:space:]]*"
|
||||
;; multiple
|
||||
"\\(?:"
|
||||
;; previous tags:
|
||||
"\\(?:#\\|\\_<[[:alpha:]]\\)[[:alnum:]-#]*\\(?:\\[[^]]*\\]\\)?"
|
||||
;; space or delimiters
|
||||
"\\(?:[[:space:]]+\\|[[:space:]]*[+,>][[:space:]]*\\)"
|
||||
"\\)*"
|
||||
"\\(?:\\(?:\\#\\|\\_<[[:alpha:]]\\)[[:alnum:]-#]*\\):"
|
||||
"\\([[:alpha:]-]+\\_>\\|\\)\\_>\\=")
|
||||
"A regular expression matching CSS pseudo classes.")
|
||||
|
||||
;;; properties
|
||||
|
||||
(defun company-css-grab-property ()
|
||||
"Return the CSS property before point, if any.
|
||||
Returns \"\" if no property found, but feasible at this position."
|
||||
(when (company-css-inside-braces-p)
|
||||
(company-grab-symbol)))
|
||||
|
||||
;;; values
|
||||
(defconst company-css-property-value-regexp
|
||||
"\\_<\\([[:alpha:]-]+\\):\\(?:[^{};]*[[:space:]]+\\)?\\([^{};]*\\_>\\|\\)\\="
|
||||
"A regular expression matching CSS tags.")
|
||||
|
||||
;;;###autoload
|
||||
(defun company-css (command &optional arg &rest _ignored)
|
||||
"`company-mode' completion backend for `css-mode'."
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-css))
|
||||
(prefix (and (or (derived-mode-p 'css-mode)
|
||||
(and (derived-mode-p 'web-mode)
|
||||
(string= (web-mode-language-at-pos) "css")))
|
||||
(or (company-grab company-css-tag-regexp 1)
|
||||
(company-grab company-css-pseudo-regexp 1)
|
||||
(company-grab company-css-property-value-regexp 2
|
||||
(line-beginning-position))
|
||||
(company-css-grab-property))))
|
||||
(candidates
|
||||
(cond
|
||||
((company-grab company-css-tag-regexp 1)
|
||||
(all-completions arg company-css-html-tags))
|
||||
((company-grab company-css-pseudo-regexp 1)
|
||||
(all-completions arg company-css-pseudo-classes))
|
||||
((company-grab company-css-property-value-regexp 2
|
||||
(line-beginning-position))
|
||||
(all-completions arg
|
||||
(company-css-property-values
|
||||
(company-grab company-css-property-value-regexp 1))))
|
||||
((company-css-grab-property)
|
||||
(all-completions arg company-css-property-alist))))
|
||||
(sorted t)))
|
||||
|
||||
(provide 'company-css)
|
||||
;;; company-css.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-css.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-css.elc
Normal file
Binary file not shown.
151
desktop/.emacs.d/elpa/company-20240625.0/company-dabbrev-code.el
Normal file
151
desktop/.emacs.d/elpa/company-20240625.0/company-dabbrev-code.el
Normal file
|
@ -0,0 +1,151 @@
|
|||
;;; company-dabbrev-code.el --- dabbrev-like company-mode backend for code -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2016, 2021-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'company)
|
||||
(require 'company-dabbrev)
|
||||
(require 'cl-lib)
|
||||
|
||||
(defgroup company-dabbrev-code nil
|
||||
"dabbrev-like completion backend for code."
|
||||
:group 'company)
|
||||
|
||||
(defcustom company-dabbrev-code-modes
|
||||
'(prog-mode
|
||||
batch-file-mode csharp-mode css-mode erlang-mode haskell-mode jde-mode
|
||||
lua-mode python-mode)
|
||||
"Modes that use `company-dabbrev-code'.
|
||||
In all these modes (and their derivatives) `company-dabbrev-code' will
|
||||
complete only symbols, not text in comments or strings. In other modes
|
||||
`company-dabbrev-code' will pass control to other backends
|
||||
\(e.g. `company-dabbrev'\). Value t means complete in all modes."
|
||||
:type '(choice (repeat :tag "Some modes" (symbol :tag "Major mode"))
|
||||
(const :tag "All modes" t)))
|
||||
|
||||
(defcustom company-dabbrev-code-other-buffers t
|
||||
"Determines whether `company-dabbrev-code' should search other buffers.
|
||||
If `all', search all other buffers, except the ignored ones. If t, search
|
||||
buffers with the same major mode. If `code', search all buffers with major
|
||||
modes in `company-dabbrev-code-modes', or derived from one of them. See
|
||||
also `company-dabbrev-code-time-limit'."
|
||||
:type '(choice (const :tag "Off" nil)
|
||||
(const :tag "Same major mode" t)
|
||||
(const :tag "Code major modes" code)
|
||||
(const :tag "All" all)))
|
||||
|
||||
(defcustom company-dabbrev-code-time-limit .1
|
||||
"Determines how long `company-dabbrev-code' should look for matches."
|
||||
:type '(choice (const :tag "Off" nil)
|
||||
(number :tag "Seconds")))
|
||||
|
||||
(defcustom company-dabbrev-code-everywhere nil
|
||||
"Non-nil to offer completions in comments and strings."
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom company-dabbrev-code-ignore-case nil
|
||||
"Non-nil to ignore case when collecting completion candidates."
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom company-dabbrev-code-completion-styles nil
|
||||
"Non-nil to use the completion styles for fuzzy matching."
|
||||
:type '(choice (const :tag "Prefix matching only" nil)
|
||||
(const :tag "Matching according to `completion-styles'" t)
|
||||
(list :tag "Custom list of styles" symbol)))
|
||||
|
||||
(defun company-dabbrev-code--make-regexp (prefix)
|
||||
(let ((prefix-re
|
||||
(cond
|
||||
((string-empty-p prefix)
|
||||
"\\([a-zA-Z]\\|\\s_\\)")
|
||||
((not company-dabbrev-code-completion-styles)
|
||||
(regexp-quote prefix))
|
||||
(t
|
||||
;; Use the cache at least after 2 chars. We could also cache
|
||||
;; earlier, for users who set company-min-p-l to 1 or 0.
|
||||
(let ((prefix (if (>= (length prefix) 2)
|
||||
(substring prefix 0 2)
|
||||
prefix)))
|
||||
(mapconcat #'regexp-quote
|
||||
(mapcar #'string prefix)
|
||||
"\\(\\sw\\|\\s_\\)*"))))))
|
||||
(concat "\\_<" prefix-re "\\(\\sw\\|\\s_\\)*\\_>")))
|
||||
|
||||
;;;###autoload
|
||||
(defun company-dabbrev-code (command &optional arg &rest _ignored)
|
||||
"dabbrev-like `company-mode' backend for code.
|
||||
The backend looks for all symbols in the current buffer that aren't in
|
||||
comments or strings."
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-dabbrev-code))
|
||||
(prefix (and (or (eq t company-dabbrev-code-modes)
|
||||
(cl-some #'derived-mode-p company-dabbrev-code-modes))
|
||||
(or company-dabbrev-code-everywhere
|
||||
(not (company-in-string-or-comment)))
|
||||
(or (company-grab-symbol) 'stop)))
|
||||
(candidates
|
||||
(let* ((case-fold-search company-dabbrev-code-ignore-case)
|
||||
(regexp (company-dabbrev-code--make-regexp arg)))
|
||||
(company-dabbrev-code--filter
|
||||
arg
|
||||
(company-cache-fetch
|
||||
'dabbrev-code-candidates
|
||||
(lambda ()
|
||||
(company-dabbrev--search
|
||||
regexp
|
||||
company-dabbrev-code-time-limit
|
||||
(pcase company-dabbrev-code-other-buffers
|
||||
(`t (list major-mode))
|
||||
(`code company-dabbrev-code-modes)
|
||||
(`all `all))
|
||||
(not company-dabbrev-code-everywhere)))
|
||||
:expire t
|
||||
:check-tag regexp))))
|
||||
(kind 'text)
|
||||
(no-cache t)
|
||||
(ignore-case company-dabbrev-code-ignore-case)
|
||||
(match (when company-dabbrev-code-completion-styles
|
||||
(company--match-from-capf-face arg)))
|
||||
(duplicates t)))
|
||||
|
||||
(defun company-dabbrev-code--filter (prefix table)
|
||||
(let ((completion-ignore-case company-dabbrev-code-ignore-case)
|
||||
(completion-styles (if (listp company-dabbrev-code-completion-styles)
|
||||
company-dabbrev-code-completion-styles
|
||||
completion-styles))
|
||||
res)
|
||||
(if (not company-dabbrev-code-completion-styles)
|
||||
(all-completions prefix table)
|
||||
(setq res (completion-all-completions
|
||||
prefix
|
||||
table
|
||||
nil (length prefix)))
|
||||
(if (numberp (cdr (last res)))
|
||||
(setcdr (last res) nil))
|
||||
res)))
|
||||
|
||||
(provide 'company-dabbrev-code)
|
||||
;;; company-dabbrev-code.el ends here
|
Binary file not shown.
218
desktop/.emacs.d/elpa/company-20240625.0/company-dabbrev.el
Normal file
218
desktop/.emacs.d/elpa/company-20240625.0/company-dabbrev.el
Normal file
|
@ -0,0 +1,218 @@
|
|||
;;; company-dabbrev.el --- dabbrev-like company-mode completion backend -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2018, 2021-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'company)
|
||||
(require 'cl-lib)
|
||||
|
||||
(defgroup company-dabbrev nil
|
||||
"dabbrev-like completion backend."
|
||||
:group 'company)
|
||||
|
||||
(defcustom company-dabbrev-other-buffers 'all
|
||||
"Determines whether `company-dabbrev' should search other buffers.
|
||||
If `all', search all other buffers, except the ignored ones. If t, search
|
||||
buffers with the same major mode. See also `company-dabbrev-time-limit'."
|
||||
:type '(choice (const :tag "Off" nil)
|
||||
(const :tag "Same major mode" t)
|
||||
(const :tag "All" all)))
|
||||
|
||||
(defcustom company-dabbrev-ignore-buffers "\\`[ *]"
|
||||
"Regexp matching the names of buffers to ignore.
|
||||
Or a function that returns non-nil for such buffers."
|
||||
:type '(choice (regexp :tag "Regexp")
|
||||
(function :tag "Predicate"))
|
||||
:package-version '(company . "0.9.0"))
|
||||
|
||||
(defcustom company-dabbrev-time-limit .1
|
||||
"Determines how many seconds `company-dabbrev' should look for matches."
|
||||
:type '(choice (const :tag "Off" nil)
|
||||
(number :tag "Seconds")))
|
||||
|
||||
(defcustom company-dabbrev-char-regexp "\\sw"
|
||||
"A regular expression matching the characters `company-dabbrev' looks for."
|
||||
:type 'regexp)
|
||||
|
||||
(defcustom company-dabbrev-ignore-case 'keep-prefix
|
||||
"Non-nil to ignore case when collecting completion candidates.
|
||||
When it's `keep-prefix', the text before point will remain unchanged after
|
||||
candidate is inserted, even some of its characters have different case."
|
||||
:type '(choice
|
||||
(const :tag "Don't ignore case" nil)
|
||||
(const :tag "Ignore case" t)
|
||||
(const :tag "Keep case before point" keep-prefix)))
|
||||
|
||||
(defcustom company-dabbrev-downcase 'case-replace
|
||||
"Whether to downcase the returned candidates.
|
||||
|
||||
The value of nil means keep them as-is.
|
||||
`case-replace' means use the value of `case-replace'.
|
||||
Any other value means downcase."
|
||||
:type '(choice
|
||||
(const :tag "Keep as-is" nil)
|
||||
(const :tag "Downcase" t)
|
||||
(const :tag "Use case-replace" case-replace)))
|
||||
|
||||
(defcustom company-dabbrev-minimum-length 4
|
||||
"The minimum length for the completion candidate to be included.
|
||||
This variable affects both `company-dabbrev' and `company-dabbrev-code'."
|
||||
:type 'integer
|
||||
:package-version '(company . "0.8.3"))
|
||||
|
||||
(defcustom company-dabbrev-ignore-invisible nil
|
||||
"Non-nil to skip invisible text."
|
||||
:type 'boolean
|
||||
:package-version '(company . "0.9.0"))
|
||||
|
||||
(defmacro company-dabbrev--time-limit-while (test start limit freq &rest body)
|
||||
(declare (indent 3) (debug t))
|
||||
`(let ((company-time-limit-while-counter 0))
|
||||
(catch 'done
|
||||
(while ,test
|
||||
,@body
|
||||
(and ,limit
|
||||
(= (cl-incf company-time-limit-while-counter) ,freq)
|
||||
(setq company-time-limit-while-counter 0)
|
||||
(> (float-time (time-since ,start)) ,limit)
|
||||
(throw 'done 'company-time-out))))))
|
||||
|
||||
(defun company-dabbrev--make-regexp ()
|
||||
(concat "\\(?:" company-dabbrev-char-regexp "\\)+"))
|
||||
|
||||
(defun company-dabbrev--search-buffer (regexp pos symbols start limit
|
||||
ignore-comments)
|
||||
(save-excursion
|
||||
(cl-labels ((maybe-collect-match
|
||||
()
|
||||
(let ((match (match-string-no-properties 0)))
|
||||
(when (and (>= (length match) company-dabbrev-minimum-length)
|
||||
(not (and company-dabbrev-ignore-invisible
|
||||
(invisible-p (match-beginning 0)))))
|
||||
(puthash match t symbols)))))
|
||||
(goto-char (if pos (1- pos) (point-min)))
|
||||
;; Search before pos.
|
||||
(let ((tmp-end (point)))
|
||||
(company-dabbrev--time-limit-while (and (not (input-pending-p))
|
||||
(> tmp-end (point-min)))
|
||||
start limit 1
|
||||
(ignore-errors
|
||||
(forward-char -10000))
|
||||
(forward-line 0)
|
||||
(save-excursion
|
||||
;; Before, we used backward search, but it matches non-greedily, and
|
||||
;; that forced us to use the "beginning/end of word" anchors in
|
||||
;; `company-dabbrev--make-regexp'. It's also about 2x slower.
|
||||
(while (and (not (input-pending-p))
|
||||
(re-search-forward regexp tmp-end t))
|
||||
(if (and ignore-comments (save-match-data (company-in-string-or-comment)))
|
||||
(re-search-forward "\\s>\\|\\s!\\|\\s\"" tmp-end t)
|
||||
(maybe-collect-match))))
|
||||
(setq tmp-end (point))))
|
||||
(goto-char (or pos (point-min)))
|
||||
;; Search after pos.
|
||||
(company-dabbrev--time-limit-while (and (not (input-pending-p))
|
||||
(re-search-forward regexp nil t))
|
||||
start limit 25
|
||||
(if (and ignore-comments (save-match-data (company-in-string-or-comment)))
|
||||
(re-search-forward "\\s>\\|\\s!\\|\\s\"" nil t)
|
||||
(maybe-collect-match)))
|
||||
symbols)))
|
||||
|
||||
(defun company-dabbrev--search (regexp &optional limit other-buffer-modes
|
||||
ignore-comments)
|
||||
(let* ((start (current-time))
|
||||
(symbols (company-dabbrev--search-buffer regexp (point)
|
||||
(make-hash-table :test 'equal)
|
||||
start limit
|
||||
ignore-comments)))
|
||||
(when other-buffer-modes
|
||||
(cl-dolist (buffer (delq (current-buffer) (buffer-list)))
|
||||
(unless (if (stringp company-dabbrev-ignore-buffers)
|
||||
(string-match-p company-dabbrev-ignore-buffers
|
||||
(buffer-name buffer))
|
||||
(funcall company-dabbrev-ignore-buffers buffer))
|
||||
(with-current-buffer buffer
|
||||
(when (or (eq other-buffer-modes 'all)
|
||||
(cl-some #'derived-mode-p other-buffer-modes))
|
||||
(setq symbols
|
||||
(company-dabbrev--search-buffer regexp nil symbols start
|
||||
limit ignore-comments)))))
|
||||
(and limit
|
||||
(> (float-time (time-since start)) limit)
|
||||
(cl-return))))
|
||||
symbols))
|
||||
|
||||
(defun company-dabbrev--prefix ()
|
||||
;; Not in the middle of a word.
|
||||
(unless (looking-at-p company-dabbrev-char-regexp)
|
||||
;; Emacs can't do greedy backward-search.
|
||||
(company-grab-line (format "\\(?:^\\| \\)[^ ]*?\\(\\(?:%s\\)*\\)"
|
||||
company-dabbrev-char-regexp)
|
||||
1)))
|
||||
|
||||
(defun company-dabbrev--filter (prefix candidates)
|
||||
(let* ((completion-ignore-case company-dabbrev-ignore-case)
|
||||
(filtered (all-completions prefix candidates))
|
||||
(lp (length prefix))
|
||||
(downcase (if (eq company-dabbrev-downcase 'case-replace)
|
||||
case-replace
|
||||
company-dabbrev-downcase)))
|
||||
(when downcase
|
||||
(let ((ptr filtered))
|
||||
(while ptr
|
||||
(setcar ptr (downcase (car ptr)))
|
||||
(setq ptr (cdr ptr)))))
|
||||
(if (and (eq company-dabbrev-ignore-case 'keep-prefix)
|
||||
(not (= lp 0)))
|
||||
(company-substitute-prefix prefix filtered)
|
||||
filtered)))
|
||||
|
||||
(defun company-dabbrev--fetch ()
|
||||
(company-dabbrev--search (company-dabbrev--make-regexp)
|
||||
company-dabbrev-time-limit
|
||||
(pcase company-dabbrev-other-buffers
|
||||
(`t (list major-mode))
|
||||
(`all `all))))
|
||||
|
||||
;;;###autoload
|
||||
(defun company-dabbrev (command &optional arg &rest _ignored)
|
||||
"dabbrev-like `company-mode' completion backend."
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-dabbrev))
|
||||
(prefix (company-dabbrev--prefix))
|
||||
(candidates
|
||||
(company-dabbrev--filter
|
||||
arg
|
||||
(company-cache-fetch 'dabbrev-candidates #'company-dabbrev--fetch
|
||||
:expire t)))
|
||||
(kind 'text)
|
||||
(no-cache t)
|
||||
(ignore-case (and company-dabbrev-ignore-case t))
|
||||
(duplicates t)))
|
||||
|
||||
(provide 'company-dabbrev)
|
||||
;;; company-dabbrev.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-dabbrev.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-dabbrev.elc
Normal file
Binary file not shown.
108
desktop/.emacs.d/elpa/company-20240625.0/company-etags.el
Normal file
108
desktop/.emacs.d/elpa/company-20240625.0/company-etags.el
Normal file
|
@ -0,0 +1,108 @@
|
|||
;;; company-etags.el --- company-mode completion backend for etags -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2015, 2018-2019, 2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'company)
|
||||
(require 'cl-lib)
|
||||
(require 'etags)
|
||||
|
||||
(defgroup company-etags nil
|
||||
"Completion backend for etags."
|
||||
:group 'company)
|
||||
|
||||
(defcustom company-etags-use-main-table-list t
|
||||
"Always search `tags-table-list' if set.
|
||||
If this is disabled, `company-etags' will try to find the one table for each
|
||||
buffer automatically."
|
||||
:type '(choice (const :tag "off" nil)
|
||||
(const :tag "on" t)))
|
||||
|
||||
(defcustom company-etags-ignore-case nil
|
||||
"Non-nil to ignore case in completion candidates."
|
||||
:type 'boolean
|
||||
:package-version '(company . "0.7.3"))
|
||||
|
||||
(defcustom company-etags-everywhere nil
|
||||
"Non-nil to offer completions in comments and strings.
|
||||
Set it to t or to a list of major modes."
|
||||
:type '(choice (const :tag "Off" nil)
|
||||
(const :tag "Any supported mode" t)
|
||||
(repeat :tag "Some major modes"
|
||||
(symbol :tag "Major mode")))
|
||||
:package-version '(company . "0.9.0"))
|
||||
|
||||
(defvar company-etags-modes '(prog-mode c-mode objc-mode c++-mode java-mode
|
||||
jde-mode pascal-mode perl-mode python-mode))
|
||||
|
||||
(defvar-local company-etags-buffer-table 'unknown)
|
||||
|
||||
(defun company-etags-find-table ()
|
||||
(let ((file (expand-file-name
|
||||
"TAGS"
|
||||
(locate-dominating-file (or buffer-file-name
|
||||
default-directory)
|
||||
"TAGS"))))
|
||||
(when (and file (file-regular-p file))
|
||||
(list file))))
|
||||
|
||||
(defun company-etags-buffer-table ()
|
||||
(or (and company-etags-use-main-table-list tags-table-list)
|
||||
(if (eq company-etags-buffer-table 'unknown)
|
||||
(setq company-etags-buffer-table (company-etags-find-table))
|
||||
company-etags-buffer-table)))
|
||||
|
||||
(defun company-etags--candidates (prefix)
|
||||
(let ((tags-table-list (company-etags-buffer-table))
|
||||
(tags-file-name tags-file-name)
|
||||
(completion-ignore-case company-etags-ignore-case))
|
||||
(and (or tags-file-name tags-table-list)
|
||||
(fboundp 'tags-completion-table)
|
||||
(save-excursion
|
||||
(visit-tags-table-buffer)
|
||||
(all-completions prefix (tags-completion-table))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun company-etags (command &optional arg &rest _ignored)
|
||||
"`company-mode' completion backend for etags."
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-etags))
|
||||
(prefix (and (cl-some #'derived-mode-p company-etags-modes)
|
||||
(or (eq t company-etags-everywhere)
|
||||
(cl-some #'derived-mode-p company-etags-everywhere)
|
||||
(not (company-in-string-or-comment)))
|
||||
(company-etags-buffer-table)
|
||||
(or (company-grab-symbol) 'stop)))
|
||||
(candidates (company-etags--candidates arg))
|
||||
(location (let ((tags-table-list (company-etags-buffer-table)))
|
||||
(when (fboundp 'find-tag-noselect)
|
||||
(save-excursion
|
||||
(let ((buffer (find-tag-noselect arg)))
|
||||
(cons buffer (with-current-buffer buffer (point))))))))
|
||||
(ignore-case company-etags-ignore-case)))
|
||||
|
||||
(provide 'company-etags)
|
||||
;;; company-etags.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-etags.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-etags.elc
Normal file
Binary file not shown.
187
desktop/.emacs.d/elpa/company-20240625.0/company-files.el
Normal file
187
desktop/.emacs.d/elpa/company-20240625.0/company-files.el
Normal file
|
@ -0,0 +1,187 @@
|
|||
;;; company-files.el --- company-mode completion backend for file names -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2021, 2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'company)
|
||||
(require 'cl-lib)
|
||||
|
||||
(defgroup company-files nil
|
||||
"Completion backend for file names."
|
||||
:group 'company)
|
||||
|
||||
(defcustom company-files-exclusions nil
|
||||
"A list of file name extensions and directory names to ignore.
|
||||
The values should use the same format as `completion-ignored-extensions'."
|
||||
:type '(repeat (string :tag "File extension or directory name"))
|
||||
:package-version '(company . "0.9.1"))
|
||||
|
||||
(defcustom company-files-chop-trailing-slash t
|
||||
"Non-nil to remove the trailing slash after inserting directory name.
|
||||
|
||||
This way it's easy to continue completion by typing `/' again.
|
||||
|
||||
Set this to nil to disable that behavior."
|
||||
:type 'boolean)
|
||||
|
||||
(defun company-files--directory-files (dir prefix)
|
||||
;; Don't use directory-files. It produces directories without trailing /.
|
||||
(condition-case _err
|
||||
(let ((comp (sort (file-name-all-completions prefix dir)
|
||||
(lambda (s1 s2) (string-lessp (downcase s1) (downcase s2))))))
|
||||
(when company-files-exclusions
|
||||
(setq comp (company-files--exclusions-filtered comp)))
|
||||
(if (string-empty-p prefix)
|
||||
(delete "../" (delete "./" comp))
|
||||
comp))
|
||||
(file-error nil)))
|
||||
|
||||
(defun company-files--exclusions-filtered (completions)
|
||||
(let* ((dir-exclusions (cl-remove-if-not #'company-files--trailing-slash-p
|
||||
company-files-exclusions))
|
||||
(file-exclusions (cl-set-difference company-files-exclusions
|
||||
dir-exclusions)))
|
||||
(cl-loop for c in completions
|
||||
unless (if (company-files--trailing-slash-p c)
|
||||
(member c dir-exclusions)
|
||||
(cl-find-if (lambda (exclusion)
|
||||
(string-suffix-p exclusion c))
|
||||
file-exclusions))
|
||||
collect c)))
|
||||
|
||||
(defvar company-files--regexps
|
||||
(let* ((root (if (eq system-type 'windows-nt)
|
||||
"[a-zA-Z]:/"
|
||||
"/"))
|
||||
(begin (concat "\\(?:\\.\\{1,2\\}/\\|~/\\|" root "\\)")))
|
||||
(list (concat "\"\\(" begin "[^\"\n]*\\)")
|
||||
(concat "\'\\(" begin "[^\'\n]*\\)")
|
||||
(concat "\\(?:[ \t=\[]\\|^\\)\\(" begin "[^ \t\n]*\\)"))))
|
||||
|
||||
(defun company-files--grab-existing-name ()
|
||||
;; Grab the file name.
|
||||
;; When surrounded with quotes, it can include spaces.
|
||||
(let (file dir)
|
||||
(and (cl-dolist (regexp company-files--regexps)
|
||||
(when (setq file (company-grab-line regexp 1))
|
||||
(cl-return file)))
|
||||
(company-files--connected-p file)
|
||||
(setq dir (file-name-directory file))
|
||||
(not (string-match "//" dir))
|
||||
(file-exists-p dir)
|
||||
file)))
|
||||
|
||||
(defun company-files--connected-p (file)
|
||||
(or (not (file-remote-p file))
|
||||
(file-remote-p file nil t)))
|
||||
|
||||
(defun company-files--trailing-slash-p (file)
|
||||
;; `file-directory-p' is very expensive on remotes. We are relying on
|
||||
;; `file-name-all-completions' returning directories with trailing / instead.
|
||||
(let ((len (length file)))
|
||||
(and (> len 0) (eq (aref file (1- len)) ?/))))
|
||||
|
||||
(defvar company-files--cached-beg nil)
|
||||
|
||||
(defvar company-files--completion-cache nil)
|
||||
|
||||
(defun company-files--complete (prefix)
|
||||
(let* ((full-prefix (company-files--grab-existing-name))
|
||||
(ldiff (- (length full-prefix) (length prefix)))
|
||||
(dir (file-name-directory full-prefix))
|
||||
(file (file-name-nondirectory full-prefix))
|
||||
(key (list file
|
||||
(expand-file-name dir)
|
||||
(nth 5 (file-attributes dir))))
|
||||
(completion-ignore-case read-file-name-completion-ignore-case))
|
||||
(unless (company-file--keys-match-p key (car company-files--completion-cache))
|
||||
(let* ((candidates (mapcar (lambda (f) (concat dir f))
|
||||
(company-files--directory-files dir file)))
|
||||
(directories (unless (file-remote-p dir)
|
||||
(cl-remove-if-not (lambda (f)
|
||||
(and (company-files--trailing-slash-p f)
|
||||
(not (file-remote-p f))
|
||||
(company-files--connected-p f)))
|
||||
candidates)))
|
||||
(children (and directories
|
||||
(cl-mapcan (lambda (d)
|
||||
(mapcar (lambda (c) (concat d c))
|
||||
(company-files--directory-files d "")))
|
||||
directories))))
|
||||
(setq company-files--completion-cache
|
||||
(cons key (append candidates children)))))
|
||||
(mapcar
|
||||
(lambda (s) (substring s ldiff))
|
||||
(all-completions full-prefix
|
||||
(cdr company-files--completion-cache)))))
|
||||
|
||||
(defun company-files--cache-beg (prefix)
|
||||
(setq-local company-files--cached-beg (- (point) (length prefix)))
|
||||
(add-hook 'company-after-completion-hook #'company-files--clear-beg-cache nil t))
|
||||
|
||||
(defun company-files--clear-beg-cache (_res)
|
||||
(kill-local-variable 'company-files--cached-beg))
|
||||
|
||||
(defun company-files--prefix ()
|
||||
(let ((full-name (company-files--grab-existing-name)))
|
||||
(when full-name
|
||||
(if (and company-files--cached-beg
|
||||
(>= company-files--cached-beg
|
||||
(- (point) (length full-name))))
|
||||
(buffer-substring
|
||||
company-files--cached-beg
|
||||
(point))
|
||||
(file-name-nondirectory full-name)))))
|
||||
|
||||
(defun company-file--keys-match-p (new old)
|
||||
(and (equal (cdr old) (cdr new))
|
||||
(string-prefix-p (car old) (car new))))
|
||||
|
||||
(defun company-files--post-completion (arg)
|
||||
(when (and company-files-chop-trailing-slash
|
||||
(company-files--trailing-slash-p arg))
|
||||
(delete-char -1)))
|
||||
|
||||
;;;###autoload
|
||||
(defun company-files (command &optional arg &rest _ignored)
|
||||
"`company-mode' completion backend existing file names.
|
||||
Completions works for proper absolute and relative files paths.
|
||||
File paths with spaces are only supported inside strings."
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-files))
|
||||
(prefix (company-files--prefix))
|
||||
(candidates
|
||||
(company-files--cache-beg arg)
|
||||
(company-files--complete arg))
|
||||
(location (cons (dired-noselect
|
||||
(file-name-directory (directory-file-name arg))) 1))
|
||||
(post-completion (company-files--post-completion arg))
|
||||
(kind (if (string-suffix-p "/" arg) 'folder 'file))
|
||||
(sorted t)
|
||||
(no-cache t)))
|
||||
|
||||
(provide 'company-files)
|
||||
;;; company-files.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-files.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-files.elc
Normal file
Binary file not shown.
160
desktop/.emacs.d/elpa/company-20240625.0/company-gtags.el
Normal file
160
desktop/.emacs.d/elpa/company-20240625.0/company-gtags.el
Normal file
|
@ -0,0 +1,160 @@
|
|||
;;; company-gtags.el --- company-mode completion backend for GNU Global -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2021, 2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'company)
|
||||
(require 'company-template)
|
||||
(require 'cl-lib)
|
||||
|
||||
(defgroup company-gtags nil
|
||||
"Completion backend for GNU Global."
|
||||
:group 'company)
|
||||
|
||||
(define-obsolete-variable-alias
|
||||
'company-gtags-gnu-global-program-name
|
||||
'company-gtags-executable "earlier")
|
||||
|
||||
(defcustom company-gtags-executable
|
||||
(executable-find "global")
|
||||
"Location of GNU global executable."
|
||||
:type 'string)
|
||||
|
||||
(defcustom company-gtags-insert-arguments t
|
||||
"When non-nil, insert function arguments as a template after completion."
|
||||
:type 'boolean
|
||||
:package-version '(company . "0.8.1"))
|
||||
|
||||
(defvar-local company-gtags--tags-available-p 'unknown)
|
||||
(defvar-local company-gtags--executable 'unknown)
|
||||
|
||||
(defcustom company-gtags-modes '(prog-mode jde-mode)
|
||||
"Modes that use `company-gtags'.
|
||||
In all these modes (and their derivatives) `company-gtags' will perform
|
||||
completion."
|
||||
:type '(repeat (symbol :tag "Major mode"))
|
||||
:package-version '(company . "0.8.4"))
|
||||
|
||||
(defun company-gtags--tags-available-p ()
|
||||
(if (eq company-gtags--tags-available-p 'unknown)
|
||||
(setq company-gtags--tags-available-p
|
||||
(locate-dominating-file buffer-file-name "GTAGS"))
|
||||
company-gtags--tags-available-p))
|
||||
|
||||
;; Avoid byte-compilation warnings on Emacs < 27.
|
||||
(declare-function with-connection-local-variables "files-x")
|
||||
(declare-function connection-local-set-profile-variables "files-x")
|
||||
(declare-function connection-local-set-profiles "files-x")
|
||||
|
||||
(defun company-gtags--executable ()
|
||||
(cond
|
||||
((not (eq company-gtags--executable 'unknown)) ;; the value is already cached
|
||||
company-gtags--executable)
|
||||
((and (version<= "27" emacs-version) ;; can search remotely to set
|
||||
(file-remote-p default-directory))
|
||||
|
||||
(with-connection-local-variables
|
||||
(if (boundp 'company-gtags--executable-connection)
|
||||
(setq-local company-gtags--executable ;; use if defined as connection-local
|
||||
company-gtags--executable-connection)
|
||||
|
||||
;; Else search and set as connection local for next uses.
|
||||
(setq-local company-gtags--executable
|
||||
(with-no-warnings (executable-find "global" t)))
|
||||
(let* ((host (file-remote-p default-directory 'host))
|
||||
(symvars (intern (concat host "-vars")))) ;; profile name
|
||||
|
||||
(connection-local-set-profile-variables
|
||||
symvars
|
||||
`((company-gtags--executable-connection . ,company-gtags--executable)))
|
||||
|
||||
(connection-local-set-profiles `(:machine ,host) symvars))
|
||||
company-gtags--executable)))
|
||||
(t ;; use default value (searched locally)
|
||||
company-gtags-executable)))
|
||||
|
||||
(defun company-gtags--fetch-tags (prefix)
|
||||
(with-temp-buffer
|
||||
;; For some reason Global v 6.6.3 is prone to returning exit status 1
|
||||
;; even on successful searches when '-T' is used.
|
||||
(when (/= 3 (process-file (company-gtags--executable) nil
|
||||
;; "-T" goes through all the tag files listed in GTAGSLIBPATH
|
||||
(list (current-buffer) nil) nil "-xGqT" (concat "^" prefix)))
|
||||
(goto-char (point-min))
|
||||
(cl-loop while
|
||||
(re-search-forward (concat
|
||||
"^"
|
||||
"\\([^ ]*\\)" ;; completion
|
||||
"[ \t]+\\([[:digit:]]+\\)" ;; linum
|
||||
"[ \t]+\\([^ \t]+\\)" ;; file
|
||||
"[ \t]+\\(.*\\)" ;; definition
|
||||
"$"
|
||||
) nil t)
|
||||
collect
|
||||
(propertize (match-string 1)
|
||||
'meta (match-string 4)
|
||||
'location (cons (expand-file-name (match-string 3))
|
||||
(string-to-number (match-string 2)))
|
||||
)))))
|
||||
|
||||
(defun company-gtags--annotation (arg)
|
||||
(let ((meta (get-text-property 0 'meta arg)))
|
||||
(when (string-match (concat (regexp-quote arg) " *(") meta)
|
||||
(with-temp-buffer
|
||||
(let ((start (match-end 0)))
|
||||
(insert meta)
|
||||
(goto-char start)
|
||||
(condition-case nil
|
||||
(forward-sexp)
|
||||
(scan-error
|
||||
(goto-char (point-max))))
|
||||
(buffer-substring-no-properties
|
||||
start (point)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun company-gtags (command &optional arg &rest _ignored)
|
||||
"`company-mode' completion backend for GNU Global."
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-gtags))
|
||||
(prefix (and (company-gtags--executable)
|
||||
buffer-file-name
|
||||
(cl-some #'derived-mode-p company-gtags-modes)
|
||||
(not (company-in-string-or-comment))
|
||||
(company-gtags--tags-available-p)
|
||||
(or (company-grab-symbol) 'stop)))
|
||||
(candidates (company-gtags--fetch-tags arg))
|
||||
(sorted t)
|
||||
(duplicates t)
|
||||
(annotation (company-gtags--annotation arg))
|
||||
(meta (get-text-property 0 'meta arg))
|
||||
(location (get-text-property 0 'location arg))
|
||||
(post-completion (let ((anno (company-gtags--annotation arg)))
|
||||
(when (and company-gtags-insert-arguments anno)
|
||||
(insert anno)
|
||||
(company-template-c-like-templatify anno))))))
|
||||
|
||||
(provide 'company-gtags)
|
||||
;;; company-gtags.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-gtags.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-gtags.elc
Normal file
Binary file not shown.
97
desktop/.emacs.d/elpa/company-20240625.0/company-ispell.el
Normal file
97
desktop/.emacs.d/elpa/company-20240625.0/company-ispell.el
Normal file
|
@ -0,0 +1,97 @@
|
|||
;;; company-ispell.el --- company-mode completion backend using Ispell -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2016, 2018, 2021, 2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'company)
|
||||
(require 'cl-lib)
|
||||
(require 'ispell)
|
||||
|
||||
(defgroup company-ispell nil
|
||||
"Completion backend using Ispell."
|
||||
:group 'company)
|
||||
|
||||
(defun company--set-dictionary (symbol value)
|
||||
(set-default-toplevel-value symbol value)
|
||||
(company-cache-delete 'ispell-candidates))
|
||||
|
||||
(defcustom company-ispell-dictionary nil
|
||||
"Dictionary to use for `company-ispell'.
|
||||
|
||||
If nil, use `ispell-complete-word-dict' or `ispell-alternate-dictionary'."
|
||||
:type '(choice (const :tag "default (nil)" nil)
|
||||
(file :tag "dictionary" t))
|
||||
:set #'company--set-dictionary)
|
||||
|
||||
(defvar company-ispell-available 'unknown)
|
||||
|
||||
(defun company-ispell-available ()
|
||||
(when (eq company-ispell-available 'unknown)
|
||||
(condition-case err
|
||||
(progn
|
||||
(ispell-lookup-words "WHATEVER")
|
||||
(setq company-ispell-available t))
|
||||
(error
|
||||
(message "Company-Ispell: %s" (error-message-string err))
|
||||
(setq company-ispell-available nil))))
|
||||
company-ispell-available)
|
||||
|
||||
(defun company--ispell-dict ()
|
||||
"Determine which dictionary to use."
|
||||
(let ((dict (or company-ispell-dictionary
|
||||
ispell-complete-word-dict
|
||||
ispell-alternate-dictionary)))
|
||||
(when dict
|
||||
(expand-file-name dict))))
|
||||
|
||||
;;;###autoload
|
||||
(defun company-ispell (command &optional arg &rest _ignored)
|
||||
"`company-mode' completion backend using Ispell."
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-ispell))
|
||||
(prefix (when (company-ispell-available)
|
||||
(company-grab-word)))
|
||||
(candidates
|
||||
(let* ((dict (company--ispell-dict))
|
||||
(all-words
|
||||
(company-cache-fetch 'ispell-candidates
|
||||
(lambda () (ispell-lookup-words "" dict))
|
||||
:check-tag dict))
|
||||
(completion-ignore-case t))
|
||||
(if (string-empty-p arg)
|
||||
;; Small optimization.
|
||||
all-words
|
||||
(company-substitute-prefix
|
||||
arg
|
||||
;; Work around issue #284.
|
||||
(all-completions arg all-words)))))
|
||||
(kind 'text)
|
||||
(no-cache t)
|
||||
(sorted t)
|
||||
(ignore-case t)))
|
||||
|
||||
(provide 'company-ispell)
|
||||
;;; company-ispell.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-ispell.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-ispell.elc
Normal file
Binary file not shown.
476
desktop/.emacs.d/elpa/company-20240625.0/company-keywords.el
Normal file
476
desktop/.emacs.d/elpa/company-20240625.0/company-keywords.el
Normal file
|
@ -0,0 +1,476 @@
|
|||
;;; company-keywords.el --- A company backend for programming language keywords -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2018, 2020-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'company)
|
||||
(require 'cl-lib)
|
||||
(eval-when-compile (require 'make-mode))
|
||||
|
||||
(defgroup company-keywords nil
|
||||
"Completion backend for keywords."
|
||||
:group 'company)
|
||||
|
||||
(defcustom company-keywords-ignore-case nil
|
||||
"Non-nil to ignore case in completion candidates."
|
||||
:type 'boolean)
|
||||
|
||||
(defun company-keywords-upper-lower (&rest lst)
|
||||
;; Upcase order is different for _.
|
||||
(nconc (sort (mapcar 'upcase lst) 'string<) lst))
|
||||
|
||||
(defvar company-keywords-alist
|
||||
;; Please contribute corrections or additions.
|
||||
`((c++-mode
|
||||
;; from https://en.cppreference.com/w/cpp/keyword
|
||||
"alignas" "alignof" "and" "and_eq" "asm" "atomic_cancel" "atomic_commit"
|
||||
"atomic_noexcept" "auto" "bitand" "bitor" "bool" "break" "case" "catch"
|
||||
"char" "char16_t" "char32_t" "char8_t" "class" "co_await" "co_return"
|
||||
"co_yield" "compl" "concept" "const" "const_cast" "consteval" "constexpr"
|
||||
"constinit" "continue" "decltype" "default" "delete" "do" "double"
|
||||
"dynamic_cast" "else" "enum" "explicit" "export" "extern" "false" "final"
|
||||
"float" "for" "friend" "goto" "if" "import" "inline" "int" "long" "module"
|
||||
"mutable" "namespace" "new" "noexcept" "not" "not_eq" "nullptr" "operator"
|
||||
"or" "or_eq" "override" "private" "protected" "public" "reflexpr" "register"
|
||||
"reinterpret_cast" "requires" "return" "short" "signed" "sizeof" "static"
|
||||
"static_assert" "static_cast" "struct" "switch" "synchronized" "template"
|
||||
"this" "thread_local" "throw" "true" "try" "typedef" "typeid" "typename"
|
||||
"union" "unsigned" "using" "virtual" "void" "volatile" "wchar_t" "while"
|
||||
"xor" "xor_eq")
|
||||
(c-mode
|
||||
;; from https://en.cppreference.com/w/c/keyword
|
||||
"_Alignas" "_Alignof" "_Atomic" "_Bool" "_Complex"
|
||||
"_Decimal128" "_Decimal32" "_Decimal64" "_Generic" "_Imaginary"
|
||||
"_Noreturn" "_Static_assert" "_Thread_local" "__asm__" "asm"
|
||||
"auto" "break" "case" "char" "const" "continue" "default" "do"
|
||||
"double" "else" "enum" "extern" "float" "for" "goto" "if" "inline"
|
||||
"int" "long" "register" "restrict" "return" "short" "signed" "sizeof"
|
||||
"static" "struct" "switch" "typedef" "union" "unsigned" "void" "volatile"
|
||||
"while")
|
||||
(crystal-mode
|
||||
;; from https://github.com/crystal-lang/crystal-book/issues/124#issuecomment-1008311227
|
||||
"abstract" "alias" "annotation" "as" "as?" "asm" "begin" "break" "case" "class"
|
||||
"def" "do" "else" "elsif" "end" "ensure" "enum" "extend" "false" "for" "fun"
|
||||
"if" "in" "include" "instance_sizeof" "is_a?" "lib" "macro" "module" "next"
|
||||
"nil" "nil?" "of" "offsetof" "out" "pointerof" "private" "protected" "require"
|
||||
"rescue" "responds_to?" "return" "select" "self" "sizeof" "struct" "super"
|
||||
"then" "true" "type" "typeof" "uninitialized" "union" "unless" "until" "verbatim"
|
||||
"when" "while" "with" "yield")
|
||||
(csharp-mode
|
||||
"abstract" "add" "alias" "as" "base" "bool" "break" "byte" "case"
|
||||
"catch" "char" "checked" "class" "const" "continue" "decimal" "default"
|
||||
"delegate" "do" "double" "else" "enum" "event" "explicit" "extern"
|
||||
"false" "finally" "fixed" "float" "for" "foreach" "get" "global" "goto"
|
||||
"if" "implicit" "in" "int" "interface" "internal" "is" "lock" "long"
|
||||
"namespace" "new" "null" "object" "operator" "out" "override" "params"
|
||||
"partial" "private" "protected" "public" "readonly" "ref" "remove"
|
||||
"return" "sbyte" "sealed" "set" "short" "sizeof" "stackalloc" "static"
|
||||
"string" "struct" "switch" "this" "throw" "true" "try" "typeof" "uint"
|
||||
"ulong" "unchecked" "unsafe" "ushort" "using" "value" "var" "virtual"
|
||||
"void" "volatile" "where" "while" "yield")
|
||||
(d-mode
|
||||
;; from http://www.digitalmars.com/d/2.0/lex.html
|
||||
"abstract" "alias" "align" "asm"
|
||||
"assert" "auto" "body" "bool" "break" "byte" "case" "cast" "catch"
|
||||
"cdouble" "cent" "cfloat" "char" "class" "const" "continue" "creal"
|
||||
"dchar" "debug" "default" "delegate" "delete" "deprecated" "do"
|
||||
"double" "else" "enum" "export" "extern" "false" "final" "finally"
|
||||
"float" "for" "foreach" "foreach_reverse" "function" "goto" "idouble"
|
||||
"if" "ifloat" "import" "in" "inout" "int" "interface" "invariant"
|
||||
"ireal" "is" "lazy" "long" "macro" "mixin" "module" "new" "nothrow"
|
||||
"null" "out" "override" "package" "pragma" "private" "protected"
|
||||
"public" "pure" "real" "ref" "return" "scope" "short" "static" "struct"
|
||||
"super" "switch" "synchronized" "template" "this" "throw" "true" "try"
|
||||
"typedef" "typeid" "typeof" "ubyte" "ucent" "uint" "ulong" "union"
|
||||
"unittest" "ushort" "version" "void" "volatile" "wchar" "while" "with")
|
||||
(elixir-mode
|
||||
;; from https://hexdocs.pm/elixir/Kernel.html
|
||||
"__CALLER__" "__DIR__" "__ENV__" "__MODULE__" "__STACKTRACE__"
|
||||
"__aliases__" "__block__" "abs" "alias" "alias!" "and" "apply"
|
||||
"binary_part" "binary_slice" "binding" "bit_size" "byte_size" "case" "ceil"
|
||||
"cond" "dbg" "def" "defdelegate" "defexception" "defguard" "defguardp"
|
||||
"defimpl" "defmacro" "defmacrop" "defmodule" "defoverridable" "defp"
|
||||
"defprotocol" "defstruct" "destructure" "div" "elem" "exit" "floor" "fn"
|
||||
"for" "function_exported?" "get_and_update_in" "get_in" "hd" "if" "import"
|
||||
"in" "inspect" "is_atom" "is_binary" "is_bitstring" "is_boolean"
|
||||
"is_exception" "is_float" "is_function" "is_integer" "is_list" "is_map"
|
||||
"is_map_key" "is_nil" "is_number" "is_pid" "is_port" "is_reference"
|
||||
"is_struct" "is_tuple" "length" "macro_exported?" "make_ref" "map_size"
|
||||
"match?" "max" "min" "node" "not" "or" "pop_in" "put_elem" "put_in" "quote"
|
||||
"raise" "receive" "rem" "require" "reraise" "round" "self" "send" "spawn"
|
||||
"spawn_link" "spawn_monitor" "struct" "struct!" "super" "tap" "then"
|
||||
"throw" "tl" "to_charlist" "to_string" "trunc" "try" "tuple_size" "unless"
|
||||
"unquote" "unquote_splicing" "update_in" "use" "var!" "with")
|
||||
(erlang-mode
|
||||
;; from https://www.erlang.org/docs/20/reference_manual/introduction.html#id63536
|
||||
"after" "and" "andalso" "band" "begin" "bnot" "bor" "bsl" "bsr" "bxor"
|
||||
"case" "catch" "cond" "div" "end" "fun" "if" "let" "not" "of" "or" "orelse"
|
||||
"receive" "rem" "try" "when" "xor")
|
||||
(f90-mode .
|
||||
;; from f90.el
|
||||
;; ".AND." ".GE." ".GT." ".LT." ".LE." ".NE." ".OR." ".TRUE." ".FALSE."
|
||||
,(company-keywords-upper-lower
|
||||
"abs" "abstract" "achar" "acos" "adjustl" "adjustr" "aimag" "aint"
|
||||
"align" "all" "all_prefix" "all_scatter" "all_suffix" "allocatable"
|
||||
"allocate" "allocated" "and" "anint" "any" "any_prefix" "any_scatter"
|
||||
"any_suffix" "asin" "assign" "assignment" "associate" "associated"
|
||||
"asynchronous" "atan" "atan2" "backspace" "bind" "bit_size" "block"
|
||||
"btest" "c_alert" "c_associated" "c_backspace" "c_bool"
|
||||
"c_carriage_return" "c_char" "c_double" "c_double_complex" "c_f_pointer"
|
||||
"c_f_procpointer" "c_float" "c_float_complex" "c_form_feed" "c_funloc"
|
||||
"c_funptr" "c_horizontal_tab" "c_int" "c_int16_t" "c_int32_t" "c_int64_t"
|
||||
"c_int8_t" "c_int_fast16_t" "c_int_fast32_t" "c_int_fast64_t"
|
||||
"c_int_fast8_t" "c_int_least16_t" "c_int_least32_t" "c_int_least64_t"
|
||||
"c_int_least8_t" "c_intmax_t" "c_intptr_t" "c_loc" "c_long"
|
||||
"c_long_double" "c_long_double_complex" "c_long_long" "c_new_line"
|
||||
"c_null_char" "c_null_funptr" "c_null_ptr" "c_ptr" "c_short"
|
||||
"c_signed_char" "c_size_t" "c_vertical_tab" "call" "case" "ceiling"
|
||||
"char" "character" "character_storage_size" "class" "close" "cmplx"
|
||||
"command_argument_count" "common" "complex" "conjg" "contains" "continue"
|
||||
"copy_prefix" "copy_scatter" "copy_suffix" "cos" "cosh" "count"
|
||||
"count_prefix" "count_scatter" "count_suffix" "cpu_time" "cshift"
|
||||
"cycle" "cyclic" "data" "date_and_time" "dble" "deallocate" "deferred"
|
||||
"digits" "dim" "dimension" "distribute" "do" "dot_product" "double"
|
||||
"dprod" "dynamic" "elemental" "else" "elseif" "elsewhere" "end" "enddo"
|
||||
"endfile" "endif" "entry" "enum" "enumerator" "eoshift" "epsilon" "eq"
|
||||
"equivalence" "eqv" "error_unit" "exit" "exp" "exponent" "extends"
|
||||
"extends_type_of" "external" "extrinsic" "false" "file_storage_size"
|
||||
"final" "floor" "flush" "forall" "format" "fraction" "function" "ge"
|
||||
"generic" "get_command" "get_command_argument" "get_environment_variable"
|
||||
"goto" "grade_down" "grade_up" "gt" "hpf_alignment" "hpf_distribution"
|
||||
"hpf_template" "huge" "iachar" "iall" "iall_prefix" "iall_scatter"
|
||||
"iall_suffix" "iand" "iany" "iany_prefix" "iany_scatter" "iany_suffix"
|
||||
"ibclr" "ibits" "ibset" "ichar" "ieee_arithmetic" "ieee_exceptions"
|
||||
"ieee_features" "ieee_get_underflow_mode" "ieee_set_underflow_mode"
|
||||
"ieee_support_underflow_control" "ieor" "if" "ilen" "implicit"
|
||||
"import" "include" "independent" "index" "inherit" "input_unit"
|
||||
"inquire" "int" "integer" "intent" "interface" "intrinsic" "ior"
|
||||
"iostat_end" "iostat_eor" "iparity" "iparity_prefix" "iparity_scatter"
|
||||
"iparity_suffix" "ishft" "ishftc" "iso_c_binding" "iso_fortran_env"
|
||||
"kind" "lbound" "le" "leadz" "len" "len_trim" "lge" "lgt" "lle" "llt"
|
||||
"log" "log10" "logical" "lt" "matmul" "max" "maxexponent" "maxloc"
|
||||
"maxval" "maxval_prefix" "maxval_scatter" "maxval_suffix" "merge"
|
||||
"min" "minexponent" "minloc" "minval" "minval_prefix" "minval_scatter"
|
||||
"minval_suffix" "mod" "module" "modulo" "move_alloc" "mvbits" "namelist"
|
||||
"ne" "nearest" "neqv" "new" "new_line" "nint" "non_intrinsic"
|
||||
"non_overridable" "none" "nopass" "not" "null" "nullify"
|
||||
"number_of_processors" "numeric_storage_size" "only" "onto" "open"
|
||||
"operator" "optional" "or" "output_unit" "pack" "parameter" "parity"
|
||||
"parity_prefix" "parity_scatter" "parity_suffix" "pass" "pause"
|
||||
"pointer" "popcnt" "poppar" "precision" "present" "print" "private"
|
||||
"procedure" "processors" "processors_shape" "product" "product_prefix"
|
||||
"product_scatter" "product_suffix" "program" "protected" "public"
|
||||
"pure" "radix" "random_number" "random_seed" "range" "read" "real"
|
||||
"realign" "recursive" "redistribute" "repeat" "reshape" "result"
|
||||
"return" "rewind" "rrspacing" "same_type_as" "save" "scale" "scan"
|
||||
"select" "selected_char_kind" "selected_int_kind" "selected_real_kind"
|
||||
"sequence" "set_exponent" "shape" "sign" "sin" "sinh" "size" "spacing"
|
||||
"spread" "sqrt" "stop" "subroutine" "sum" "sum_prefix" "sum_scatter"
|
||||
"sum_suffix" "system_clock" "tan" "tanh" "target" "template" "then"
|
||||
"tiny" "transfer" "transpose" "trim" "true" "type" "ubound" "unpack"
|
||||
"use" "value" "verify" "volatile" "wait" "where" "while" "with" "write"))
|
||||
(go-mode
|
||||
;; 1. Keywords ref: https://golang.org/ref/spec#Keywords
|
||||
;; 2. Builtin functions and types ref: https://golang.org/pkg/builtin/
|
||||
"append" "bool" "break" "byte" "cap" "case" "chan" "close" "complex" "complex128"
|
||||
"complex64" "const" "continue" "copy" "default" "defer" "delete" "else" "error"
|
||||
"fallthrough" "false" "float32" "float64" "for" "func" "go" "goto" "if" "imag"
|
||||
"import" "int" "int16" "int32" "int64" "int8" "interface" "len" "make"
|
||||
"map" "new" "nil" "package" "panic" "print" "println" "range" "real" "recover"
|
||||
"return" "rune" "select" "string" "struct" "switch" "true" "type" "uint" "uint16"
|
||||
"uint32" "uint64" "uint8" "uintptr" "var")
|
||||
(java-mode
|
||||
"abstract" "assert" "boolean" "break" "byte" "case" "catch" "char" "class"
|
||||
"continue" "default" "do" "double" "else" "enum" "extends" "final"
|
||||
"finally" "float" "for" "if" "implements" "import" "instanceof" "int"
|
||||
"interface" "long" "native" "new" "package" "private" "protected" "public"
|
||||
"return" "short" "static" "strictfp" "super" "switch" "synchronized"
|
||||
"this" "throw" "throws" "transient" "try" "void" "volatile" "while")
|
||||
(javascript-mode
|
||||
;; https://tc39.github.io/ecma262/ + async, static and undefined
|
||||
"async" "await" "break" "case" "catch" "class" "const" "continue"
|
||||
"debugger" "default" "delete" "do" "else" "enum" "export" "extends" "false"
|
||||
"finally" "for" "function" "if" "import" "in" "instanceof" "let" "new"
|
||||
"null" "return" "static" "super" "switch" "this" "throw" "true" "try"
|
||||
"typeof" "undefined" "var" "void" "while" "with" "yield")
|
||||
(kotlin-mode
|
||||
"abstract" "annotation" "as" "break" "by" "catch" "class" "companion"
|
||||
"const" "constructor" "continue" "data" "do" "else" "enum" "false" "final"
|
||||
"finally" "for" "fun" "if" "import" "in" "init" "inner" "interface"
|
||||
"internal" "is" "lateinit" "nested" "null" "object" "open" "out" "override"
|
||||
"package" "private" "protected" "public" "return" "super" "this" "throw"
|
||||
"trait" "true" "try" "typealias" "val" "var" "when" "while")
|
||||
(lua-mode
|
||||
;; https://www.lua.org/manual/5.3/manual.html
|
||||
"and" "break" "do" "else" "elseif" "end" "false" "for" "function" "goto" "if"
|
||||
"in" "local" "nil" "not" "or" "repeat" "return" "then" "true" "until" "while")
|
||||
(nim-mode
|
||||
;; https://nim-lang.org/docs/manual.html#lexical-analysis-identifiers-amp-keywords
|
||||
"addr" "and" "as" "asm" "bind" "block" "break" "case" "cast" "concept" "const" "continue"
|
||||
"converter" "defer" "discard" "distinct" "div" "do" "elif" "else" "end" "enum" "except"
|
||||
"export" "finally" "for" "from" "func" "if" "import" "in" "include" "interface" "is" "isnot"
|
||||
"iterator" "let" "macro" "method" "mixin" "mod" "nil" "not" "notin" "object" "of" "or" "out"
|
||||
"proc" "ptr" "raise" "ref" "return" "shl" "shr" "static" "template" "try" "tuple" "type"
|
||||
"using" "var" "when" "while" "xor" "yield")
|
||||
(objc-mode
|
||||
"@catch" "@class" "@encode" "@end" "@finally" "@implementation"
|
||||
"@interface" "@private" "@protected" "@protocol" "@public"
|
||||
"@selector" "@synchronized" "@throw" "@try" "alloc" "autorelease"
|
||||
"bycopy" "byref" "in" "inout" "oneway" "out" "release" "retain")
|
||||
(perl-mode
|
||||
;; from cperl.el
|
||||
"AUTOLOAD" "BEGIN" "CHECK" "CORE" "DESTROY" "END" "INIT" "__END__"
|
||||
"__FILE__" "__LINE__" "abs" "accept" "alarm" "and" "atan2" "bind"
|
||||
"binmode" "bless" "caller" "chdir" "chmod" "chomp" "chop" "chown" "chr"
|
||||
"chroot" "close" "closedir" "cmp" "connect" "continue" "cos"
|
||||
"crypt" "dbmclose" "dbmopen" "defined" "delete" "die" "do" "dump" "each"
|
||||
"else" "elsif" "endgrent" "endhostent" "endnetent" "endprotoent"
|
||||
"endpwent" "endservent" "eof" "eq" "eval" "exec" "exists" "exit" "exp"
|
||||
"fcntl" "fileno" "flock" "for" "foreach" "fork" "format" "formline"
|
||||
"ge" "getc" "getgrent" "getgrgid" "getgrnam" "gethostbyaddr"
|
||||
"gethostbyname" "gethostent" "getlogin" "getnetbyaddr" "getnetbyname"
|
||||
"getnetent" "getpeername" "getpgrp" "getppid" "getpriority"
|
||||
"getprotobyname" "getprotobynumber" "getprotoent" "getpwent" "getpwnam"
|
||||
"getpwuid" "getservbyname" "getservbyport" "getservent" "getsockname"
|
||||
"getsockopt" "glob" "gmtime" "goto" "grep" "gt" "hex" "if" "index" "int"
|
||||
"ioctl" "join" "keys" "kill" "last" "lc" "lcfirst" "le" "length"
|
||||
"link" "listen" "local" "localtime" "lock" "log" "lstat" "lt" "map"
|
||||
"mkdir" "msgctl" "msgget" "msgrcv" "msgsnd" "my" "ne" "next" "no"
|
||||
"not" "oct" "open" "opendir" "or" "ord" "our" "pack" "package" "pipe"
|
||||
"pop" "pos" "print" "printf" "push" "q" "qq" "quotemeta" "qw" "qx"
|
||||
"rand" "read" "readdir" "readline" "readlink" "readpipe" "recv" "redo"
|
||||
"ref" "rename" "require" "reset" "return" "reverse" "rewinddir" "rindex"
|
||||
"rmdir" "scalar" "seek" "seekdir" "select" "semctl" "semget" "semop"
|
||||
"send" "setgrent" "sethostent" "setnetent" "setpgrp" "setpriority"
|
||||
"setprotoent" "setpwent" "setservent" "setsockopt" "shift" "shmctl"
|
||||
"shmget" "shmread" "shmwrite" "shutdown" "sin" "sleep" "socket"
|
||||
"socketpair" "sort" "splice" "split" "sprintf" "sqrt" "srand" "stat"
|
||||
"study" "sub" "substr" "symlink" "syscall" "sysopen" "sysread" "system"
|
||||
"syswrite" "tell" "telldir" "tie" "time" "times" "tr" "truncate" "uc"
|
||||
"ucfirst" "umask" "undef" "unless" "unlink" "unpack" "unshift" "untie"
|
||||
"until" "use" "utime" "values" "vec" "wait" "waitpid"
|
||||
"wantarray" "warn" "while" "write" "x" "xor" "y")
|
||||
(php-mode ;; https://www.php.net/manual/reserved.php
|
||||
"Closure" "Error" "Exception" "Generator" "Throwable"
|
||||
"__CLASS__" "__DIR__" "__FILE__" "__FUNCTION__" "__LINE__" "__METHOD__"
|
||||
"__NAMESPACE__" "__TRAIT__"
|
||||
"abstract" "and" "array" "as" "bool" "break" "callable" "case" "catch"
|
||||
"class" "clone" "const" "continue" "declare" "default" "die" "do" "echo"
|
||||
"else" "elseif" "empty" "enddeclare" "endfor" "endforeach" "endif"
|
||||
"endswitch" "endwhile" "enum" "eval" "exit" "extends" "false" "final" "finally"
|
||||
"float" "fn" "for" "foreach" "function" "global" "goto" "if"
|
||||
"implements" "include" "include_once" "instanceof" "insteadof" "interface"
|
||||
"isset" "iterable" "list" "match" "namespace" "new" "null" "object" "or"
|
||||
"print" "private" "protected" "public" "readonly" "require" "require_once"
|
||||
"return" "self" "static" "string" "switch" "this" "throw" "trait" "true"
|
||||
"try" "unset" "use" "var" "void" "while" "xor" "yield" "yield from")
|
||||
(purescript-mode ;; purescript-font-lock.el
|
||||
"ado" "case" "class" "data" "default" "deriving" "do" "else" "if" "import"
|
||||
"in" "infix" "infixl" "infixr" "instance" "let" "module" "newtype" "of"
|
||||
"then" "type" "where")
|
||||
(python-mode
|
||||
;; https://docs.python.org/3/reference/lexical_analysis.html#keywords
|
||||
"False" "None" "True" "and" "as" "assert" "break" "class" "continue" "def"
|
||||
"del" "elif" "else" "except" "exec" "finally" "for" "from" "global" "if"
|
||||
"import" "in" "is" "lambda" "nonlocal" "not" "or" "pass" "print" "raise"
|
||||
"return" "try" "while" "with" "yield")
|
||||
(ruby-mode
|
||||
"BEGIN" "END" "alias" "and" "begin" "break" "case" "class" "def" "defined?"
|
||||
"do" "else" "elsif" "end" "ensure" "false" "for" "if" "in" "module"
|
||||
"next" "nil" "not" "or" "redo" "rescue" "retry" "return" "self" "super"
|
||||
"then" "true" "undef" "unless" "until" "when" "while" "yield")
|
||||
;; From https://doc.rust-lang.org/grammar.html#keywords
|
||||
;; but excluding unused reserved words: https://www.reddit.com/r/rust/comments/34fq0k/is_there_a_good_list_of_rusts_keywords/cqucvnj
|
||||
(rust-mode
|
||||
"Self"
|
||||
"as" "box" "break" "const" "continue" "crate" "else" "enum" "extern"
|
||||
"false" "fn" "for" "if" "impl" "in" "let" "loop" "macro" "match" "mod"
|
||||
"move" "mut" "pub" "ref" "return" "self" "static" "struct" "super"
|
||||
"trait" "true" "type" "unsafe" "use" "where" "while")
|
||||
; Extract from R7RS-small Tex: https://small.r7rs.org/
|
||||
(scheme-mode
|
||||
"abs" "acos" "angle" "append" "apply" "asin" "assoc" "assq" "assv"
|
||||
"atan" "binary-port?" "body" "boolean=?" "boolean?" "bytevector"
|
||||
"bytevector-append" "bytevector-copy" "bytevector-copy!"
|
||||
"bytevector-length" "bytevector-u8-ref" "bytevector-u8-set!"
|
||||
"bytevector?" "caaaar" "caaadr" "caaar" "caadar" "caaddr" "caadr"
|
||||
"caar" "cadaar" "cadadr" "cadar" "caddar" "cadddr" "caddr" "cadr"
|
||||
"call-with-port" "call-with-values" "car" "car-internal" "cdaaar"
|
||||
"cdaadr" "cdaar" "cdadar" "cdaddr" "cdadr" "cdar" "cddaar" "cddadr"
|
||||
"cddar" "cdddar" "cddddr" "cdddr" "cddr" "cdr" "ceiling"
|
||||
"char->integer" "char-alphabetic?" "char-ci<=?" "char-ci<?"
|
||||
"char-ci=?" "char-ci>=?" "char-ci>?" "char-downcase" "char-foldcase"
|
||||
"char-lower-case?" "char-numeric?" "char-ready?" "char-upcase"
|
||||
"char-upper-case?" "char-whitespace?" "char<=?" "char<?" "char=?"
|
||||
"char>=?" "char>?" "char?" "close-input-port" "close-output-port"
|
||||
"close-port" "command-line" "complex?" "cons" "cos"
|
||||
"current-error-port" "current-input-port" "current-jiffy"
|
||||
"current-output-port" "current-second" "delete-file" "denominator"
|
||||
"digit-value" "display" "dynamic-wind" "emergency-exit" "environment"
|
||||
"eof-object" "eof-object?" "eq?" "equal?" "eqv?" "error"
|
||||
"error-object-irritants" "error-object-message" "error-object?" "eval"
|
||||
"even?" "exact" "exact-integer-sqrt" "exact-integer?" "exact?" "exit"
|
||||
"exp" "expt" "features" "file-error?" "file-exists?" "finite?" "floor"
|
||||
"floor-quotient" "floor-remainder" "floor/" "flush-output-port" "gcd"
|
||||
"get-environment-variable" "get-environment-variables"
|
||||
"get-output-bytevector" "get-output-string" "imag-part" "inexact"
|
||||
"inexact?" "infinite?" "input-port-open?" "input-port?"
|
||||
"integer->char" "integer?" "interaction-environment"
|
||||
"jiffies-per-second" "lcm" "length" "list" "list->string"
|
||||
"list->vector" "list-copy" "list-ref" "list-set!" "list-tail" "list?"
|
||||
"load" "log" "magnitude" "make-bytevector" "make-list"
|
||||
"make-parameter" "make-polar" "make-promise" "make-rectangular"
|
||||
"make-string" "make-vector" "max" "member" "memq" "memv" "min"
|
||||
"modulo" "nan?" "negative?" "newline" "nil" "not" "null-environment"
|
||||
"null?" "number->string" "number?" "numerator" "odd?"
|
||||
"open-binary-input-file" "open-binary-output-file"
|
||||
"open-input-bytevector" "open-input-file" "open-input-string"
|
||||
"open-output-bytevector" "open-output-file" "open-output-string"
|
||||
"output-port-open?" "output-port?" "pair?" "peek-char" "peek-u8"
|
||||
"port?" "positive?" "procedure?" "promise?" "quasiquote" "quote"
|
||||
"quotient" "raise" "raise-continuable" "rational?" "rationalize"
|
||||
"read" "read-bytevector" "read-bytevector!" "read-char" "read-error?"
|
||||
"read-line" "read-string" "read-u8" "real-part" "real?" "remainder"
|
||||
"reverse" "round" "scheme-report-environment" "set!" "set-car!"
|
||||
"set-cdr!" "setcar" "sin" "sqrt" "square" "string" "string->list"
|
||||
"string->number" "string->symbol" "string->utf" "string->vector"
|
||||
"string-append" "string-ci<=?" "string-ci<?" "string-ci=?"
|
||||
"string-ci>=?" "string-ci>?" "string-copy" "string-copy!"
|
||||
"string-downcase" "string-fill!" "string-foldcase" "string-for-each"
|
||||
"string-length" "string-map" "string-ref" "string-set!"
|
||||
"string-upcase" "string<=?" "string<?" "string=?" "string>=?"
|
||||
"string>?" "string?" "substring" "symbol->string" "symbol=?" "symbol?"
|
||||
"tan" "textual-port?" "truncate" "truncate-quotient"
|
||||
"truncate-remainder" "truncate/" "u8-ready?" "unquote"
|
||||
"unquote-splicing" "utf->string" "values" "vector" "vector->list"
|
||||
"vector->string" "vector-append" "vector-copy" "vector-copy!"
|
||||
"vector-fill!" "vector-for-each" "vector-length" "vector-map"
|
||||
"vector-ref" "vector-set!" "vector?" "with-exception-handler"
|
||||
"with-input-from-file" "with-output-to-file" "write"
|
||||
"write-bytevector" "write-char" "write-shared" "write-simple"
|
||||
"write-string" "write-u8" "zero?")
|
||||
(scala-mode
|
||||
"abstract" "case" "catch" "class" "def" "do" "else" "extends" "false"
|
||||
"final" "finally" "for" "forSome" "if" "implicit" "import" "lazy" "match"
|
||||
"new" "null" "object" "override" "package" "private" "protected"
|
||||
"return" "sealed" "super" "this" "throw" "trait" "true" "try" "type" "val"
|
||||
"var" "while" "with" "yield")
|
||||
(swift-mode
|
||||
"Protocol" "Self" "Type" "and" "as" "assignment" "associatedtype"
|
||||
"associativity" "available" "break" "case" "catch" "class" "column" "continue"
|
||||
"convenience" "default" "defer" "deinit" "didSet" "do" "dynamic" "dynamicType"
|
||||
"else" "elseif" "endif" "enum" "extension" "fallthrough" "false" "file"
|
||||
"fileprivate" "final" "for" "func" "function" "get" "guard" "higherThan" "if"
|
||||
"import" "in" "indirect" "infix" "init" "inout" "internal" "is" "lazy" "left"
|
||||
"let" "line" "lowerThan" "mutating" "nil" "none" "nonmutating" "open"
|
||||
"operator" "optional" "override" "postfix" "precedence" "precedencegroup"
|
||||
"prefix" "private" "protocol" "public" "repeat" "required" "rethrows" "return"
|
||||
"right" "selector" "self" "set" "static" "struct" "subscript" "super" "switch"
|
||||
"throw" "throws" "true" "try" "typealias" "unowned" "var" "weak" "where"
|
||||
"while" "willSet")
|
||||
(julia-mode
|
||||
"abstract" "break" "case" "catch" "const" "continue" "do" "else" "elseif"
|
||||
"end" "eval" "export" "false" "finally" "for" "function" "global" "if"
|
||||
"ifelse" "immutable" "import" "importall" "in" "let" "macro" "module"
|
||||
"otherwise" "quote" "return" "switch" "throw" "true" "try" "type"
|
||||
"typealias" "using" "while"
|
||||
)
|
||||
;; From https://github.com/apache/thrift/blob/master/contrib/thrift.el
|
||||
(thrift-mode
|
||||
"binary" "bool" "byte" "const" "double" "enum" "exception" "extends"
|
||||
"i16" "i32" "i64" "include" "list" "map" "oneway" "optional" "required"
|
||||
"service" "set" "string" "struct" "throws" "typedef" "void"
|
||||
)
|
||||
(tuareg-mode
|
||||
;; ocaml, from https://v2.ocaml.org/manual/lex.html#sss:keywords
|
||||
"and" "as" "asr" "assert" "begin" "class"
|
||||
"constraint" "do" "done" "downto" "else" "end"
|
||||
"exception" "external" "false" "for" "fun" "function"
|
||||
"functor" "if" "in" "include" "inherit" "initializer"
|
||||
"land" "lazy" "let" "lor" "lsl" "lsr"
|
||||
"lxor" "match" "method" "mod" "module" "mutable"
|
||||
"new" "nonrec" "object" "of" "open" "or"
|
||||
"private" "rec" "sig" "struct" "then" "to"
|
||||
"true" "try" "type" "val" "virtual" "when"
|
||||
"while" "with"
|
||||
)
|
||||
;; aliases
|
||||
(caml-mode . tuareg-mode)
|
||||
(js2-mode . javascript-mode)
|
||||
(js2-jsx-mode . javascript-mode)
|
||||
(espresso-mode . javascript-mode)
|
||||
(js-mode . javascript-mode)
|
||||
(js-jsx-mode . javascript-mode)
|
||||
(rjsx-mode . javascript-mode)
|
||||
(cperl-mode . perl-mode)
|
||||
(jde-mode . java-mode)
|
||||
(ess-julia-mode . julia-mode)
|
||||
(php-ts-mode . php-mode)
|
||||
(phps-mode . php-mode)
|
||||
(enh-ruby-mode . ruby-mode))
|
||||
"Alist mapping major-modes to sorted keywords for `company-keywords'.")
|
||||
|
||||
(with-eval-after-load 'make-mode
|
||||
(mapc
|
||||
(lambda (mode-stmnts)
|
||||
(setf (alist-get (car mode-stmnts) company-keywords-alist)
|
||||
(cl-remove-duplicates
|
||||
(sort (append makefile-special-targets-list
|
||||
(cl-mapcan #'identity
|
||||
(mapcar
|
||||
#'split-string
|
||||
(cl-remove-if-not
|
||||
#'stringp
|
||||
(symbol-value (cdr mode-stmnts))))))
|
||||
#'string<)
|
||||
:test #'string=)))
|
||||
'((makefile-automake-mode . makefile-automake-statements)
|
||||
(makefile-gmake-mode . makefile-gmake-statements)
|
||||
(makefile-makepp-mode . makefile-makepp-statements)
|
||||
(makefile-bsdmake-mode . makefile-bsdmake-statements)
|
||||
(makefile-imake-mode . makefile-statements)
|
||||
(makefile-mode . makefile-statements))))
|
||||
|
||||
;;;###autoload
|
||||
(defun company-keywords (command &optional arg &rest _ignored)
|
||||
"`company-mode' backend for programming language keywords."
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-keywords))
|
||||
(prefix (and (assq major-mode company-keywords-alist)
|
||||
(not (company-in-string-or-comment))
|
||||
(or (company-grab-symbol) 'stop)))
|
||||
(candidates
|
||||
(let ((completion-ignore-case company-keywords-ignore-case)
|
||||
(symbols (cdr (assq major-mode company-keywords-alist))))
|
||||
(all-completions arg (if (consp symbols)
|
||||
symbols
|
||||
(cdr (assq symbols company-keywords-alist))))))
|
||||
(kind 'keyword)
|
||||
(sorted t)
|
||||
(ignore-case company-keywords-ignore-case)))
|
||||
|
||||
(provide 'company-keywords)
|
||||
;;; company-keywords.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-keywords.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-keywords.elc
Normal file
Binary file not shown.
142
desktop/.emacs.d/elpa/company-20240625.0/company-nxml.el
Normal file
142
desktop/.emacs.d/elpa/company-20240625.0/company-nxml.el
Normal file
|
@ -0,0 +1,142 @@
|
|||
;;; company-nxml.el --- company-mode completion backend for nxml-mode -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2015, 2017-2018, 2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; In Emacs >= 26, company-capf is used instead.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'company)
|
||||
(require 'cl-lib)
|
||||
|
||||
(defvar rng-open-elements)
|
||||
(defvar rng-validate-mode)
|
||||
(defvar rng-in-attribute-regex)
|
||||
(defvar rng-in-attribute-value-regex)
|
||||
(declare-function rng-set-state-after "rng-nxml")
|
||||
(declare-function rng-match-possible-start-tag-names "rng-match")
|
||||
(declare-function rng-adjust-state-for-attribute "rng-nxml")
|
||||
(declare-function rng-match-possible-attribute-names "rng-match")
|
||||
(declare-function rng-adjust-state-for-attribute-value "rng-nxml")
|
||||
(declare-function rng-match-possible-value-strings "rng-match")
|
||||
|
||||
(defconst company-nxml-token-regexp
|
||||
"\\(?:[_[:alpha:]][-._[:alnum:]]*\\_>\\)")
|
||||
|
||||
(defvar company-nxml-in-attribute-value-regexp
|
||||
(replace-regexp-in-string "w" company-nxml-token-regexp
|
||||
"<w\\(?::w\\)?\
|
||||
\\(?:[ \t\r\n]+w\\(?::w\\)?[ \t\r\n]*=\
|
||||
\[ \t\r\n]*\\(?:\"[^\"]*\"\\|'[^']*'\\)\\)*\
|
||||
\[ \t\r\n]+\\(w\\(:w\\)?\\)[ \t\r\n]*=[ \t\r\n]*\
|
||||
\\(\"\\([^\"]*\\>\\)\\|'\\([^']*\\>\\)\\)\\="
|
||||
t t))
|
||||
|
||||
(defvar company-nxml-in-tag-name-regexp
|
||||
(replace-regexp-in-string "w" company-nxml-token-regexp
|
||||
"<\\(/?w\\(?::w?\\)?\\)?\\=" t t))
|
||||
|
||||
(defun company-nxml-all-completions (prefix alist)
|
||||
(let ((candidates (mapcar 'cdr alist))
|
||||
(case-fold-search nil)
|
||||
filtered)
|
||||
(when (cdar rng-open-elements)
|
||||
(push (concat "/" (cdar rng-open-elements)) candidates))
|
||||
(setq candidates (sort (all-completions prefix candidates) 'string<))
|
||||
(while candidates
|
||||
(unless (equal (car candidates) (car filtered))
|
||||
(push (car candidates) filtered))
|
||||
(pop candidates))
|
||||
(nreverse filtered)))
|
||||
|
||||
(defmacro company-nxml-prepared (&rest body)
|
||||
(declare (indent 0) (debug t))
|
||||
`(let ((lt-pos (save-excursion (search-backward "<" nil t))))
|
||||
(when (and lt-pos (= (rng-set-state-after lt-pos) lt-pos))
|
||||
,@body)))
|
||||
|
||||
(defun company-nxml-tag (command &optional arg &rest _ignored)
|
||||
(cl-case command
|
||||
(prefix (and (derived-mode-p 'nxml-mode)
|
||||
rng-validate-mode
|
||||
(company-grab company-nxml-in-tag-name-regexp 1)))
|
||||
(candidates (company-nxml-prepared
|
||||
(company-nxml-all-completions
|
||||
arg (rng-match-possible-start-tag-names))))
|
||||
(sorted t)))
|
||||
|
||||
(defun company-nxml-attribute (command &optional arg &rest _ignored)
|
||||
(cl-case command
|
||||
(prefix (and (derived-mode-p 'nxml-mode)
|
||||
rng-validate-mode
|
||||
(memq (char-after) '(?\ ?\t ?\n)) ;; outside word
|
||||
(company-grab rng-in-attribute-regex 1)))
|
||||
(candidates (company-nxml-prepared
|
||||
(and (rng-adjust-state-for-attribute
|
||||
lt-pos (- (point) (length arg)))
|
||||
(company-nxml-all-completions
|
||||
arg (rng-match-possible-attribute-names)))))
|
||||
(sorted t)))
|
||||
|
||||
(defun company-nxml-attribute-value (command &optional arg &rest _ignored)
|
||||
(cl-case command
|
||||
(prefix (and (derived-mode-p 'nxml-mode)
|
||||
rng-validate-mode
|
||||
(and (memq (char-after) '(?' ?\" ?\ ?\t ?\n)) ;; outside word
|
||||
(looking-back company-nxml-in-attribute-value-regexp nil)
|
||||
(or (match-string-no-properties 4)
|
||||
(match-string-no-properties 5)
|
||||
""))))
|
||||
(candidates (company-nxml-prepared
|
||||
(let (attr-start attr-end colon)
|
||||
(and (looking-back rng-in-attribute-value-regex lt-pos)
|
||||
(setq colon (match-beginning 2)
|
||||
attr-start (match-beginning 1)
|
||||
attr-end (match-end 1))
|
||||
(rng-adjust-state-for-attribute lt-pos attr-start)
|
||||
(rng-adjust-state-for-attribute-value
|
||||
attr-start colon attr-end)
|
||||
(all-completions
|
||||
arg (rng-match-possible-value-strings))))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun company-nxml (command &optional arg &rest _ignored)
|
||||
"`company-mode' completion backend for `nxml-mode'."
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-nxml))
|
||||
(prefix (or (company-nxml-tag 'prefix)
|
||||
(company-nxml-attribute 'prefix)
|
||||
(company-nxml-attribute-value 'prefix)))
|
||||
(candidates (cond
|
||||
((company-nxml-tag 'prefix)
|
||||
(company-nxml-tag 'candidates arg))
|
||||
((company-nxml-attribute 'prefix)
|
||||
(company-nxml-attribute 'candidates arg))
|
||||
((company-nxml-attribute-value 'prefix)
|
||||
(sort (company-nxml-attribute-value 'candidates arg)
|
||||
'string<))))
|
||||
(sorted t)))
|
||||
|
||||
(provide 'company-nxml)
|
||||
;;; company-nxml.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-nxml.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-nxml.elc
Normal file
Binary file not shown.
57
desktop/.emacs.d/elpa/company-20240625.0/company-oddmuse.el
Normal file
57
desktop/.emacs.d/elpa/company-20240625.0/company-oddmuse.el
Normal file
|
@ -0,0 +1,57 @@
|
|||
;;; company-oddmuse.el --- company-mode completion backend for oddmuse-mode -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2016, 2022, 2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'company)
|
||||
(require 'cl-lib)
|
||||
(eval-when-compile (require 'yaoddmuse nil t))
|
||||
(eval-when-compile (require 'oddmuse nil t))
|
||||
|
||||
(defvar company-oddmuse-link-regexp
|
||||
"\\(\\<[A-Z][[:alnum:]]*\\>\\)\\|\\[\\[\\([[:alnum:]]+\\>\\|\\)")
|
||||
|
||||
(defun company-oddmuse-get-page-table ()
|
||||
(cl-case major-mode
|
||||
(yaoddmuse-mode (with-no-warnings
|
||||
(yaoddmuse-get-pagename-table yaoddmuse-wikiname)))
|
||||
(oddmuse-mode (with-no-warnings
|
||||
(oddmuse-make-completion-table oddmuse-wiki)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun company-oddmuse (command &optional arg &rest _ignored)
|
||||
"`company-mode' completion backend for `oddmuse-mode'."
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-oddmuse))
|
||||
(prefix (let ((case-fold-search nil))
|
||||
(and (memq major-mode '(oddmuse-mode yaoddmuse-mode))
|
||||
(looking-back company-oddmuse-link-regexp (line-beginning-position))
|
||||
(or (match-string 1)
|
||||
(match-string 2)))))
|
||||
(candidates (all-completions arg (company-oddmuse-get-page-table)))))
|
||||
|
||||
(provide 'company-oddmuse)
|
||||
;;; company-oddmuse.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-oddmuse.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-oddmuse.elc
Normal file
Binary file not shown.
14
desktop/.emacs.d/elpa/company-20240625.0/company-pkg.el
Normal file
14
desktop/.emacs.d/elpa/company-20240625.0/company-pkg.el
Normal file
|
@ -0,0 +1,14 @@
|
|||
(define-package "company" "20240625.0" "Modular text completion framework"
|
||||
'((emacs "25.1"))
|
||||
:commit "8d2ca28a161f8b912889684412bb1d7fb07d035c" :authors
|
||||
'(("Nikolaj Schumacher"))
|
||||
:maintainers
|
||||
'(("Dmitry Gutov" . "dmitry@gutov.dev"))
|
||||
:maintainer
|
||||
'("Dmitry Gutov" . "dmitry@gutov.dev")
|
||||
:keywords
|
||||
'("abbrev" "convenience" "matching")
|
||||
:url "http://company-mode.github.io/")
|
||||
;; Local Variables:
|
||||
;; no-byte-compile: t
|
||||
;; End:
|
168
desktop/.emacs.d/elpa/company-20240625.0/company-semantic.el
Normal file
168
desktop/.emacs.d/elpa/company-20240625.0/company-semantic.el
Normal file
|
@ -0,0 +1,168 @@
|
|||
;;; company-semantic.el --- company-mode completion backend using Semantic -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2018, 2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'company)
|
||||
(require 'company-template)
|
||||
(require 'cl-lib)
|
||||
|
||||
(defvar semantic-idle-summary-function)
|
||||
(declare-function semantic-documentation-for-tag "semantic/doc" )
|
||||
(declare-function semantic-analyze-current-context "semantic/analyze")
|
||||
(declare-function semantic-analyze-possible-completions "semantic/complete")
|
||||
(declare-function semantic-analyze-find-tags-by-prefix "semantic/analyze/fcn")
|
||||
(declare-function semantic-tag-class "semantic/tag")
|
||||
(declare-function semantic-tag-name "semantic/tag")
|
||||
(declare-function semantic-tag-start "semantic/tag")
|
||||
(declare-function semantic-tag-buffer "semantic/tag")
|
||||
(declare-function semantic-active-p "semantic")
|
||||
(declare-function semantic-format-tag-prototype "semantic/format")
|
||||
|
||||
(defgroup company-semantic nil
|
||||
"Completion backend using Semantic."
|
||||
:group 'company)
|
||||
|
||||
(defcustom company-semantic-metadata-function 'company-semantic-summary-and-doc
|
||||
"The function turning a semantic tag into doc information."
|
||||
:type 'function)
|
||||
|
||||
(defcustom company-semantic-begin-after-member-access t
|
||||
"When non-nil, automatic completion will start whenever the current
|
||||
symbol is preceded by \".\", \"->\" or \"::\", ignoring
|
||||
`company-minimum-prefix-length'.
|
||||
|
||||
If `company-begin-commands' is a list, it should include `c-electric-lt-gt'
|
||||
and `c-electric-colon', for automatic completion right after \">\" and
|
||||
\":\"."
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom company-semantic-insert-arguments t
|
||||
"When non-nil, insert function arguments as a template after completion."
|
||||
:type 'boolean
|
||||
:package-version '(company . "0.9.0"))
|
||||
|
||||
(defvar company-semantic-modes '(c-mode c++-mode jde-mode java-mode))
|
||||
|
||||
(defvar-local company-semantic--current-tags nil
|
||||
"Tags for the current context.")
|
||||
|
||||
(defun company-semantic-documentation-for-tag (tag)
|
||||
(when (semantic-tag-buffer tag)
|
||||
;; When TAG's buffer is unknown, the function below raises an error.
|
||||
(semantic-documentation-for-tag tag)))
|
||||
|
||||
(defun company-semantic-doc-or-summary (tag)
|
||||
(or (company-semantic-documentation-for-tag tag)
|
||||
(and (require 'semantic-idle nil t)
|
||||
(require 'semantic/idle nil t)
|
||||
(funcall semantic-idle-summary-function tag nil t))))
|
||||
|
||||
(defun company-semantic-summary-and-doc (tag)
|
||||
(let ((doc (company-semantic-documentation-for-tag tag))
|
||||
(summary (funcall semantic-idle-summary-function tag nil t)))
|
||||
(and (stringp doc)
|
||||
(string-match "\n*\\(.*\\)$" doc)
|
||||
(setq doc (match-string 1 doc)))
|
||||
(concat summary
|
||||
(when doc
|
||||
(if (< (+ (length doc) (length summary) 4) (window-width))
|
||||
" -- "
|
||||
"\n"))
|
||||
doc)))
|
||||
|
||||
(defun company-semantic-doc-buffer (tag)
|
||||
(let ((doc (company-semantic-documentation-for-tag tag)))
|
||||
(when doc
|
||||
(company-doc-buffer
|
||||
(concat (funcall semantic-idle-summary-function tag nil t)
|
||||
"\n"
|
||||
doc)))))
|
||||
|
||||
(defsubst company-semantic-completions (prefix)
|
||||
(ignore-errors
|
||||
(let ((completion-ignore-case nil)
|
||||
(context (semantic-analyze-current-context)))
|
||||
(setq company-semantic--current-tags
|
||||
(semantic-analyze-possible-completions context 'no-unique))
|
||||
(all-completions prefix company-semantic--current-tags))))
|
||||
|
||||
(defun company-semantic-completions-raw (prefix)
|
||||
(setq company-semantic--current-tags nil)
|
||||
(dolist (tag (semantic-analyze-find-tags-by-prefix prefix))
|
||||
(unless (eq (semantic-tag-class tag) 'include)
|
||||
(push tag company-semantic--current-tags)))
|
||||
(delete "" (mapcar 'semantic-tag-name company-semantic--current-tags)))
|
||||
|
||||
(defun company-semantic-annotation (argument tags)
|
||||
(let* ((tag (assq argument tags))
|
||||
(kind (when tag (elt tag 1))))
|
||||
(cl-case kind
|
||||
(function (let* ((prototype (semantic-format-tag-prototype tag nil nil))
|
||||
(par-pos (string-match "(" prototype)))
|
||||
(when par-pos (substring prototype par-pos)))))))
|
||||
|
||||
(defun company-semantic--prefix ()
|
||||
(if company-semantic-begin-after-member-access
|
||||
(company-grab-symbol-cons "\\.\\|->\\|::" 2)
|
||||
(company-grab-symbol)))
|
||||
|
||||
;;;###autoload
|
||||
(defun company-semantic (command &optional arg &rest _ignored)
|
||||
"`company-mode' completion backend using CEDET Semantic."
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-semantic))
|
||||
(prefix (and (featurep 'semantic)
|
||||
(semantic-active-p)
|
||||
(memq major-mode company-semantic-modes)
|
||||
(not (company-in-string-or-comment))
|
||||
(or (company-semantic--prefix) 'stop)))
|
||||
(candidates (if (and (string-empty-p arg)
|
||||
(not (looking-back "->\\|\\.\\|::" (- (point) 2))))
|
||||
(company-semantic-completions-raw arg)
|
||||
(company-semantic-completions arg)))
|
||||
(meta (funcall company-semantic-metadata-function
|
||||
(assoc arg company-semantic--current-tags)))
|
||||
(annotation (company-semantic-annotation arg
|
||||
company-semantic--current-tags))
|
||||
(doc-buffer (company-semantic-doc-buffer
|
||||
(assoc arg company-semantic--current-tags)))
|
||||
;; Because "" is an empty context and doesn't return local variables.
|
||||
(no-cache (string-empty-p arg))
|
||||
(duplicates t)
|
||||
(location (let ((tag (assoc arg company-semantic--current-tags)))
|
||||
(when (buffer-live-p (semantic-tag-buffer tag))
|
||||
(cons (semantic-tag-buffer tag)
|
||||
(semantic-tag-start tag)))))
|
||||
(post-completion (let ((anno (company-semantic-annotation
|
||||
arg company-semantic--current-tags)))
|
||||
(when (and company-semantic-insert-arguments anno)
|
||||
(insert anno)
|
||||
(company-template-c-like-templatify (concat arg anno)))
|
||||
))))
|
||||
|
||||
(provide 'company-semantic)
|
||||
;;; company-semantic.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-semantic.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-semantic.elc
Normal file
Binary file not shown.
273
desktop/.emacs.d/elpa/company-20240625.0/company-template.el
Normal file
273
desktop/.emacs.d/elpa/company-20240625.0/company-template.el
Normal file
|
@ -0,0 +1,273 @@
|
|||
;;; company-template.el --- utility library for template expansion -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2010, 2013-2017, 2019, 2023-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'cl-lib)
|
||||
|
||||
(defface company-template-field
|
||||
'((((background dark)) (:background "yellow" :foreground "black"))
|
||||
(((background light)) (:background "orange" :foreground "black")))
|
||||
"Face used for editable text in template fields."
|
||||
:group 'company-faces)
|
||||
|
||||
(defvar company-template-forward-field-item
|
||||
'(menu-item "" company-template-forward-field
|
||||
:filter company-template--keymap-filter))
|
||||
|
||||
(defvar company-template-nav-map
|
||||
(let ((keymap (make-sparse-keymap)))
|
||||
(define-key keymap [tab] company-template-forward-field-item)
|
||||
(define-key keymap (kbd "TAB") company-template-forward-field-item)
|
||||
keymap))
|
||||
|
||||
(defvar company-template-clear-field-item
|
||||
'(menu-item "" company-template-clear-field
|
||||
:filter company-template--keymap-filter))
|
||||
|
||||
(defvar company-template-field-map
|
||||
(let ((keymap (make-sparse-keymap)))
|
||||
(set-keymap-parent keymap company-template-nav-map)
|
||||
(define-key keymap (kbd "C-d") company-template-clear-field-item)
|
||||
keymap))
|
||||
|
||||
(defvar-local company-template--buffer-templates nil)
|
||||
|
||||
;; interactive ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun company-template-templates-at (pos)
|
||||
(let (os)
|
||||
(dolist (o (overlays-at pos))
|
||||
;; FIXME: Always return the whole list of templates?
|
||||
;; We remove templates not at point after every command.
|
||||
(when (memq o company-template--buffer-templates)
|
||||
(push o os)))
|
||||
os))
|
||||
|
||||
(defun company-template-move-to-first (templ)
|
||||
(interactive)
|
||||
(goto-char (overlay-start templ))
|
||||
(company-template-forward-field))
|
||||
|
||||
(defun company-template-forward-field ()
|
||||
(interactive)
|
||||
(let ((start (point))
|
||||
(next-field-start (company-template-find-next-field)))
|
||||
(push-mark)
|
||||
(goto-char next-field-start)
|
||||
(company-template-remove-field (company-template-field-at start))))
|
||||
|
||||
(defun company-template-clear-field ()
|
||||
"Clear the field at point."
|
||||
(interactive)
|
||||
(let ((ovl (company-template-field-at (point))))
|
||||
(when ovl
|
||||
(company-template-remove-field ovl t)
|
||||
(let ((after-clear-fn
|
||||
(overlay-get ovl 'company-template-after-clear)))
|
||||
(when (functionp after-clear-fn)
|
||||
(funcall after-clear-fn))))))
|
||||
|
||||
(defun company-template--keymap-filter (cmd)
|
||||
(unless (run-hook-with-args-until-success 'yas-keymap-disable-hook)
|
||||
cmd))
|
||||
|
||||
(defun company-template--after-clear-c-like-field ()
|
||||
"Function that can be called after deleting a field of a c-like template.
|
||||
For c-like templates it is set as `after-post-fn' property on fields in
|
||||
`company-template-add-field'. If there is a next field, delete everything
|
||||
from point to it. If there is no field after point, remove preceding comma
|
||||
if present."
|
||||
(let* ((pos (point))
|
||||
(next-field-start (company-template-find-next-field))
|
||||
(last-field-p (not (company-template-field-at next-field-start))))
|
||||
(cond ((and (not last-field-p)
|
||||
(< pos next-field-start)
|
||||
(string-match "^[ ]*,+[ ]*$" (buffer-substring-no-properties
|
||||
pos next-field-start)))
|
||||
(delete-region pos next-field-start))
|
||||
((and last-field-p
|
||||
(looking-back ",+[ ]*" (line-beginning-position)))
|
||||
(delete-region (match-beginning 0) pos)))))
|
||||
|
||||
(defun company-template-find-next-field ()
|
||||
(let* ((start (point))
|
||||
(templates (company-template-templates-at start))
|
||||
(minimum (apply 'max (mapcar 'overlay-end templates)))
|
||||
(fields (cl-loop for templ in templates
|
||||
append (overlay-get templ 'company-template-fields))))
|
||||
(dolist (pos (mapcar 'overlay-start fields) minimum)
|
||||
(and pos
|
||||
(> pos start)
|
||||
(< pos minimum)
|
||||
(setq minimum pos)))))
|
||||
|
||||
(defun company-template-field-at (&optional point)
|
||||
(cl-loop for ovl in (overlays-at (or point (point)))
|
||||
when (overlay-get ovl 'company-template-parent)
|
||||
return ovl))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun company-template-declare-template (beg end)
|
||||
(let ((ov (make-overlay beg end)))
|
||||
;; (overlay-put ov 'face 'highlight)
|
||||
(overlay-put ov 'keymap company-template-nav-map)
|
||||
(overlay-put ov 'priority 101)
|
||||
(overlay-put ov 'evaporate t)
|
||||
(push ov company-template--buffer-templates)
|
||||
(add-hook 'post-command-hook 'company-template-post-command nil t)
|
||||
ov))
|
||||
|
||||
(defun company-template-remove-template (templ)
|
||||
(mapc 'company-template-remove-field
|
||||
(overlay-get templ 'company-template-fields))
|
||||
(setq company-template--buffer-templates
|
||||
(delq templ company-template--buffer-templates))
|
||||
(delete-overlay templ))
|
||||
|
||||
(defun company-template-add-field (templ beg end &optional display after-clear-fn)
|
||||
"Add new field to template TEMPL spanning from BEG to END.
|
||||
When DISPLAY is non-nil, set the respective property on the overlay.
|
||||
Leave point at the end of the field.
|
||||
AFTER-CLEAR-FN is a function that can be used to apply custom behavior
|
||||
after deleting a field in `company-template-remove-field'."
|
||||
(cl-assert templ)
|
||||
(when (> end (overlay-end templ))
|
||||
(move-overlay templ (overlay-start templ) end))
|
||||
(let ((ov (make-overlay beg end))
|
||||
(siblings (overlay-get templ 'company-template-fields)))
|
||||
;; (overlay-put ov 'evaporate t)
|
||||
(overlay-put ov 'intangible t)
|
||||
(overlay-put ov 'face 'company-template-field)
|
||||
(when display
|
||||
(overlay-put ov 'display display))
|
||||
(overlay-put ov 'company-template-parent templ)
|
||||
(overlay-put ov 'insert-in-front-hooks '(company-template-insert-hook))
|
||||
(when after-clear-fn
|
||||
(overlay-put ov 'company-template-after-clear after-clear-fn))
|
||||
(overlay-put ov 'keymap company-template-field-map)
|
||||
(overlay-put ov 'priority 101)
|
||||
(push ov siblings)
|
||||
(overlay-put templ 'company-template-fields siblings)))
|
||||
|
||||
(defun company-template-remove-field (ovl &optional clear)
|
||||
(when (overlayp ovl)
|
||||
(when (overlay-buffer ovl)
|
||||
(when clear
|
||||
(delete-region (overlay-start ovl) (overlay-end ovl)))
|
||||
(delete-overlay ovl))
|
||||
(let* ((templ (overlay-get ovl 'company-template-parent))
|
||||
(siblings (overlay-get templ 'company-template-fields)))
|
||||
(setq siblings (delq ovl siblings))
|
||||
(overlay-put templ 'company-template-fields siblings))))
|
||||
|
||||
(defun company-template-clean-up (&optional pos)
|
||||
"Clean up all templates that don't contain POS."
|
||||
(let ((local-ovs (overlays-at (or pos (point)))))
|
||||
(dolist (templ company-template--buffer-templates)
|
||||
(unless (memq templ local-ovs)
|
||||
(company-template-remove-template templ)))))
|
||||
|
||||
;; hooks ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun company-template-insert-hook (ovl after-p &rest _ignore)
|
||||
"Called when a snippet input prompt is modified."
|
||||
(unless after-p
|
||||
(company-template-remove-field ovl t)))
|
||||
|
||||
(defun company-template-post-command ()
|
||||
(company-template-clean-up)
|
||||
(unless company-template--buffer-templates
|
||||
(remove-hook 'post-command-hook 'company-template-post-command t)))
|
||||
|
||||
;; common ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun company-template-c-like-templatify (call)
|
||||
(let* ((end (point-marker))
|
||||
(beg (- (point) (length call)))
|
||||
(templ (company-template-declare-template beg end))
|
||||
forward-sexp-function
|
||||
paren-open paren-close)
|
||||
(with-syntax-table (make-syntax-table (syntax-table))
|
||||
(modify-syntax-entry ?< "(")
|
||||
(modify-syntax-entry ?> ")")
|
||||
(when (search-backward ")" beg t)
|
||||
(setq paren-close (point-marker))
|
||||
(forward-char 1)
|
||||
(delete-region (point) end)
|
||||
(backward-sexp)
|
||||
(forward-char 1)
|
||||
(setq paren-open (point-marker)))
|
||||
(when (search-backward ">" beg t)
|
||||
(let ((angle-close (point-marker)))
|
||||
(forward-char 1)
|
||||
(backward-sexp)
|
||||
(forward-char)
|
||||
(company-template--c-like-args templ angle-close)))
|
||||
(when (looking-back "\\((\\*)\\)(" (line-beginning-position))
|
||||
(delete-region (match-beginning 1) (match-end 1)))
|
||||
(when paren-open
|
||||
(goto-char paren-open)
|
||||
(company-template--c-like-args templ paren-close)))
|
||||
(if (overlay-get templ 'company-template-fields)
|
||||
(company-template-move-to-first templ)
|
||||
(company-template-remove-template templ)
|
||||
(goto-char end))))
|
||||
|
||||
(defun company-template--c-like-args (templ end)
|
||||
(let ((last-pos (point)))
|
||||
(while (re-search-forward "\\([^,]+\\),?" end 'move)
|
||||
(when (zerop (car (parse-partial-sexp last-pos (point))))
|
||||
(company-template-add-field templ last-pos (match-end 1) nil
|
||||
#'company-template--after-clear-c-like-field)
|
||||
(skip-chars-forward " ")
|
||||
(setq last-pos (point))))))
|
||||
|
||||
;; objc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun company-template-objc-templatify (selector)
|
||||
(let* ((end (point-marker))
|
||||
(beg (- (point) (length selector) 1))
|
||||
(templ (company-template-declare-template beg end))
|
||||
(cnt 0))
|
||||
(save-excursion
|
||||
(goto-char beg)
|
||||
(catch 'stop
|
||||
(while (search-forward ":" end t)
|
||||
(if (looking-at "\\(([^)]*)\\) ?")
|
||||
(company-template-add-field templ (point) (match-end 1))
|
||||
;; Not sure which conditions this case manifests under, but
|
||||
;; apparently it did before, when I wrote the first test for this
|
||||
;; function. FIXME: Revisit it.
|
||||
(company-template-add-field templ (point)
|
||||
(progn
|
||||
(insert (format "arg%d" cnt))
|
||||
(point)))
|
||||
(when (< (point) end)
|
||||
(insert " "))
|
||||
(cl-incf cnt))
|
||||
(when (>= (point) end)
|
||||
(throw 'stop t)))))
|
||||
(company-template-move-to-first templ)))
|
||||
|
||||
(provide 'company-template)
|
||||
;;; company-template.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-template.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-template.elc
Normal file
Binary file not shown.
72
desktop/.emacs.d/elpa/company-20240625.0/company-tempo.el
Normal file
72
desktop/.emacs.d/elpa/company-20240625.0/company-tempo.el
Normal file
|
@ -0,0 +1,72 @@
|
|||
;;; company-tempo.el --- company-mode completion backend for tempo -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2016, 2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'company)
|
||||
(require 'cl-lib)
|
||||
(require 'tempo)
|
||||
|
||||
(defgroup company-tempo nil
|
||||
"Tempo completion backend."
|
||||
:group 'company)
|
||||
|
||||
(defcustom company-tempo-expand nil
|
||||
"Whether to expand a tempo tag after completion."
|
||||
:type '(choice (const :tag "Off" nil)
|
||||
(const :tag "On" t)))
|
||||
|
||||
(defsubst company-tempo-lookup (match)
|
||||
(cdr (assoc match (tempo-build-collection))))
|
||||
|
||||
(defun company-tempo-insert (match)
|
||||
"Replace MATCH with the expanded tempo template."
|
||||
(search-backward match)
|
||||
(goto-char (match-beginning 0))
|
||||
(replace-match "")
|
||||
(call-interactively (company-tempo-lookup match)))
|
||||
|
||||
(defsubst company-tempo-meta (match)
|
||||
(let ((templ (company-tempo-lookup match))
|
||||
doc)
|
||||
(and templ
|
||||
(setq doc (documentation templ t))
|
||||
(car (split-string doc "\n" t)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun company-tempo (command &optional arg &rest _ignored)
|
||||
"`company-mode' completion backend for tempo."
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-tempo))
|
||||
(prefix (or (car (tempo-find-match-string tempo-match-finder)) ""))
|
||||
(candidates (all-completions arg (tempo-build-collection)))
|
||||
(kind 'snippet)
|
||||
(meta (company-tempo-meta arg))
|
||||
(post-completion (when company-tempo-expand (company-tempo-insert arg)))
|
||||
(sorted t)))
|
||||
|
||||
(provide 'company-tempo)
|
||||
;;; company-tempo.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-tempo.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-tempo.elc
Normal file
Binary file not shown.
196
desktop/.emacs.d/elpa/company-20240625.0/company-tng.el
Normal file
196
desktop/.emacs.d/elpa/company-20240625.0/company-tng.el
Normal file
|
@ -0,0 +1,196 @@
|
|||
;;; company-tng.el --- company-mode configuration for single-button interaction -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2017-2021, 2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikita Leshenko
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; company-tng (Tab and Go) allows you to perform completion using just TAB.
|
||||
;; Pressing it will both select the next completion candidate in the list and
|
||||
;; insert it into the buffer (or make it look like it's inserted, in fact).
|
||||
;;
|
||||
;; It cycles the candidates like `yank-pop' or `dabbrev-expand' or Vim:
|
||||
;; Pressing TAB selects the first item in the completion menu and inserts it in
|
||||
;; the buffer. Pressing TAB again selects the second item and replaces the
|
||||
;; "inserted" item with the second one. This can continue as long as the user
|
||||
;; wishes to cycle through the menu. You can also press S-TAB to select the
|
||||
;; previous candidate, of course.
|
||||
;;
|
||||
;; The benefits are that you only have to use one shortcut key and there is no
|
||||
;; need to confirm the entry.
|
||||
;;
|
||||
;; Usage:
|
||||
;;
|
||||
;; Enable `company-tng-mode' with:
|
||||
;;
|
||||
;; (add-hook 'after-init-hook 'company-tng-mode)
|
||||
;;
|
||||
;; in your init script. It will set up the required frontend, as well as make a
|
||||
;; number of recommended configuration changes described below.
|
||||
;;
|
||||
;; To avoid these changes, if you want to tweak everything yourself, customize
|
||||
;;`company-tng-auto-configure' to nil.
|
||||
;;
|
||||
;; We recommend to bind TAB to `company-select-next', S-TAB to
|
||||
;; `company-select-previous', and unbind RET and other now-unnecessary
|
||||
;; keys from `company-active-map':
|
||||
;;
|
||||
;; (define-key company-active-map (kbd "TAB") 'company-select-next)
|
||||
;; (define-key company-active-map (kbd "<backtab>") 'company-select-previous)
|
||||
;; (define-key company-active-map (kbd "RET") nil)
|
||||
;;
|
||||
;; Note that it's not necessary to rebind keys to use this frontend,
|
||||
;; you can use the arrow keys or M-n/M-p to select and insert
|
||||
;; candidates. You also need to decide which keys to unbind, depending
|
||||
;; on whether you want them to do the Company action or the default
|
||||
;; Emacs action (for example C-s or C-w).
|
||||
;;
|
||||
;; We recommend to disable `company-require-match' to allow free typing at any
|
||||
;; point.
|
||||
;;
|
||||
;; By default, company-tng doesn't work well with backends that insert function
|
||||
;; arguments into the buffer and (optionally) expand them into a snippet
|
||||
;; (usually performed in `post-completion' using yasnippet or company-template).
|
||||
;; In company-tng, completion candidates
|
||||
;; are inserted into the buffer as the user selects them and the completion is
|
||||
;; finished implicitly when the user continues typing after selecting a
|
||||
;; candidate. Modifying the buffer (by expanding a snippet) when the user
|
||||
;; continues typing would be surprising and undesirable, since the candidate was
|
||||
;; already inserted into the buffer.
|
||||
;;
|
||||
;; For this reason `company-tng-mode' by default disables arguments insertion
|
||||
;; for a number of popular backends. If the backend you are using is not among
|
||||
;; them, you might have to configure it not to do that yourself.
|
||||
;;
|
||||
;; YASnippet and company-tng both use TAB, which causes conflicts. The
|
||||
;; recommended way to use YASnippet with company-tng is to choose a different
|
||||
;; key for expanding a snippet and moving to the next snippet field:
|
||||
;;
|
||||
;; (define-key yas-minor-mode-map "\C-j" 'yas-expand)
|
||||
;; (define-key yas-keymap "\C-j" 'yas-next-field-or-maybe-expand)
|
||||
;; (dolist (keymap (list yas-minor-mode-map yas-keymap))
|
||||
;; (define-key keymap (kbd "TAB") nil)
|
||||
;; (define-key keymap [(tab)] nil))
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'company)
|
||||
(require 'cl-lib)
|
||||
|
||||
(defvar-local company-tng--overlay nil)
|
||||
|
||||
;;;###autoload
|
||||
(defun company-tng-frontend (command)
|
||||
"When the user changes the selection at least once, this
|
||||
frontend will display the candidate in the buffer as if it's
|
||||
already there and any key outside of `company-active-map' will
|
||||
confirm the selection and finish the completion."
|
||||
(cl-case command
|
||||
(show
|
||||
(let ((ov (make-overlay (point) (point))))
|
||||
(setq company-tng--overlay ov)
|
||||
(overlay-put ov 'priority 2)))
|
||||
(update
|
||||
(let* ((ov company-tng--overlay)
|
||||
(selected (and company-selection
|
||||
(nth company-selection company-candidates)))
|
||||
(prefix (length company-prefix)))
|
||||
(move-overlay ov (- (point) prefix) (point))
|
||||
(overlay-put ov
|
||||
(if (= prefix 0) 'after-string 'display)
|
||||
selected)))
|
||||
(hide
|
||||
(when company-tng--overlay
|
||||
(delete-overlay company-tng--overlay)
|
||||
(kill-local-variable 'company-tng--overlay)))
|
||||
(pre-command
|
||||
(when (and company-selection
|
||||
(not (company--company-command-p (this-command-keys))))
|
||||
(company--unread-this-command-keys)
|
||||
(setq this-command 'company-complete-selection)))))
|
||||
|
||||
(defvar company-clang-insert-arguments)
|
||||
(defvar company-semantic-insert-arguments)
|
||||
(defvar company-rtags-insert-arguments)
|
||||
(defvar lsp-enable-snippet)
|
||||
|
||||
(defgroup company-tng nil
|
||||
"Company Tab and Go."
|
||||
:group 'company)
|
||||
|
||||
(defcustom company-tng-auto-configure t
|
||||
"Automatically apply default configure when enable `company-tng-mode'."
|
||||
:type 'boolean)
|
||||
|
||||
;;;###autoload
|
||||
(define-obsolete-function-alias 'company-tng-configure-default 'company-tng-mode "0.10.0"
|
||||
"Applies the default configuration to enable company-tng.")
|
||||
|
||||
(declare-function eglot--snippet-expansion-fn "eglot")
|
||||
|
||||
(defvar company-tng-map
|
||||
(let ((keymap (make-sparse-keymap)))
|
||||
(set-keymap-parent keymap company-active-map)
|
||||
(define-key keymap [return] nil)
|
||||
(define-key keymap (kbd "RET") nil)
|
||||
(define-key keymap [tab] 'company-select-next)
|
||||
(define-key keymap (kbd "TAB") 'company-select-next)
|
||||
(define-key keymap [backtab] 'company-select-previous)
|
||||
(define-key keymap (kbd "S-TAB") 'company-select-previous)
|
||||
keymap))
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode company-tng-mode
|
||||
"This minor mode enables `company-tng-frontend'."
|
||||
:init-value nil
|
||||
:global t
|
||||
(cond
|
||||
(company-tng-mode
|
||||
(setq company-frontends
|
||||
(add-to-list 'company-frontends 'company-tng-frontend))
|
||||
(when company-tng-auto-configure
|
||||
(setq company-frontends '(company-tng-frontend
|
||||
company-pseudo-tooltip-frontend
|
||||
company-echo-metadata-frontend))
|
||||
(setq company-require-match nil
|
||||
company-clang-insert-arguments nil
|
||||
company-semantic-insert-arguments nil
|
||||
company-rtags-insert-arguments nil
|
||||
lsp-enable-snippet nil)
|
||||
(advice-add #'eglot--snippet-expansion-fn :override #'ignore)
|
||||
(setq company-active-map company-tng-map))
|
||||
(setq company-selection-default nil))
|
||||
(t
|
||||
(setq company-frontends
|
||||
'(company-pseudo-tooltip-unless-just-one-frontend
|
||||
company-preview-if-just-one-frontend
|
||||
company-echo-metadata-frontend))
|
||||
(when company-tng-auto-configure
|
||||
(setq company-require-match 'company-explicit-action-p
|
||||
company-clang-insert-arguments t
|
||||
company-semantic-insert-arguments t
|
||||
company-rtags-insert-arguments t
|
||||
lsp-enable-snippet t)
|
||||
(advice-remove #'eglot--snippet-expansion-fn #'ignore)
|
||||
(setq company-active-map (keymap-parent company-tng-map)))
|
||||
(setq company-selection-default 0))))
|
||||
|
||||
(provide 'company-tng)
|
||||
;;; company-tng.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-tng.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-tng.elc
Normal file
Binary file not shown.
200
desktop/.emacs.d/elpa/company-20240625.0/company-yasnippet.el
Normal file
200
desktop/.emacs.d/elpa/company-20240625.0/company-yasnippet.el
Normal file
|
@ -0,0 +1,200 @@
|
|||
;;; company-yasnippet.el --- company-mode completion backend for Yasnippet -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2014-2015, 2020-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Dmitry Gutov
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'company)
|
||||
(require 'cl-lib)
|
||||
|
||||
(declare-function yas--table-hash "yasnippet")
|
||||
(declare-function yas--get-snippet-tables "yasnippet")
|
||||
(declare-function yas-expand-snippet "yasnippet")
|
||||
(declare-function yas--template-content "yasnippet")
|
||||
(declare-function yas--template-expand-env "yasnippet")
|
||||
(declare-function yas--warning "yasnippet")
|
||||
(declare-function yas-minor-mode "yasnippet")
|
||||
(declare-function yas--require-template-specific-condition-p "yasnippet")
|
||||
(declare-function yas--template-can-expand-p "yasnippet")
|
||||
(declare-function yas--template-condition "yasnippet")
|
||||
|
||||
(defvar company-yasnippet-annotation-fn
|
||||
(lambda (name)
|
||||
(concat
|
||||
(unless company-tooltip-align-annotations " -> ")
|
||||
name))
|
||||
"Function to format completion annotation.
|
||||
It has to accept one argument: the snippet's name.")
|
||||
|
||||
(defun company-yasnippet--key-prefixes ()
|
||||
;; Mostly copied from `yas--templates-for-key-at-point'.
|
||||
(defvar yas-key-syntaxes)
|
||||
(save-excursion
|
||||
(let ((original (point))
|
||||
(methods yas-key-syntaxes)
|
||||
prefixes
|
||||
method)
|
||||
(while methods
|
||||
(unless (eq method (car methods))
|
||||
(goto-char original))
|
||||
(setq method (car methods))
|
||||
(cond ((stringp method)
|
||||
(skip-syntax-backward method)
|
||||
(setq methods (cdr methods)))
|
||||
((functionp method)
|
||||
(unless (eq (funcall method original)
|
||||
'again)
|
||||
(setq methods (cdr methods))))
|
||||
(t
|
||||
(setq methods (cdr methods))
|
||||
(yas--warning "Invalid element `%s' in `yas-key-syntaxes'" method)))
|
||||
(let ((prefix (buffer-substring-no-properties (point) original)))
|
||||
(unless (equal prefix (car prefixes))
|
||||
(push prefix prefixes))))
|
||||
(nreverse prefixes))))
|
||||
|
||||
(defun company-yasnippet--candidates (prefix)
|
||||
;; Process the prefixes in reverse: unlike Yasnippet, we look for prefix
|
||||
;; matches, so the longest prefix with any matches should be the most useful.
|
||||
(cl-loop with tables = (yas--get-snippet-tables)
|
||||
for key-prefix in (company-yasnippet--key-prefixes)
|
||||
;; Only consider keys at least as long as the symbol at point.
|
||||
when (>= (length key-prefix) (length prefix))
|
||||
thereis (company-yasnippet--completions-for-prefix prefix
|
||||
key-prefix
|
||||
tables)))
|
||||
|
||||
(defun company-yasnippet--completions-for-prefix (prefix key-prefix tables)
|
||||
(cl-mapcan
|
||||
(lambda (table)
|
||||
(let ((keyhash (yas--table-hash table))
|
||||
(requirement (yas--require-template-specific-condition-p))
|
||||
res)
|
||||
(when keyhash
|
||||
(maphash
|
||||
(lambda (key value)
|
||||
(when (and (stringp key)
|
||||
(string-prefix-p key-prefix key))
|
||||
(maphash
|
||||
(lambda (name template)
|
||||
(when (yas--template-can-expand-p
|
||||
(yas--template-condition template) requirement)
|
||||
(push
|
||||
(propertize key
|
||||
'yas-annotation name
|
||||
'yas-template template
|
||||
'yas-prefix-offset (- (length key-prefix)
|
||||
(length prefix)))
|
||||
res)))
|
||||
value)))
|
||||
keyhash))
|
||||
res))
|
||||
tables))
|
||||
|
||||
(defun company-yasnippet--doc (arg)
|
||||
(let ((template (get-text-property 0 'yas-template arg))
|
||||
(mode major-mode)
|
||||
(file-name (buffer-file-name)))
|
||||
(defvar yas-prompt-functions)
|
||||
(with-current-buffer (company-doc-buffer)
|
||||
(let ((buffer-file-name file-name))
|
||||
(yas-minor-mode 1)
|
||||
(setq-local yas-prompt-functions '(yas-no-prompt))
|
||||
(condition-case error
|
||||
(yas-expand-snippet (yas--template-content template))
|
||||
(error
|
||||
(message "%s" (error-message-string error))))
|
||||
(delay-mode-hooks
|
||||
(let ((inhibit-message t))
|
||||
(if (eq mode 'web-mode)
|
||||
(progn
|
||||
(setq mode 'html-mode)
|
||||
(funcall mode))
|
||||
(funcall mode)))
|
||||
(ignore-errors (font-lock-ensure))))
|
||||
(current-buffer))))
|
||||
|
||||
(defun company-yasnippet--prefix ()
|
||||
;; We can avoid the prefix length manipulations after GH#426 is fixed.
|
||||
(let* ((prefix (company-grab-symbol))
|
||||
(tables (yas--get-snippet-tables))
|
||||
(key-prefixes (company-yasnippet--key-prefixes))
|
||||
key-prefix)
|
||||
(while (and key-prefixes
|
||||
(setq key-prefix (pop key-prefixes)))
|
||||
(when (company-yasnippet--completions-for-prefix
|
||||
prefix key-prefix tables)
|
||||
;; Stop iteration.
|
||||
(setq key-prefixes nil)))
|
||||
(if (equal key-prefix prefix)
|
||||
prefix
|
||||
(cons prefix (length key-prefix)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun company-yasnippet (command &optional arg &rest _ignore)
|
||||
"`company-mode' backend for `yasnippet'.
|
||||
|
||||
This backend should be used with care, because as long as there are
|
||||
snippets defined for the current major mode, this backend will always
|
||||
shadow backends that come after it. Recommended usages:
|
||||
|
||||
* In a buffer-local value of `company-backends', grouped with a backend or
|
||||
several that provide actual text completions.
|
||||
|
||||
(add-hook \\='js-mode-hook
|
||||
(lambda ()
|
||||
(set (make-local-variable \\='company-backends)
|
||||
\\='((company-dabbrev-code company-yasnippet)))))
|
||||
|
||||
* After keyword `:with', grouped with other backends.
|
||||
|
||||
(push \\='(company-semantic :with company-yasnippet) company-backends)
|
||||
|
||||
* Not in `company-backends', just bound to a key.
|
||||
|
||||
(global-set-key (kbd \"C-c y\") \\='company-yasnippet)
|
||||
"
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-yasnippet))
|
||||
(prefix
|
||||
(and (bound-and-true-p yas-minor-mode)
|
||||
(company-yasnippet--prefix)))
|
||||
(annotation
|
||||
(funcall company-yasnippet-annotation-fn
|
||||
(get-text-property 0 'yas-annotation arg)))
|
||||
(candidates (company-yasnippet--candidates arg))
|
||||
(doc-buffer (company-yasnippet--doc arg))
|
||||
(no-cache t)
|
||||
(kind 'snippet)
|
||||
(post-completion
|
||||
(let ((template (get-text-property 0 'yas-template arg))
|
||||
(prefix-offset (get-text-property 0 'yas-prefix-offset arg)))
|
||||
(yas-expand-snippet (yas--template-content template)
|
||||
(- (point) (length arg) prefix-offset)
|
||||
(point)
|
||||
(yas--template-expand-env template))))))
|
||||
|
||||
(provide 'company-yasnippet)
|
||||
;;; company-yasnippet.el ends here
|
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-yasnippet.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company-yasnippet.elc
Normal file
Binary file not shown.
4337
desktop/.emacs.d/elpa/company-20240625.0/company.el
Normal file
4337
desktop/.emacs.d/elpa/company-20240625.0/company.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
desktop/.emacs.d/elpa/company-20240625.0/company.elc
Normal file
BIN
desktop/.emacs.d/elpa/company-20240625.0/company.elc
Normal file
Binary file not shown.
1707
desktop/.emacs.d/elpa/company-20240625.0/company.info
Normal file
1707
desktop/.emacs.d/elpa/company-20240625.0/company.info
Normal file
File diff suppressed because it is too large
Load diff
18
desktop/.emacs.d/elpa/company-20240625.0/dir
Normal file
18
desktop/.emacs.d/elpa/company-20240625.0/dir
Normal file
|
@ -0,0 +1,18 @@
|
|||
This is the file .../info/dir, which contains the
|
||||
topmost node of the Info hierarchy, called (dir)Top.
|
||||
The first time you invoke Info you start off looking at this node.
|
||||
|
||||
File: dir, Node: Top This is the top of the INFO tree
|
||||
|
||||
This (the Directory node) gives a menu of major topics.
|
||||
Typing "q" exits, "H" lists all Info commands, "d" returns here,
|
||||
"h" gives a primer for first-timers,
|
||||
"mEmacs<Return>" visits the Emacs manual, etc.
|
||||
|
||||
In Emacs, you can click mouse button 2 on a menu item or cross reference
|
||||
to select it.
|
||||
|
||||
* Menu:
|
||||
|
||||
Emacs misc features
|
||||
* Company: (company). A modular text completion framework.
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue